Line 5: |
Line 5: |
| While the banner, the public savegame, and several other metablocks are encrypted with a shared key, which means any DSi can inspect these parts of the file. | | While the banner, the public savegame, and several other metablocks are encrypted with a shared key, which means any DSi can inspect these parts of the file. |
| | | |
− | = ES blocks =
| + | [[ES block encryption|ES block encryption]] is used to encrypt the header block, footer block, and the 11 parts. |
− | An ES block, for lack of a better name, is a commonly used data encryption method on DSi by Nintendo.
| |
− | | |
− | It uses AES CCM to encrypt a maximum of 0x20000 bytes of data per time, and extends it with a 32 byte trail block at the end.
| |
− | | |
− | A part of the last 16 bytes of trail block itself is encrypted with AES CTR, and contains the nonce for decryption and size of the ES block:
| |
− | 0000000: qq qq qq qq qq qq qq qq qq qq qq qq qq qq qq qq
| |
− | 0000010: xx nn nn nn nn nn nn nn nn nn nn nn nn yy yy yy
| |
− | | |
− | The counter used for decrypting the trail block is the last 16 bytes of the trailblock, with the first, 14th, 15th and 16th byte set to 0:
| |
− | 00 nn nn nn nn nn nn nn nn nn nn nn nn 00 00 00
| |
− | | |
− | After decrypting the trailblock, xx is always 0x3A, and yy is the size of the ES block (excluding the trail block). The nonce after decryption is not used. It is assumed that qq is a MAC (Message Authentication Code), used to verify the contents of the ES block after decryption, but this has not been verified yet.
| |
− | | |
− | The same 12-byte nonce from the trailblock is again used to decrypt the whole ES block itself.
| |
− | | |
− | Data larger than 0x20000 bytes is split into multiple ES blocks, each with their own trailblock.
| |
− | | |
− | ES block encryption is used to encrypt the header block, footer block, and the 11 parts. | |
| | | |
| | | |