wwylele / save3ds

Extract/Import/FUSE for 3DS save/extdata/database.
Apache License 2.0
54 stars 6 forks source link

Automatic derivation of 0x2F keyY #7

Open Cu3PO42 opened 4 years ago

Cu3PO42 commented 4 years ago

Key 0x2F keyY is derived by NATIVE_FIRM, but the derivation procedure is arguably quite simple. It is probably best summarised by this one line from SciresM/3ds-pohlig-hellmann:

keys = hashlib.sha256(binascii.unhexlify('%0512X' % pow(asn1, d, n))).hexdigest().upper()

where asn1 is some data that would need to be hardcoded and d and n can be read from boot9.

I'm not sure if hardcoding (some) data is something that aligns with the ideas you have for this project, but I believe it would be quite convenient, since it's a lot less clear how to obtain that key than it is to obtain boot9.

Maybe a similar procedure would also be viable for 0x19 and 0x1A keyX?