mirror of
https://github.com/SciresM/hactool.git
synced 2024-11-27 06:20:35 +00:00
Merge pull request #20 from roblabla/bugfix-pk1key
Allow deriving package1_key from keyblob alone
This commit is contained in:
commit
e99828712c
9
pki.c
9
pki.c
@ -914,6 +914,13 @@ void pki_derive_keys(nca_keyset_t *keyset) {
|
||||
aes_setiv(keyblob_ctx, &keyset->encrypted_keyblobs[i][0x10], 0x10);
|
||||
aes_decrypt(keyblob_ctx, &keyset->keyblobs[i], &keyset->encrypted_keyblobs[i][0x20], sizeof(keyset->keyblobs[i]));
|
||||
free_aes_ctx(keyblob_ctx);
|
||||
}
|
||||
for (unsigned int i = 0; i < 0x20; i++) {
|
||||
/* We only need 0x70:0x80 in the blob. */
|
||||
if (memcmp(keyset->keyblobs[i] + 0x70, zeroes, 0x10) == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Package1 key is at the end of the keyblob. */
|
||||
memcpy(&keyset->package1_keys[i], &keyset->keyblobs[i][0x80], 0x10);
|
||||
}
|
||||
@ -1083,4 +1090,4 @@ void pki_initialize_keyset(nca_keyset_t *keyset, keyset_variant_t variant) {
|
||||
}
|
||||
|
||||
pki_derive_keys(keyset);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user