NdsForge.NET 1.0.1
Read, validate, edit, compare, and build Nintendo DS and DSi images from .NET
Loading...
Searching...
No Matches
NdsForge.NdsDsiKeyScrambler Class Reference

Implements the DSi 128-bit KeyX/KeyY scrambler in cartridge-register byte order. It contains only the public arithmetic and modcrypt slot prefix; callers remain responsible for the provenance of arbitrary key components. More...

Static Public Member Functions

static byte[] DeriveNormalKey (ReadOnlySpan< byte > keyX, ReadOnlySpan< byte > keyY)
 Derives the normal AES key produced by DSi hardware from one KeyX/KeyY pair. Input and output arrays use the little-endian register order found in cartridge headers and hardware-facing documentation.
static byte[] CreateModcryptKeyX (string gameCode)
 Constructs the modcrypt slot's public KeyX from its fixed eight-byte platform prefix followed by the game code in forward and reverse order. No case folding is performed because product codes are binary identity.
static byte[] DeriveModcryptNormalKey (NdsHeader header)
 Derives the secure modcrypt normal key from the common game code and the first sixteen ARM9i HMAC bytes. The HMAC is consumed as stored; this operation does not establish that it was authenticated by a trusted key.

Detailed Description

Implements the DSi 128-bit KeyX/KeyY scrambler in cartridge-register byte order. It contains only the public arithmetic and modcrypt slot prefix; callers remain responsible for the provenance of arbitrary key components.

Definition at line 9 of file NdsDsiKeyScrambler.cs.

Member Function Documentation

◆ CreateModcryptKeyX()

byte[] NdsForge.NdsDsiKeyScrambler.CreateModcryptKeyX ( string gameCode)
inlinestatic

Constructs the modcrypt slot's public KeyX from its fixed eight-byte platform prefix followed by the game code in forward and reverse order. No case folding is performed because product codes are binary identity.

Parameters
gameCodeExactly four printable ASCII characters from common header offset 0x0C.
Returns
A new sixteen-byte KeyX in DSi register order.

Definition at line 44 of file NdsDsiKeyScrambler.cs.

◆ DeriveModcryptNormalKey()

byte[] NdsForge.NdsDsiKeyScrambler.DeriveModcryptNormalKey ( NdsHeader header)
inlinestatic

Derives the secure modcrypt normal key from the common game code and the first sixteen ARM9i HMAC bytes. The HMAC is consumed as stored; this operation does not establish that it was authenticated by a trusted key.

Parameters
headerParsed DSi-family header supplying both public KeyX identity and KeyY bytes.
Returns
A new sixteen-byte normal key suitable for NdsModcryptContext.

Definition at line 69 of file NdsDsiKeyScrambler.cs.

◆ DeriveNormalKey()

byte[] NdsForge.NdsDsiKeyScrambler.DeriveNormalKey ( ReadOnlySpan< byte > keyX,
ReadOnlySpan< byte > keyY )
inlinestatic

Derives the normal AES key produced by DSi hardware from one KeyX/KeyY pair. Input and output arrays use the little-endian register order found in cartridge headers and hardware-facing documentation.

Parameters
keyXExactly sixteen bytes of slot-specific KeyX material.
keyYExactly sixteen bytes of title- or content-specific KeyY material.
Returns
A new sixteen-byte normal key; neither component is retained or modified.

Definition at line 22 of file NdsDsiKeyScrambler.cs.


The documentation for this class was generated from the following file: