Title metadata

From 3dbrew
Revision as of 05:02, 29 March 2011 by Arikado (talk | contribs) (Copied over from http://daifukkat.su/)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Code Application by trap15

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;