Provides pure inspection and KEY1 transformations for the conventional 0x4000-0x7FFF cartridge interval. Operations return new buffers and never rewrite a source image, header checksum, or caller key table.
More...
|
| static NdsSecureAreaInspection | Inspect (NdsImage image, NdsKey1KeyTable? keyTable=null) |
| | Inspects a loaded image and verifies encrypted state or CRC only when enough explicit key material exists.
|
| static NdsSecureAreaInspection | Inspect (ReadOnlySpan< byte > area, string gameCode, ushort storedCrc, NdsKey1KeyTable? keyTable=null) |
| | Classifies one isolated interval using caller-supplied identity and stored checksum context.
|
| static byte[] | Encrypt (ReadOnlySpan< byte > area, string gameCode, NdsKey1KeyTable keyTable) |
| | Encrypts a decrypted interval for the supplied product identity and returns an independent copy.
|
| static byte[] | Decrypt (ReadOnlySpan< byte > area, string gameCode, NdsKey1KeyTable keyTable) |
| | Decrypts a key-verifiable interval and replaces its secure identifier with conventional destroyed markers.
|
| static ValueTask | EncryptAsync (Stream source, Stream destination, string gameCode, NdsKey1KeyTable keyTable, CancellationToken cancellationToken=default) |
| | Reads one interval at the source's current position, encrypts it, and writes exactly 16 KiB without closing either caller-owned stream. Buffering the fixed-size area prevents a partially transformed destination when the source is truncated or the identifier is invalid.
|
| static ValueTask | DecryptAsync (Stream source, Stream destination, string gameCode, NdsKey1KeyTable keyTable, CancellationToken cancellationToken=default) |
| | Reads one encrypted interval and emits a verified decrypted copy without closing caller-owned streams. No destination bytes are written unless both KEY1 initialization levels recover the secure identifier.
|
|
| const int | Offset = 0x4000 |
| | Absolute image offset at which the cartridge security interval begins.
|
| const int | ByteLength = 0x4000 |
| | CRC-covered interval length; KEY1 itself transforms only the first 0x800 bytes.
|
Provides pure inspection and KEY1 transformations for the conventional 0x4000-0x7FFF cartridge interval. Operations return new buffers and never rewrite a source image, header checksum, or caller key table.
Definition at line 10 of file NdsSecureArea.cs.
◆ Decrypt()
| byte[] NdsForge.NdsSecureArea.Decrypt |
( |
ReadOnlySpan< byte > | area, |
|
|
string | gameCode, |
|
|
NdsKey1KeyTable | keyTable ) |
|
inlinestatic |
Decrypts a key-verifiable interval and replaces its secure identifier with conventional destroyed markers.
- Parameters
-
| area | Exactly 16 KiB whose first 2 KiB use KEY1. |
| gameCode | Exactly four ASCII product-code bytes. |
| keyTable | Explicit seed schedule from an authorized source. |
- Returns
- Decrypted bytes; the last 14 KiB remain byte-identical to input.
Definition at line 110 of file NdsSecureArea.cs.
◆ DecryptAsync()
| ValueTask NdsForge.NdsSecureArea.DecryptAsync |
( |
Stream | source, |
|
|
Stream | destination, |
|
|
string | gameCode, |
|
|
NdsKey1KeyTable | keyTable, |
|
|
CancellationToken | cancellationToken = default ) |
|
inlinestatic |
Reads one encrypted interval and emits a verified decrypted copy without closing caller-owned streams. No destination bytes are written unless both KEY1 initialization levels recover the secure identifier.
- Parameters
-
| source | Readable stream positioned at encrypted secure-area byte zero. |
| destination | Writable stream receiving decrypted bytes at its current position. |
| gameCode | Exactly four ASCII product-code bytes. |
| keyTable | Explicit seed schedule from an authorized source. |
| cancellationToken | Cancels input and output I/O. |
- Returns
- A task-like value that completes after the verified 16 KiB result has been written.
Definition at line 145 of file NdsSecureArea.cs.
◆ Encrypt()
| byte[] NdsForge.NdsSecureArea.Encrypt |
( |
ReadOnlySpan< byte > | area, |
|
|
string | gameCode, |
|
|
NdsKey1KeyTable | keyTable ) |
|
inlinestatic |
Encrypts a decrypted interval for the supplied product identity and returns an independent copy.
- Parameters
-
| area | Exactly 16 KiB beginning with two destroyed-ID marker words. |
| gameCode | Exactly four ASCII product-code bytes. |
| keyTable | Explicit seed schedule from an authorized source. |
- Returns
- Encrypted bytes suitable for writing at image offset
0x4000.
Definition at line 99 of file NdsSecureArea.cs.
◆ EncryptAsync()
| ValueTask NdsForge.NdsSecureArea.EncryptAsync |
( |
Stream | source, |
|
|
Stream | destination, |
|
|
string | gameCode, |
|
|
NdsKey1KeyTable | keyTable, |
|
|
CancellationToken | cancellationToken = default ) |
|
inlinestatic |
Reads one interval at the source's current position, encrypts it, and writes exactly 16 KiB without closing either caller-owned stream. Buffering the fixed-size area prevents a partially transformed destination when the source is truncated or the identifier is invalid.
- Parameters
-
| source | Readable stream positioned at decrypted secure-area byte zero. |
| destination | Writable stream receiving encrypted bytes at its current position. |
| gameCode | Exactly four ASCII product-code bytes. |
| keyTable | Explicit seed schedule from an authorized source. |
| cancellationToken | Cancels input and output I/O. |
- Returns
- A task-like value that completes after the verified 16 KiB result has been written.
Definition at line 127 of file NdsSecureArea.cs.
◆ Inspect() [1/2]
Inspects a loaded image and verifies encrypted state or CRC only when enough explicit key material exists.
- Parameters
-
| image | Read-only image supplying header metadata and exactly bounded bytes. |
| keyTable | Optional KEY1 schedule used to recognize encrypted content and reconstruct decrypted CRC input. |
- Returns
- A state and checksum report; malformed data is represented without mutating or repairing it.
Definition at line 21 of file NdsSecureArea.cs.
◆ Inspect() [2/2]
Classifies one isolated interval using caller-supplied identity and stored checksum context.
- Parameters
-
| area | Exactly 16 KiB beginning at image offset 0x4000. |
| gameCode | Exactly four ASCII bytes used by KEY1 initialization. |
| storedCrc | Header checksum to compare with the encrypted representation. |
| keyTable | Optional schedule enabling cryptographic recognition. |
- Returns
- A state and nullable checksum conclusion.
Definition at line 47 of file NdsSecureArea.cs.
◆ ByteLength
| const int NdsForge.NdsSecureArea.ByteLength = 0x4000 |
|
static |
CRC-covered interval length; KEY1 itself transforms only the first 0x800 bytes.
Definition at line 15 of file NdsSecureArea.cs.
◆ Offset
| const int NdsForge.NdsSecureArea.Offset = 0x4000 |
|
static |
Absolute image offset at which the cartridge security interval begins.
Definition at line 13 of file NdsSecureArea.cs.
The documentation for this class was generated from the following file: