Certificates: Difference between revisions

3dsguy (talk | contribs)
Created page with "== Overview == Certificates contain cryptography information for verifying Signatures. These certificates are also signed. Each certificate follows the following format: {| cla..."
 
Luigoalma (talk | contribs)
Unknown parameter has use on CTCert Certificates
 
(12 intermediate revisions by one other user not shown)
Line 1: Line 1:
== Overview ==
== Overview ==
Certificates contain cryptography information for verifying Signatures. These certificates are also signed.
Certificates contain cryptography information for verifying Signatures. These certificates are also signed. The parent/child relationship between certificates, makes all the certificates effectively signed by 'Root', the public key for which is stored in NATIVE_FIRM.


Each certificate follows the following format:
== Format ==
 
{| class="wikitable"
|-
! Description
|-
| Signature Data
|-
| Certificate Info
|-
| Key Data
|}
 
== Signature Data ==


{| class="wikitable"
{| class="wikitable"
Line 28: Line 15:
|-
|-
| 0x4
| 0x4
| Depends on Signature Type
| X
| Signature
| Signature with Padding (aligning next data to 0x40 bytes)
|-
| 0x4 + X
| 0x40
| Issuer
|-
| 0x44 + X
| 0x4
| Key Type
|-
| 0x48 + X
| 0x40
| Name
|-
| 0x88 + X
| 0x4
| Expiration time as UNIX Timestamp, used at least for [[CTCert]]
|-
|-
| From end of Signature
| 0x8C + X
| 0x3C
| *
| Padding
| Public Key
|}
|}


=== Signature Type ===
== Signature ==
 
The signature method used to sign the certificate can be determined by checking the Signature Type:
{{Signature Types}}
 
The hash for the signature is calculated over the actual certificate data(from the start of the "Issuer", to the end of the "Public Key", aligned to 0x40 bytes).
 
== Public Key ==
 
Determining the type of public key stored, is done by checking the key type:
 
{| class="wikitable"
{| class="wikitable"
|-
|-
! Value
! Value
! Signature Method
! Key Type
|-
|-
| 0x00010000
| 0x0
| RSA-4098 SHA1
| RSA_4096
|-
|-
| 0x00010001
| 0x1
| RSA-2048 SHA1
| RSA_2048
|-
|-
| 0x00010003
| 0x2
| RSA-4098 SHA256
| Elliptic Curve
|-
| 0x00010004
| RSA-2048 SHA256
|}
|}
=== RSA ===
This contains the Public Key(i.e. Modulus & Public Exponent)


== Certificate Info ==
==== 4096 Bit ====
 
{| class="wikitable"
{| class="wikitable"
|-
|-
Line 64: Line 75:
|-
|-
| 0x0
| 0x0
| 0x40
| 0x200
| Issuer
| Modulus
|-
|-
| 0x40
| 0x200
| 0x4
| 0x4
| Tag?
| Public Exponent
|-
|-
| 0x44
| 0x204
| 0x40
| 0x34
| Name
| Padding
|-
| 0x84
| 0x4
| Unknown
|}
|}


== Key Data ==
==== 2048 Bit ====
 
=== RSA ===
This contains the Public Key(i.e. Modulus & Public Exponent). For RSA-2048 public keys, this section is as follows:
 
{| class="wikitable"
{| class="wikitable"
|-
|-
Line 101: Line 104:
| 0x104
| 0x104
| 0x34
| 0x34
| Padding
|}
=== ECC ===
This contains the ECC public key, and is as follows:
{| class="wikitable"
|-
! Offset
! Size
! Description
|-
| 0x0
| 0x3C
| Public Key
|-
| 0x3C
| 0x3C
| Padding
| Padding
|}
|}