Use aesDecrypt() method

This commit is contained in:
de4dot 2011-12-31 15:12:41 +01:00
parent eb63c27fc9
commit 6b629f20c7
2 changed files with 2 additions and 14 deletions

View File

@ -155,12 +155,7 @@ namespace de4dot.code.deobfuscators.dotNET_Reactor.v4 {
if (encryptedDataResource == null || key == null || iv == null)
throw new ApplicationException("Can't decrypt resource");
using (var aes = new RijndaelManaged { Mode = CipherMode.CBC }) {
using (var transform = aes.CreateDecryptor(key, iv)) {
var encryptedData = encryptedDataResource.GetResourceData();
return transform.TransformFinalBlock(encryptedData, 0, encryptedData.Length);
}
}
return DeobUtils.aesDecrypt(encryptedDataResource.GetResourceData(), key, iv);
}
public byte[] encrypt(byte[] data) {

View File

@ -20,7 +20,6 @@
using System;
using System.Text;
using System.Collections.Generic;
using System.Security.Cryptography;
using Mono.Cecil;
using Mono.Cecil.Cil;
using de4dot.blocks;
@ -249,13 +248,7 @@ namespace de4dot.code.deobfuscators.dotNET_Reactor.v4 {
else
throw new ApplicationException("Unknown string decrypter version");
byte[] decryptedStringData;
using (var aes = new RijndaelManaged { Mode = CipherMode.CBC }) {
using (var transform = aes.CreateDecryptor(info.key, info.iv)) {
decryptedStringData = transform.TransformFinalBlock(encryptedStringData, 0, encryptedStringData.Length);
}
}
return Encoding.Unicode.GetString(decryptedStringData);
return Encoding.Unicode.GetString(DeobUtils.aesDecrypt(encryptedStringData, info.key, info.iv));
}
}