Stuff works

This commit is contained in:
gamer147
2024-09-08 10:27:12 -04:00
parent 7e4bce9ac5
commit ac3b002d74
14 changed files with 157 additions and 87 deletions

View File

@@ -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);
}
}