mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Use Aes128CtrTransform in DecryptRsaKey
This commit is contained in:
parent
ac6d528a30
commit
5a15118706
1 changed files with 6 additions and 10 deletions
|
@ -106,21 +106,17 @@ namespace LibHac
|
|||
{
|
||||
var counter = new byte[0x10];
|
||||
Array.Copy(encryptedKey, counter, 0x10);
|
||||
var body = new byte[0x230];
|
||||
Array.Copy(encryptedKey, 0x10, body, 0, 0x230);
|
||||
var dec = new byte[0x230];
|
||||
var key = new byte[0x230];
|
||||
Array.Copy(encryptedKey, 0x10, key, 0, 0x230);
|
||||
|
||||
using (var storageDec = new Aes128CtrStorage(new MemoryStorage(body), kek, counter, false))
|
||||
{
|
||||
storageDec.Read(dec, 0);
|
||||
}
|
||||
new Aes128CtrTransform(kek, counter).TransformBlock(key);
|
||||
|
||||
var d = new byte[0x100];
|
||||
var n = new byte[0x100];
|
||||
var e = new byte[4];
|
||||
Array.Copy(dec, 0, d, 0, 0x100);
|
||||
Array.Copy(dec, 0x100, n, 0, 0x100);
|
||||
Array.Copy(dec, 0x200, e, 0, 4);
|
||||
Array.Copy(key, 0, d, 0, 0x100);
|
||||
Array.Copy(key, 0x100, n, 0, 0x100);
|
||||
Array.Copy(key, 0x200, e, 0, 4);
|
||||
|
||||
BigInteger dInt = GetBigInteger(d);
|
||||
BigInteger nInt = GetBigInteger(n);
|
||||
|
|
Loading…
Reference in a new issue