wiithon.disc.structs.ticket module

class wiithon.disc.structs.ticket.Ticket[source]

Bases: object

Wii partition ticket

Contains the encrypted title key and metadata needed to decrypt partition data. See https://wiibrew.org/wiki/Ticket

Structure, 0x2A4 bytes for v0 and 0x2B7 for v1:

----------------------------------------- Signed Blob Header
Offset  Size            Field
0x000   0x04            Signature Type
0x004   0x100           Signature
0x104   0x3C            60 bytes of padding
----------------------------------------- V0 Ticket
0x140   0x40            Signature issuer
0x180   0x3C            ECDH data (Elliptic Curve Diffie-Hellman)
0x1BC   0x01            Ticket format version
0x1BD   0x02            Reserved
0x1BF   0x10            Title Key, encrypted by Common Key
0x1CF   0x01            Unknown
0x1D0   0x08            ticket_id, used as IV for title key decryption of console specific titles
0x1D8   0x04            Console ID, NG ID in console specific titles
0x1DC   0x08            Title ID, also the IV used for AES-CBC encryption
0x1E4   0x02            Unknown, mostly 0xFFFF
0x1E6   0x02            Ticket title version
0x1E8   0x04            Permitted Titles Mask
0x1EC   0x04            Permit mask, ANDed with the inverse of the current disc title
0x1F0   0x01            Title export allowed using PRNG key, 1 = allowed
0x1F1   0x01            Common Key index, 0 = normal, 1 = Korean, 2 = Wii U Wii mode
0x1F2   0x03            Unknown, all 0 except for VC where the last byte is 1
0x1F5   0x2D            Unknown
0x222   0x40            Content access permissions, one bit per content
0x262   0x02            Padding, always 0
0x264   0x04            Limit type, 0 = disable, 1 = time limit in minutes, 4 = launch count limit
0x268   0x04            Maximum usage, depending on limit type
0x26C   0x38            7 more limit structs as above
classmethod read(stream)[source]

Read and parse a ticket from a binary stream :type stream: BinaryIO :param stream: Binary IO stream

Return type:

Ticket

Returns:

Ticket

Parameters:

stream (BinaryIO)

write(stream)[source]

Write this ticket to the binary stream :type stream: BinaryIO :param stream: Binary IO stream

Return type:

None

Returns:

None

Parameters:

stream (BinaryIO)