Title Metadata

Title Metadata

Title metadata is a format used to store information about a title (installed title, DLC, etc.) and all its installed contents, including which contents they consist of and their SHA256 hashes.

🔗 Code is available by trap15 to parse the available information from the 3DS format of TMDs.

Structure #

All the data in the file represented in Big Endian, unless otherwise noted.

OffsetSizeDescription
0x0YSignature Data
Y0xC4Header
0xC4 + Y0x24*64Content Info Records.
0x9C4 + Y0x30*ContentCountContent Chunk Records.

Y denotes the total size of the “Signature Data” section and depends on the signature type.

Signature Data #

The signature is of the header of the TMD.

OffsetSizeDescription
0x00x4Signature Type
0x4XSignature
0x4 + XPadding Aligning the signature data to 0x40 bytes

Signature Type #

The hash for the signature, is calculated over the header of the TMD

OffsetSizeDescription
0x00x40Signature Issuer
0x400x1Version
0x410x1ca_crl_version
0x420x1signer_crl_version
0x430x1Reserved
0x440x8System Version
0x4C0x8Title ID
0x540x4Title Type
0x580x2Group ID
0x5A0x4Save Data Size in Little Endian (Bytes) (Also SRL Public Save Data Size)
0x5E0x4SRL Private Save Data Size in Little Endian (Bytes)
0x620x4Reserved
0x660x1SRL Flag
0x670x31Reserved
0x980x4Access Rights
0x9C0x2Title Version
0x9E0x02Content Count
0xA00x2Boot Content
0xA20x2Padding
0xA40x20SHA-256 Hash of the Content Info Records

Content Info Records #

There are 64 of these records, usually only the first is used.

OffsetSizeDescription
0x002Content index offset
0x022Content command count [k]
0x040x20SHA-256 hash of the next k content records that have not been hashed yet

Content chunk records #

There is one of these for each content contained in this title. (Determined by “Content Count” in the TMD Header).

OffsetSizeDescription
0x004Content id
0x042Content index
0x062Content type
0x088Content size
0x100x20SHA-256 hash

Content Index #

This indicates the content type:

IndexContent Type
0000Main Content (. CXI for 3DS executable content/. CFA for 3DS Data Archives/.SRL for TWL content)
0001Home Menu Manual (. CFA)
0002DLP Child Container (. CFA)

This does not apply to DLC.

Content Type flags #

FlagsDescription
1Encrypted
2Disc
4CFM (abbreviation for?)
0x4000Optional
0x8000Shared

Certificate Chain #

If the TMD file is obtained from Nintendo’s CDN, then it will have two certificates appended at the end of the file:

CERTIFICATESIGNATURE TYPERETAIL CERT NAMEDEBUG CERT NAMEDESCRIPTION
TMDRSA-2048CP0000000bCP0000000aUsed to verify the TMD signature
CARSA-4096CA00000003CA00000004Used to verify the TMD Certificate

The CA certificate is issued by ‘Root’, the public key for which is stored in NATIVE_FIRM.

Example code application #

 enum sig_type {
         RSA_2048_SHA256 = 0x00010004,
         RSA_4096_SHA256 = 0x00010003,
         RSA_2048_SHA1   = 0x00010001,
         RSA_4096_SHA1   = 0x00010000
 };

// Sorry I removed the example struct because it is wrong.

Category:File formats