DSiWare Exports

DSiWare Exports

The DSiWare exported from a 3DS is located at “ sdmc:/Nintendo 3DS///Nintendo DSiWare”. Filenames are same format as 🔗 DSi: “.bin”. The below sizes include the 0x20-byte block metadata.

DSiWare exported from 3DS use console-unique keyslots initialized by movable.sed. Each section is encrypted with AES-CBC.

The content sections are ordered the same way as DSi: TMD, SRL from content0, , public.sav, and banner.sav when banner.sav exists. When the DSiWare export type is 7-11, the 12th content section is the private.sav, if it exists.(ContentX here is the .app data from TWL-NAND /title)

DSiWare Export Types #

ValueFormat versionDescription
0-6Same as value 14.
7-11v212 content sections
12v24 content sections
13v14 content sections
14v211 content sections

For NATIVE_FIRM versions where this DSiWare export type field is unused, format version v1 is used with 4 content sections. Otherwise when this field is used, see the above table. System Settings uses type 1 for exporting DSiWare, regardless of the System Settings title-version.

Block Metadata #

OffsetSizeDescription
0x00x10AES MAC over a SHA-256 hash
0x100x10IV, generated by the RNG.

Each section begins with the payload encrypted data, followed by this block metadata. The SHA-256 hash used for the MAC is calculated over the cleartext payload. This hash used for generating the MAC is also stored in the footer.

Footer #

OffsetSizeDescription
0x0XSHA-256 hashes over the banner, header, and content sections. When a content section doesn’t exist, the corresponding hash here is uninitialized.
0x0 + X0x3CECDSA signature using SHA-256 over the previous hashes, signed by the APCert.
0x3C + X0x180ECDSA “APXXXXXXXXXXXXXXXX” cert signed by the below CTCert, where X is random lowercase ASCII hex data.
0x1BC + X0x180ECDSA CTCert
0x33C + X0x4Uninitialized padding.

These hashes are the same hashes used for generating each section’s MAC stored in the metadata block. X = 0x40 + totalcontentsections*0x20.

The curve sect233r1 is used for all related ECDSA signing operations

File Structure v1 #

OffsetSizeDescription
0x00x4020Banner section
0x40200xC0Header section
0x40E00x340 + 0x20 + X, where X is the total size of the hashes stored in the footer.Footer section
0x40E0 + footer_sizeContent sections
OffsetSizeDescription
0x00x4Magic number 0x54444633, “3FDT”.
0x40x2Byte-swapped groupID from the TWL TMD.
0x60x2Byte-swapped title version from the TWL TMD.
0x80x20SHA-256 hash calculated over the encrypted movable.sed.
0x280x10Encrypted AES block from encrypting an all-zero 0x10-byte block with AES-CBC, where the IV is all-zero.
0x380x8Byte-swapped titleID from the TWL TMD.
0x400x8?
0x480x10u32 payload sizes for the 4 content sections.
0x580x4?
0x5C0x3EData from the TWL TMD reserved section. Only the first 0x20-bytes from the TWL TMD is written here, the rest is uninitialized.
0x9A0x6Padding?

File Structure v2 #

OffsetSizeDescription
0x00x4020Banner section
0x40200x110Header section
0x41300x340 + 0x20 + X, where X is the total size of the hashes stored in the footer.Footer section
0x4130 + footer_sizeContent sections

Header #

OffsetSizeDescription
0x00x4Magic number 0x54444633, “3FDT”.
0x40x2Byte-swapped groupID from the TWL TMD.
0x60x2Byte-swapped title version from the TWL TMD.
0x80x20SHA-256 hash calculated over the encrypted movable.sed.
0x280x10Encrypted AES block from encrypting an all-zero 0x10-byte block with AES-CBC, where the IV is all-zero.
0x380x8Byte-swapped titleID from the TWL TMD.
0x400x8?
0x480x2Cu32 payload sizes for the 11 content sections.
0x740x30?
0xA40x3EData from the TWL TMD reserved section. Only the first 0x20-bytes from the TWL TMD is written here, the rest is uninitialized.
0xE20x0EPadding?