Difference between revisions of "Title metadata"
Jump to navigation
Jump to search
(Added table with offsets similar to WiiBrew, DSiBrew, entries. Signature throws off values?) |
(Multi-column entries for offsets) |
||
Line 6: | Line 6: | ||
=== Header === | === Header === | ||
{| class="wikitable" | {| class="wikitable" | ||
− | | | + | | align="center" style="background:#f0f0f0;"|'''Start''' |
− | + | | align="center" style="background:#f0f0f0;"|''' ''' | |
− | + | | align="center" style="background:#f0f0f0;"|'''Length''' | |
− | + | | align="center" style="background:#f0f0f0;"|'''Description''' | |
|- | |- | ||
− | | | + | | ''RSA 2048''||''RSA 4096''|||| |
− | | | ||
− | | | ||
|- | |- | ||
− | | | + | | 0x000||0x000||4||Signature type |
− | | | ||
− | | Signature | ||
|- | |- | ||
− | | | + | | 0x004||0x004||256 / 512||Signature |
− | | | ||
− | | | ||
|- | |- | ||
− | | | + | | 0x104||0x204||60||Padding modulo 64 |
− | | 64 | ||
− | |||
|- | |- | ||
− | | | + | | 0x140||0x240||64||Issuer |
− | | | ||
− | | | ||
|- | |- | ||
− | | | + | | 0x180||0x280||1||Version |
− | | 1 | ||
− | | | ||
|- | |- | ||
− | | | + | | 0x181||0x281||1||ca_crl_version |
− | | 1 | ||
− | | | ||
|- | |- | ||
− | | | + | | 0x182||0x282||1||signer_crl_version |
− | | 1 | ||
− | | | ||
|- | |- | ||
− | | | + | | 0x183||0x283||1||Padding modulo 64 |
− | | | ||
− | | | ||
|- | |- | ||
− | | | + | | 0x184||0x284||8||System Version |
− | | 8 | ||
− | | | ||
|- | |- | ||
− | | | + | | 0x18C||0x28C||8||Title ID |
− | | | ||
− | | Title | ||
|- | |- | ||
− | | | + | | 0x194||0x294||4||Title type |
− | | | ||
− | | | ||
|- | |- | ||
− | | | + | | 0x198||0x298||2||Group ID |
− | | | ||
− | | | ||
|- | |- | ||
− | | | + | | 0x19A||0x29A||62||reserved |
− | | | ||
− | | | ||
|- | |- | ||
− | | | + | | 0x1D8||0x2D8||4||Access rights |
− | | | ||
− | | | ||
|- | |- | ||
− | | | + | | 0x1DC||0x2DC||2||Title version |
− | | 2 | ||
− | | | ||
|- | |- | ||
− | | | + | | 0x1DE||0x2DE||2||Number of contents |
− | | | ||
− | | | ||
|- | |- | ||
− | | | + | | 0x1E0||0x2E0||64||Content Records |
− | | | ||
− | | | ||
|- | |- | ||
− | | | + | | 0x220||0x320||40||Padding modulo 64 |
− | | | ||
− | | | ||
|- | |- | ||
− | | | + | | 0x248||0x348||4||Boot content |
− | | 4 | ||
− | | | ||
|- | |- | ||
− | | | + | | 0x252||0x352||4||Banner content |
− | | 4 | ||
− | | Banner | ||
|- | |- | ||
− | | 0x260 | + | | 0x256||0x356||4||Banner size |
− | | 32 | + | |- |
− | | Hash | + | | 0x260||0x360||32||Hash |
− | |||
|} | |} | ||
Revision as of 04:08, 30 March 2011
Title metadata is a format used to store information about a title (a single standalone game, channel, etc.) and all its installed contents, including which contents they consist of and their SHA1 hashes.
Code is available by trap15 to parse the available information from the 3DS format of TMDs.
Structure
Header
Start | Length | Description | |
RSA 2048 | RSA 4096 | ||
0x000 | 0x000 | 4 | Signature type |
0x004 | 0x004 | 256 / 512 | Signature |
0x104 | 0x204 | 60 | Padding modulo 64 |
0x140 | 0x240 | 64 | Issuer |
0x180 | 0x280 | 1 | Version |
0x181 | 0x281 | 1 | ca_crl_version |
0x182 | 0x282 | 1 | signer_crl_version |
0x183 | 0x283 | 1 | Padding modulo 64 |
0x184 | 0x284 | 8 | System Version |
0x18C | 0x28C | 8 | Title ID |
0x194 | 0x294 | 4 | Title type |
0x198 | 0x298 | 2 | Group ID |
0x19A | 0x29A | 62 | reserved |
0x1D8 | 0x2D8 | 4 | Access rights |
0x1DC | 0x2DC | 2 | Title version |
0x1DE | 0x2DE | 2 | Number of contents |
0x1E0 | 0x2E0 | 64 | Content Records |
0x220 | 0x320 | 40 | Padding modulo 64 |
0x248 | 0x348 | 4 | Boot content |
0x252 | 0x352 | 4 | Banner content |
0x256 | 0x356 | 4 | Banner size |
0x260 | 0x360 | 32 | Hash |
Content Records
Start | Length | Description |
---|---|---|
0x00 | 4 | Content ID |
0x04 | 32 | SHA-256 Hash |
Certificates
Start | Length | Description |
---|---|---|
0x000 | 4 | Signature type |
0x004 | * | Signature |
0x104 | 64 | Issuer |
0x124 | 4 | Tag |
0x128 | 64 | Name |
0x168 | Key |
Example code application
typedef struct {
u32 cid; // content id
u8 hash[0x20]; // SHA-256 hash
} content_record; // size: 0x24 bytes
enum sig_type {
RSA_2048_SHA256 = 0x00010004,
RSA_4096_SHA256 = 0x00010003,
RSA_2048_SHA1 = 0x00010001,
RSA_4096_SHA1 = 0x00010000
};
typedef struct {
u32 sig_type;
u8 sig[*]; // * Signature size
u8 fill1[60];
u8 issuer[64]; // Root-CA%08x-CP%08x
u8 version;
u8 ca_crl_version;
u8 signer_crl_version;
u8 fill2;
u64 sys_version;
u64 title_id;
u32 title_type;
u16 group_id; // publisher
u8 reserved[62];
u32 access_rights;
u16 title_version;
u16 num_contents;
content_record contents[0x40];
u8 padding[0x28];
u32 boot_content;
u32 banner_content;
u32 banner_size;
u8 hash[0x20]; /* Huh? */
} tmd;
//The tmd is then followed by a chain of certificates, where each certificate is of the general form
typedef struct {
u32 sig_type;
u8 sig[*]; // * Signature size
u8 issuer[64];
u32 tag; // identifies what is being signed
u8 name[64]; // name of thing being signed
u8 key[...];
} certificate;