Line 3: |
Line 3: |
| The application itself (APP), and the title metadata (TMD) is encrypted with a console specific key. This means that Nintendo intended that these files can only be imported back into the same DSi. | | The application itself (APP), and the title metadata (TMD) is encrypted with a console specific key. This means that Nintendo intended that these files can only be imported back into the same DSi. |
| | | |
− | While the banner, the public savegame, and several other metadata blocks 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 = |
| + | 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 encrypted trail block at the end. |
| + | |
| + | This 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, 12th, 13th and 14th 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). 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. |
| + | |
| | | |
| = B4 block = | | = B4 block = |