CTCert: Difference between revisions

Created page with "=Summary= The console-unique CTCert is used for signing CTX files, the DeviceCert used by eShop, and presumably for DSiWare exports. This ECDSA signature, the ECDSA private k..."
 
Luigoalma (talk | contribs)
Saying 01 is incorrect, its not always 1 that's loaded off dev OTP
 
(9 intermediate revisions by 4 users not shown)
Line 1: Line 1:
=Summary=
=Summary=
The console-unique CTCert is used for signing CTX files, the DeviceCert used by [[eShop]], and presumably for DSiWare exports. This ECDSA signature, the ECDSA private key, and the IssuerID is loaded from memory instead of NAND. This is the 3DS equivalent of DSi TWCert.
The console-unique CTCert is used for signing [[Title Data Structure|CTX]] files, the DeviceCert used by [[eShop]], and for [[DSiWare_Exports|DSiWare]] exports. This ECDSA signature, the ECDSA private key for this cert, and the IssuerID is loaded from memory initialized by bootrom instead of NAND. This is the 3DS equivalent of the DSi TWCert.
 
The CTCert is signed with ECDSA by Nintendo. CTCerts can be verified via a DER stored in NATIVE_FIRM, separate DERs are used for retail and dev/debug.


=Structure=
=Structure=
Line 10: Line 12:
| 0x00
| 0x00
| 0x04
| 0x04
| Type
| [[Certificates|Signature]] Type, 0x010005.
|-
|-
| 0x04
| 0x04
| 0x3C
| 0x3C
| ECDSA Signature
| ECDSA Signature using Nintendo's private key, in big-endian.  The first 0x1E bytes are "r"; the second 0x1E bytes are "s".  The hash is SHA-256 computed over this certificate, starting at byte 0x80 ("Cert Issue ID") to the end.
|-
|-
| 0x40
| 0x40
Line 30: Line 32:
| 0xC4
| 0xC4
| 0x40
| 0x40
| Key ID: "CT<DeviceId>-<ConsoleType>", where DeviceId is the hex [[PSPXI:GetDeviceId|DeviceId]], and ConsoleType is 00 for retail, 01 for dev
| Key ID: "CT<DeviceId>-<ConsoleType>", where DeviceId is the hex [[PSPXI:GetDeviceId|DeviceId]], and ConsoleType is 00 for retail, any other single byte hex value for dev
|-
|-
| 0x104
| 0x104
| 0x04
| Expiration time as UNIX Timestamp in big endian.
|-
| 0x108
| 0x3C
| 0x3C
| ECDSA Public Key
| ECDSA Public Key of this console as a curve point in big-endian.  The first 0x1E bytes are "x" of this point; the second 0x1E bytes are "y".
|-
|-
| 0x140
| 0x144
| 0x40
| 0x3C
| Padding
| Padding
|}
|}


The ECDSA private key is located 0x3C bytes before this cert in internal memory.
Boot ROM decrypts [[OTP Registers]] and writes the private key and Nintendo's signature of CTCert to [[Memory_layout#ARM9_ITCM|ARM9 ITCM]]; the public key is computed from the private key.
 
The curve used for ECDSA is sect233r1.