Difference between revisions of "Ticket"

From WiiBrew
Jump to navigation Jump to search
(Fixed bad offsets. Caused by adding a decimal number to a hex number without converting, most likely (LOL))
(Added some padding, also added ending locations)
Line 6: Line 6:
 
|-
 
|-
 
! Start
 
! Start
 +
! End
 
! Length
 
! Length
 
! Description
 
! Description
 
|-
 
|-
| 0x000
+
| 0x0000
 +
| 0x0004
 
| 4
 
| 4
 
| Signature type (always 0x10001 for RSA-2048)
 
| Signature type (always 0x10001 for RSA-2048)
 
|-
 
|-
| 0x005
+
| 0x0004
 +
| 0x0104
 
| 256
 
| 256
 
| Signature by a certificate's key (everything after this field is covered by this signature)
 
| Signature by a certificate's key (everything after this field is covered by this signature)
 
|-
 
|-
| 0x140
+
| 0x0104
 +
| 0x0140
 +
| 60
 +
| Padding (Always 0)
 +
|-
 +
| 0x0140
 +
| 0x0180
 
| 64
 
| 64
 
| Signature issuer
 
| Signature issuer
 
|-
 
|-
| 0x1bf
+
| 0x0180
 +
| 0x01bf
 +
| 63
 +
| Padding (Always 0)
 +
|-
 +
| 0x01bf
 +
| 0x01cf
 
| 16
 
| 16
 
| Encrypted title key
 
| Encrypted title key
 
|-
 
|-
| 0x1dc
+
| 0x01cf
 +
| 0x01bf
 +
| 16
 +
| Unknown
 +
|-
 +
| 0x01dc
 +
| 0x01e4
 
| 8
 
| 8
 
| Title ID / [http://en.wikipedia.org/wiki/Initialization_Vector Initialization Vector] (IV) used for AES-[http://en.wikipedia.org/wiki/Cipher_Block_Chaining#Cipher-block_chaining_.28CBC.29 CBC] encryption
 
| Title ID / [http://en.wikipedia.org/wiki/Initialization_Vector Initialization Vector] (IV) used for AES-[http://en.wikipedia.org/wiki/Cipher_Block_Chaining#Cipher-block_chaining_.28CBC.29 CBC] encryption
 
|-
 
|-
| 0x1f1
+
| 0x01e4
 +
| 0x01f1
 +
| 13
 +
| Padding (Always 0)
 +
|-
 +
| 0x01f1
 +
| 0x01f2
 
| 1
 
| 1
 
| Common Key index (1 = Korean Common key, 0 = "normal" Common key)
 
| Common Key index (1 = Korean Common key, 0 = "normal" Common key)
 
|-
 
|-
| 0x222
+
| 0x01f2
 +
| 0x0222
 +
| 48
 +
| Padding (Always 0)
 +
|-
 +
| 0x0222
 +
| 0x0242
 
| 32
 
| 32
 
| Always 0xFF (?)
 
| Always 0xFF (?)
 
|-
 
|-
| 0x244
+
| 0x0242
 +
| 0x0244
 +
| 2
 +
| Padding (Always 0)
 +
|-
 +
| 0x0244
 +
| 0x0248
 
| 4
 
| 4
 
| Enable time limit (1 = Enabled, 0 = Disabled)
 
| Enable time limit (1 = Enabled, 0 = Disabled)
 
|-
 
|-
| 0x248
+
| 0x0248
 +
| 0x024a
 
| 4
 
| 4
 
| Time limit (Seconds)
 
| Time limit (Seconds)
 +
|-
 +
| 0x024a
 +
| 0x02a4
 +
| 90
 +
| Padding (Always 0)
 
|}
 
|}
  
 
To get the title key decrypt the 16 bytes at offset 0x1bf with the Common Key using the Title ID (offset 0x1dc) as the initialization vector (the last 8 bytes of the IV should be zero).
 
To get the title key decrypt the 16 bytes at offset 0x1bf with the Common Key using the Title ID (offset 0x1dc) as the initialization vector (the last 8 bytes of the IV should be zero).

Revision as of 09:29, 3 November 2008

Tickets are found in many encrypted files used by the Wii (e.g. WAD Files or Wiidiscs). They contain the encrypted AES "title key" and the Title ID of the data followed by a certificate chain. So far only tickets with RSA-2048 signatures have been seen. (Discs will only work with those signatures because the size of partition ticket is always 0x2a4)

File structure

Start End Length Description
0x0000 0x0004 4 Signature type (always 0x10001 for RSA-2048)
0x0004 0x0104 256 Signature by a certificate's key (everything after this field is covered by this signature)
0x0104 0x0140 60 Padding (Always 0)
0x0140 0x0180 64 Signature issuer
0x0180 0x01bf 63 Padding (Always 0)
0x01bf 0x01cf 16 Encrypted title key
0x01cf 0x01bf 16 Unknown
0x01dc 0x01e4 8 Title ID / Initialization Vector (IV) used for AES-CBC encryption
0x01e4 0x01f1 13 Padding (Always 0)
0x01f1 0x01f2 1 Common Key index (1 = Korean Common key, 0 = "normal" Common key)
0x01f2 0x0222 48 Padding (Always 0)
0x0222 0x0242 32 Always 0xFF (?)
0x0242 0x0244 2 Padding (Always 0)
0x0244 0x0248 4 Enable time limit (1 = Enabled, 0 = Disabled)
0x0248 0x024a 4 Time limit (Seconds)
0x024a 0x02a4 90 Padding (Always 0)

To get the title key decrypt the 16 bytes at offset 0x1bf with the Common Key using the Title ID (offset 0x1dc) as the initialization vector (the last 8 bytes of the IV should be zero).