Ticket

Ticket

Tickets are a format used to store an encrypted titlekey (using 128-Bit AES-CBC). With 3DS, the Ticket format was updated (now v1) from Wii/DSi format (v0).

Structure #

All of the data in the file is represented in Big Endian.

OffsetSizeDescription
0x000YSignature Data
Y0x210Ticket Data

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

Signature Data #

The signature is of the ticket header.

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

Signature Type #

The hash for the signature is calculated over the Ticket Data.

Ticket Data #

OffsetSizeDescription
0x00x40Issuer
0x400x3CECC PublicKey
0x7C0x1Version (For 3DS this is always 1)
0x7D0x1CaCrlVersion
0x7E0x1SignerCrlVersion
0x7F0x10TitleKey (normal-key encrypted using one of the common keyYs; see below)
0x8F0x1Reserved
0x900x8TicketID
0x980x4ConsoleID
0x9C0x8TitleID
0xA40x2Reserved
0xA60x2Ticket title version
0xA80x8Reserved
0xB00x1License Type
0xB10x1Index to the common keyY used for this ticket, usually 0x1 for retail system titles; see below.
0xB20x2AReserved
0xDC0x4eShop Account ID?
0xE00x1Reserved
0xE10x1Audit
0xE20x42Reserved
0x1240x40Limits
0x164XContent Index
  • For v0 of the format, see here
  • The Ticket Title Version is generally the same as the title version stored in the Title Metadata. Although it doesn’t have to match the TMD version to be valid.
  • The titlekey is decrypted by using the AES engine with the ticket common-key keyslot. The keyY is selected through an index (ticket offset 0xB1) into a plaintext array of 6 keys (“common keyYs”) stored in the data section of Process9. 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)
  • The titlekey is used to decrypt content downloaded from the CDN using 128-bit AES-CBC with the content index (as big endian u16, padded with trailing zeroes) as the IV.
  • In demos, the first u32 in the “Limits” section is 0x4, then the second u32 is the max-playcount.
  • The Content Index of a ticket has its own size defined within itself, with seemingly a minimal of 20 bytes, the second u32 in big endian defines the full value of X.

Certificate Chain #

Tickets retrieved from CDN/SOAP have a certificate chain appended at the end of the file. There are two certificates in this chain:

CERTIFICATESIGNATURE TYPERETAIL CERT NAMEDEBUG CERT NAMEDESCRIPTION
TicketRSA-2048XS0000000cXS00000009Used to verify the Ticket signature
CARSA-4096CA00000003CA00000004Used to verify the Ticket Certificate

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

Some facts #

  • 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 GetSystemCommonETicket instead of directly downloading the cetks with HTTPS. The cetks are also accessible via HTTP (even though the 3DS never accesses them like that).

Category:File formats