wiithon.disc.structs.certificate module

class wiithon.disc.structs.certificate.Certificate[source]

Bases: object

A Nintendo trust chain certificate Signature and key sizes depend on the signature type (RSA-4096, RSA-2048, ECC)

References

https://wiibrew.org/wiki/Certificate_chain

signature_type

Signature algorithm type

signature

Signature data (variable size)

issuer

Certificate issuer (64 bytes, null-padded)

key_type

Public key type

child_identity

Child identity in the chain (64 bytes)

key_id

Key identifier

key

Public key (variable size by key_type)

public_exponent

RSA public exponent (RSA types only )

classmethod read(stream)[source]

Read a certificate from a binary stream

Data size varies by signature type and key type: - RSA-4096: signature=0x200, key=0x200 + 0x04 (exponent) + 0x34 (padding) - RSA-2048: signature=0x100, key=0x100 + 0x04 (exponent) + 0x34 (padding) - ECC: signature=0x40, key=0x3C + 0x60 (padding)

Parameters:

stream (BinaryIO) – Binary IO stream

Return type:

Certificate

Returns:

Parsed Certificate

write(stream)[source]

Write this certificate to a binary stream

Parameters:

stream (BinaryIO) – Binary IO stream

Return type:

None