Difference between revisions of "Title metadata"
Jump to navigation
Jump to search
(4 bytes + 2 bytes + 2 bytes + 8 bytes + 20 bytes != 0x30 bytes :S) |
m |
||
Line 6: | Line 6: | ||
Many operations are done in terms of 64-byte blocks, which means you will often see padding out to the nearest 64-byte boundary at the end of a field. | Many operations are done in terms of 64-byte blocks, which means you will often see padding out to the nearest 64-byte boundary at the end of a field. | ||
− | + | <source lang="c"> | |
typedef unsigned char u8; | typedef unsigned char u8; | ||
typedef unsigned short u16; | typedef unsigned short u16; | ||
typedef unsigned int u32; | typedef unsigned int u32; | ||
typedef unsigned long u64; | typedef unsigned long u64; | ||
− | + | </source> | |
+ | <source lang="c"> | ||
typedef struct { | typedef struct { | ||
u32 cid; // content id | u32 cid; // content id | ||
Line 19: | Line 20: | ||
u8 hash [20]; // SHA1 hash content | u8 hash [20]; // SHA1 hash content | ||
} content_record; // size: 0x24 bytes | } content_record; // size: 0x24 bytes | ||
− | + | </source> | |
+ | <source lang="c"> | ||
enum sig_type { | enum sig_type { | ||
RSA_2048 = 0x00010001, | RSA_2048 = 0x00010001, | ||
RSA_4096 = 0x00010000 | RSA_4096 = 0x00010000 | ||
}; | }; | ||
− | + | </source> | |
+ | <source lang="c"> | ||
typedef struct { | typedef struct { | ||
u32 sig_type; | u32 sig_type; | ||
Line 46: | Line 49: | ||
content_record contents[num_contents]; | content_record contents[num_contents]; | ||
} tmd; | } tmd; | ||
− | + | </source> | |
The tmd is then followed by a chain of certificates, where each certificate is of the general form | The tmd is then followed by a chain of certificates, where each certificate is of the general form | ||
− | + | <source lang="c"> | |
u32 sig_type; // | u32 sig_type; // | ||
u8 sig[256]; // 256 for RSA_2048, 512 for RSA_4096 | u8 sig[256]; // 256 for RSA_2048, 512 for RSA_4096 | ||
Line 55: | Line 58: | ||
u8 name[64]; // name of thing being signed | u8 name[64]; // name of thing being signed | ||
u8 key[...]; | u8 key[...]; | ||
+ | </source> |
Revision as of 07:21, 3 May 2008
Nintendo Wii Title-Metadata (tmd) file structure
A "title" is a standalone entity -- a game, a channel, etc. Titles can be made up of multiple "contents". (Don't ask me. I just work here.)
Many operations are done in terms of 64-byte blocks, which means you will often see padding out to the nearest 64-byte boundary at the end of a field.
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
typedef unsigned long u64;
typedef struct {
u32 cid; // content id
u16 index; // # number of the file
u16 type;
u64 size;
u8 hash [20]; // SHA1 hash content
} content_record; // size: 0x24 bytes
enum sig_type {
RSA_2048 = 0x00010001,
RSA_4096 = 0x00010000
};
typedef struct {
u32 sig_type;
u8 sig[256];
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;
u16 boot_index;
u16 fill3;
content_record contents[num_contents];
} tmd;
The tmd is then followed by a chain of certificates, where each certificate is of the general form
u32 sig_type; //
u8 sig[256]; // 256 for RSA_2048, 512 for RSA_4096
u8 issuer[32];
u32 tag; // identifies what is being signed
u8 name[64]; // name of thing being signed
u8 key[...];