Stuff works
This commit is contained in:
@@ -58,7 +58,7 @@ public static class Encryption
|
||||
/// <returns>the decrypted bytes</returns>
|
||||
public static byte[] Decrypt(byte[] encryptedData, string udId)
|
||||
{
|
||||
using (var rj = new RijndaelManaged())
|
||||
using (var rj = Aes.Create())
|
||||
{
|
||||
rj.KeySize = EncryptionKeySize;
|
||||
rj.Mode = EncryptionMode;
|
||||
@@ -71,16 +71,8 @@ public static class Encryption
|
||||
Array.Copy(encryptedData, 0, encryptedValueBytes, 0, encryptedValueBytes.Length);
|
||||
ICryptoTransform transform = rj.CreateDecryptor(keyBytes, rgbIv);
|
||||
byte[] decryptedValueBytes = new byte[encryptedValueBytes.Length];
|
||||
using (MemoryStream ms = new MemoryStream(encryptedValueBytes))
|
||||
{
|
||||
using (CryptoStream cs = new CryptoStream(ms, transform, CryptoStreamMode.Read))
|
||||
{
|
||||
cs.CopyTo(decryptedValueBytes);
|
||||
cs.Flush();
|
||||
ms.Flush();
|
||||
}
|
||||
}
|
||||
return decryptedValueBytes;
|
||||
rj.Key = keyBytes;
|
||||
return rj.DecryptCbc(encryptedValueBytes, rgbIv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user