Tickets are a format used to store an encrypted titlekey (using 128-Bit AES-CBC). This format seems to be identical to DSi/Wii tickets.
All of the data in the file is represented in Big Endian.
The total size of this section is referred to as "Y" in the overall TMD structure. The signature is of the header of the TMD.
|0x4 + X||Padding Aligning the signature data to 0x40 bytes|
|Value||Signature Method||Signature Size||Padding Size|
|0x010000||RSA_4096 SHA1 (Unused for 3DS)||0x200||0x3C|
|0x010001||RSA_2048 SHA1 (Unused for 3DS)||0x100||0x3C|
|0x010002||Elliptic Curve with SHA1 (Unused for 3DS)||0x3C||0x40|
|0x010005||ECDSA with SHA256||0x3C||0x40|
The hash for the signature is calculated over the Ticket Data.
|0x40||0x3C||ECDH data for console-unique eShop tickets.|
|0x7C||0x3||Unknown, first u8 is 0x01.|
|0xA6||0x2||Ticket title version, this generally the same as the title version stored in the Title Metadata.|
|0xB1||0x1||Ticket common keyY index, usually 0x1 for retail system titles.|
|0x164||0xAC||Content Index Setup (Complex)|
The titlekey is decrypted by using the AES engine with the ticket common-key keyslot where the keyY is one of 6 keyYs loaded via the keyY index stored in the ticket. AES-CBC mode is used where the IV is the big-endian titleID. Note that on a retail unit index0 is a retail keyY, while on a dev-unit index0 is the dev common-key which is a normal-key.(On retail for these keyYs, the hardware key-scrambler is used)
Tickets retrieved from CDN/SOAP have a certificate chain appended at the end of the file. There are two certificates in this chain:
|CERTIFICATE||SIGNATURE TYPE||RETAIL CERT NAME||DEBUG CERT NAME||DESCRIPTION|
|Ticket||RSA-2048||XS0000000c||XS00000009||Used to verify the Ticket signature|
|CA||RSA-4096||CA00000003||CA00000004||Used to verify the Ticket Certificate|
The CA certificate is issued by 'Root', the public key for which is stored in NATIVE_FIRM.
- CommonETicket (for short, cetk) is the name given to tickets for titles which are not available on the eShop, like system titles. As the name suggests, they are not unique tickets, the same ticket is common to each 3ds which has installed that title. This is in contrast to tickets for eShop content, which are generated prior to initial download, and are unique to 3ds it was generated for.
- CETK can be fetched through HTTP using the link to default update server, using the title's TMD URL where "cetk" is used instead of "tmd" for the URL. The 3DS NIM module retrieves system tickets via SOAP request GetCommonETicket.