Use Aes128CtrTransform in DecryptRsaKey

This commit is contained in:
Alex Barney 2018-12-09 18:23:46 -06:00
parent ac6d528a30
commit 5a15118706

View file

@ -106,21 +106,17 @@ namespace LibHac
{ {
var counter = new byte[0x10]; var counter = new byte[0x10];
Array.Copy(encryptedKey, counter, 0x10); Array.Copy(encryptedKey, counter, 0x10);
var body = new byte[0x230]; var key = new byte[0x230];
Array.Copy(encryptedKey, 0x10, body, 0, 0x230); Array.Copy(encryptedKey, 0x10, key, 0, 0x230);
var dec = new byte[0x230];
using (var storageDec = new Aes128CtrStorage(new MemoryStorage(body), kek, counter, false)) new Aes128CtrTransform(kek, counter).TransformBlock(key);
{
storageDec.Read(dec, 0);
}
var d = new byte[0x100]; var d = new byte[0x100];
var n = new byte[0x100]; var n = new byte[0x100];
var e = new byte[4]; var e = new byte[4];
Array.Copy(dec, 0, d, 0, 0x100); Array.Copy(key, 0, d, 0, 0x100);
Array.Copy(dec, 0x100, n, 0, 0x100); Array.Copy(key, 0x100, n, 0, 0x100);
Array.Copy(dec, 0x200, e, 0, 4); Array.Copy(key, 0x200, e, 0, 4);
BigInteger dInt = GetBigInteger(d); BigInteger dInt = GetBigInteger(d);
BigInteger nInt = GetBigInteger(n); BigInteger nInt = GetBigInteger(n);