Captures the AES-128 normal key and both HMAC-derived initial counters needed to transform DSi modcrypt areas. Every byte array is copied so a reviewed context cannot change when its source buffers are reused or cleared.
More...
|
| | NdsModcryptContext (ReadOnlySpan< byte > key, ReadOnlySpan< byte > area1Counter, ReadOnlySpan< byte > area2Counter, NdsModcryptKeyMode keyMode=NdsModcryptKeyMode.SecureNormalKey) |
| | Copies already resolved key and counter material after enforcing the fixed AES block boundary.
|
| ReadOnlyMemory< byte > | ExportKey () |
| | Returns an independent copy of the resolved AES key so callers can persist or clear it on their own terms.
|
| ReadOnlyMemory< byte > | ExportCounter (NdsModcryptArea area) |
| | Returns an independent copy of the initial counter selected for one declared modcrypt area.
|
|
| static NdsModcryptContext | FromHeader (NdsHeader header) |
| | Resolves public header-key mode automatically and otherwise derives the normal key from the public modcrypt KeyX recipe and the stored ARM9i HMAC KeyY bytes. The result makes no authentication claim about that HMAC.
|
| static NdsModcryptContext | FromHeader (NdsHeader header, ReadOnlySpan< byte > secureNormalKey) |
| | Uses an explicitly resolved secure normal key instead of applying the built-in modcrypt KeyX/KeyY recipe. This is intended for independently verified vectors and future variants; insecure headers reject overrides.
|
|
| NdsModcryptKeyMode | KeyMode [get] |
| | Preserves whether the normal key was public header data or supplied by an external secure-key authority.
|
Captures the AES-128 normal key and both HMAC-derived initial counters needed to transform DSi modcrypt areas. Every byte array is copied so a reviewed context cannot change when its source buffers are reused or cleared.
Definition at line 7 of file NdsModcryptContext.cs.
◆ NdsModcryptContext()
Copies already resolved key and counter material after enforcing the fixed AES block boundary.
- Parameters
-
| key | Exactly sixteen bytes containing an AES-128 normal key, not a KeyX or KeyY component. |
| area1Counter | Exactly sixteen initial counter bytes for the first area. |
| area2Counter | Exactly sixteen initial counter bytes for the second area. |
| keyMode | Provenance label retained for diagnostics and policy decisions. |
Definition at line 21 of file NdsModcryptContext.cs.
◆ ExportCounter()
| ReadOnlyMemory< byte > NdsForge.NdsModcryptContext.ExportCounter |
( |
NdsModcryptArea | area | ) |
|
|
inline |
Returns an independent copy of the initial counter selected for one declared modcrypt area.
- Parameters
-
| area | Header area whose HMAC-derived counter is required. |
- Returns
- Sixteen counter bytes safe for caller mutation.
Definition at line 51 of file NdsModcryptContext.cs.
◆ ExportKey()
| ReadOnlyMemory< byte > NdsForge.NdsModcryptContext.ExportKey |
( |
| ) |
|
|
inline |
Returns an independent copy of the resolved AES key so callers can persist or clear it on their own terms.
- Returns
- Sixteen normal-key bytes backed by a new array that does not expose the context's retained key.
Definition at line 46 of file NdsModcryptContext.cs.
◆ FromHeader() [1/2]
Resolves public header-key mode automatically and otherwise derives the normal key from the public modcrypt KeyX recipe and the stored ARM9i HMAC KeyY bytes. The result makes no authentication claim about that HMAC.
- Parameters
-
| header | Parsed DSi-family header containing flags, title bytes, and HMAC counters. |
- Returns
- A detached context that remains valid after the image is disposed.
Definition at line 59 of file NdsModcryptContext.cs.
◆ FromHeader() [2/2]
Uses an explicitly resolved secure normal key instead of applying the built-in modcrypt KeyX/KeyY recipe. This is intended for independently verified vectors and future variants; insecure headers reject overrides.
- Parameters
-
| header | Parsed DSi-family header supplying both area counters. |
| secureNormalKey | Exactly sixteen already scrambled normal-key bytes. |
- Returns
- A detached context retaining a copy of every cryptographic input.
Definition at line 87 of file NdsModcryptContext.cs.
◆ KeyMode
Preserves whether the normal key was public header data or supplied by an external secure-key authority.
Definition at line 42 of file NdsModcryptContext.cs.
The documentation for this class was generated from the following file: