Table of Contents

Class NitroKey1Encryption

Namespace
SceneGate.Ekona.Security
Assembly
SceneGate.Ekona.dll

Encrypt and decrypt specific DS content with the KEY1 algorithm (blowfish).

public class NitroKey1Encryption
Inheritance
NitroKey1Encryption
Inherited Members

Constructors

NitroKey1Encryption(string, DsiKeyStore)

Initializes a new instance of the NitroKey1Encryption class.

public NitroKey1Encryption(string gameCode, DsiKeyStore keyStore)

Parameters

gameCode string

The DS game code.

keyStore DsiKeyStore

The store with the DS keys.

Exceptions

ArgumentNullException

The arguments are null or .

ArgumentException

The game code does not have length 4.

Methods

DecryptArm9(Stream)

Decrypt the secure area of the ARM9 program.

public DataStream DecryptArm9(Stream arm9)

Parameters

arm9 Stream

The ARM9 program to decrypt its secure area.

Returns

DataStream

A copy of the ARM9 program with the secure area decrypted.

Exceptions

ArgumentException

The program is smaller than expected (2 KB).

EncryptArm9(Stream)

Encrypt the secure area of the ARM9 program.

public DataStream EncryptArm9(Stream arm9)

Parameters

arm9 Stream

The ARM9 program to encrypt its secure area.

Returns

DataStream

A copy of the ARM9 program with the secure area encrypted.

Exceptions

ArgumentException

The program is smaller than expected (2 KB).

GenerateEncryptedDisabledSecureAreaToken()

Generate an encrypted token for the DS header to indicate that the secure are should be disabled.

public byte[] GenerateEncryptedDisabledSecureAreaToken()

Returns

byte[]

The encrypted token.

GenerateEncryptedSecureAreaId()

Generate an encrypted secure area ID.

public byte[] GenerateEncryptedSecureAreaId()

Returns

byte[]

The encrypted secure area ID.

HasDisabledSecureArea(byte[])

Decrypt the DS header token and verify if its content that indicates the secure are is disabled.

public bool HasDisabledSecureArea(byte[] token)

Parameters

token byte[]

The encrypted token from the DS header.

Returns

bool

A value indicating whether the secure area is disabled.

Exceptions

ArgumentException

The token does not have the expected length 8.

HasEncryptedArm9(Stream)

Check if the ARM9 stream has an encrypted secure area.

public bool HasEncryptedArm9(Stream arm9)

Parameters

arm9 Stream

The ARM9 program to verify.

Returns

bool

A value indicating whether the stream has an encrypted secure area.

Exceptions

ArgumentException

The ARM9 is smaller than expected (2 KB).

HasValidSecureAreaId(byte[])

Decrypt the secure area ID and verify if its content match the expected result.

public bool HasValidSecureAreaId(byte[] data)

Parameters

data byte[]

The encrypted secure area ID.

Returns

bool

A value indicating whether the encrypted secure area ID is valid.

Exceptions

ArgumentException

The argument does not have the expected length 8.