Documentation ¶
Overview ¶
Package ctrsigcheck allows to parse and verify various file formats used by the Nintendo 3DS, also known as CTR.
The main goal is to check both integrity and authenticity of those files before installing them. The integrity is established by verifying the file structure and embedded SHA-256 hashes. While not mandatory, the authenticity can also be established thanks to Nintendo signatures. Those digital signatures can be verified using public Nintendo certificates, but cannot be generated without private keys that are only known by Nintendo.
This package comes with a CLI. You can install it like this:
go get github.com/connesc/ctrsigcheck/cmd/ctrsigcheck
Index ¶
- Variables
- func DecodeIconImage(src []byte, width int) (image.Image, error)
- type CIA
- type CIAContent
- type CIAContentNCCH
- type CIATMD
- type CIATicket
- type Certificate
- type CertificateSet
- type ExeFS
- type Hex
- type Hex16
- type Hex32
- type Hex64
- type Hex8
- type NCCH
- type SMDH
- type SMDHGraphics
- type SMDHTitle
- type TMD
- type TMDContent
- type Ticket
- type TitleKey
Constants ¶
This section is empty.
Variables ¶
var Certs struct { Retail CertificateSet Debug CertificateSet }
Certs contains the retail and debug certificates from Nintendo.
Functions ¶
Types ¶
type CIA ¶
type CIA struct { Legit bool Complete bool TitleID Hex64 Ticket CIATicket TMD CIATMD Contents []CIAContent Icon *SMDH Meta bool }
CIA describes a CIA file.
func CheckCIA ¶
CheckCIA reads the given CIA file and verifies its content.
Many integrity checks are performed, including but not limited to SHA-256 hashes. If any problem is detected, an error is immediately returned. Otherwise, a summary of the CIA file is returned.
Nintendo signatures are not required to be valid. Their status are made available to the caller through the Legit booleans.
A CIA file is considered "legit" if both its ticket and its TMD are "legit". Since the TMD contains the hashes of content segments, a "legit" TMD also guarantees a "legit" content. A "legit" ticket means that content is legitimately owned, either personnally (e.g. game or update downloaded from eShop) or not (e.g. preinstalled game or system title).
type CIAContent ¶
type CIAContent struct { Missing bool TMDContent NCCH *CIAContentNCCH }
CIAContent describes a content section embedded in a CIA file.
type CIAContentNCCH ¶ added in v0.2.0
type CIAContentNCCH struct {
Encrypted bool
}
CIAContentNCCH describes the NCCH structure of a content section embedded in a CIA file.
type Certificate ¶
Certificate used to verify digital signatures.
type CertificateSet ¶
type CertificateSet struct {
CA, Ticket, TMD Certificate
}
CertificateSet used to verify digital signatures of tickets and TMDs.
type Hex ¶
type Hex []byte
Hex wraps a []byte so that it encodes to hexadecimal.
func (Hex) MarshalText ¶
MarshalText implements encoding.TextMarshaler, also used for JSON encoding.
type Hex16 ¶
type Hex16 uint16
Hex16 wraps an uint16 so that it encodes to hexadecimal.
func (Hex16) MarshalText ¶
MarshalText implements encoding.TextMarshaler, also used for JSON encoding.
type Hex32 ¶
type Hex32 uint32
Hex32 wraps an uint32 so that it encodes to hexadecimal.
func (Hex32) MarshalText ¶
MarshalText implements encoding.TextMarshaler, also used for JSON encoding.
type Hex64 ¶
type Hex64 uint64
Hex64 wraps an uint64 so that it encodes to hexadecimal.
func (Hex64) MarshalText ¶
MarshalText implements encoding.TextMarshaler, also used for JSON encoding.
type Hex8 ¶
type Hex8 uint8
Hex8 wraps an uint8 so that it encodes to hexadecimal.
func (Hex8) MarshalText ¶
MarshalText implements encoding.TextMarshaler, also used for JSON encoding.
type SMDH ¶
type SMDH struct { Title SMDHTitle Regions []string Graphics SMDHGraphics }
SMDH describes the result of SMDH parsing.
type SMDHGraphics ¶
SMDHGraphics contains the PNG-encoded icons embedded in a SMDH file.
type TMD ¶
type TMD struct { Legit bool Original bool TitleID Hex64 TitleVersion uint16 Contents []TMDContent CertsTrailer bool }
TMD describes a TMD structure.
func CheckTMD ¶
CheckTMD reads the given TMD file and verifies its content.
It may be followed by a certificate chain. This notably happens for files downloaded from Nintendo's CDN. If a certificate chain is found, it is checked against expected content.
A TMD is considered "legit" if its digital signature is properly verified. Unlike other checks, signature checks don't produce errors, but instead expose a Legit boolean to the caller.
type TMDContent ¶
type TMDContent struct { ID Hex32 Index Hex16 Type Hex16 Size uint64 Hash Hex Encrypted bool Optional bool }
TMDContent describes a content record in a TMD.
type Ticket ¶
type Ticket struct { Legit bool TicketID Hex64 ConsoleID Hex32 TitleID Hex64 TitleKey TitleKey CertsTrailer bool }
Ticket describes the content of a ticket file.
func CheckTicket ¶
CheckTicket reads the given ticket file and verifies its content.
It may be followed by a certificate chain. This notably happens for files downloaded from Nintendo's CDN. If a certificate chain is found, it is checked against expected content.
A ticket is considered "legit" if its digital signature is properly verified. Unlike other checks, signature checks don't produce errors, but instead expose a Legit boolean to the caller.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
Package ctrutil contains various utilities used by ctrsigcheck.
|
Package ctrutil contains various utilities used by ctrsigcheck. |
internal
|
|