internal string DecryptData(string iEncryptedText, string aesKey, string iv, int iKeySize = 128)
{
PasswordDeriveBytes pdb = new PasswordDeriveBytes(iv, new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F });
PasswordDeriveBytes pdb2 = new PasswordDeriveBytes(aesKey, new byte[] { 0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, 0x65, 0x76 });
RijndaelManaged aesEncryption = new RijndaelManaged();
aesEncryption.KeySize = iKeySize;
aesEncryption.BlockSize = 128;
aesEncryption.Mode = CipherMode.CBC;
aesEncryption.Padding = PaddingMode.Zeros;
aesEncryption.IV = pdb.GetBytes(16);
aesEncryption.Key = pdb2.GetBytes(16); ;
ICryptoTransform decrypto = aesEncryption.CreateDecryptor();
byte[] encryptedBytes = Convert.FromBase64CharArray(iEncryptedText.Replace(" ", "+").ToCharArray(), 0, iEncryptedText.Length);
return Encoding.UTF8.GetString(decrypto.TransformFinalBlock(encryptedBytes, 0, encryptedBytes.Length));
}
Asked
Active
Viewed 19 times
0

TheGeneral
- 79,002
- 9
- 103
- 141

kartikDeo
- 1
- 1
-
1This is a fairly low quality question. Can you spend some time to explain your problem in more than a few words. Please read [ask] – TheGeneral Aug 31 '20 at 06:31
-
You should also show how the data is encrypted in the first place. – AKX Aug 31 '20 at 06:31