2025-09-26 11:57:18 -04:00
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
2025-09-26 13:06:18 -04:00
|
|
|
namespace SabreTools.Data.Models.N3DS
|
2025-09-26 11:57:18 -04:00
|
|
|
{
|
|
|
|
|
/// <see href="https://www.3dbrew.org/wiki/NCSD#InitialData"/>
|
|
|
|
|
[StructLayout(LayoutKind.Sequential)]
|
|
|
|
|
public sealed class InitialData
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Card seed keyY (first u64 is Media ID (same as first NCCH partitionId))
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>0x10 bytes</remarks>
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x10)]
|
2025-10-30 20:44:16 -04:00
|
|
|
public byte[] CardSeedKeyY = new byte[0x10];
|
2025-09-26 11:57:18 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Encrypted card seed (AES-CCM, keyslot 0x3B for retail cards, see CTRCARD_SECSEED)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>0x10 bytes</remarks>
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x10)]
|
2025-10-30 20:44:16 -04:00
|
|
|
public byte[] EncryptedCardSeed = new byte[0x10];
|
2025-09-26 11:57:18 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Card seed AES-MAC
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>0x10 bytes</remarks>
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x10)]
|
2025-10-30 20:44:16 -04:00
|
|
|
public byte[] CardSeedAESMAC = new byte[0x10];
|
2025-09-26 11:57:18 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Card seed nonce
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>0x0C bytes</remarks>
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0x0C)]
|
2025-10-30 20:44:16 -04:00
|
|
|
public byte[] CardSeedNonce = new byte[0x0C];
|
2025-09-26 11:57:18 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Reserved3
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>0xC4 bytes</remarks>
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 0xC4)]
|
2025-10-30 20:44:16 -04:00
|
|
|
public byte[] Reserved = new byte[0xC4];
|
2025-09-26 11:57:18 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Copy of first NCCH header (excluding RSA signature)
|
|
|
|
|
/// </summary>
|
2025-10-31 13:59:28 -04:00
|
|
|
public NCCHHeader BackupHeader = new();
|
2025-09-26 11:57:18 -04:00
|
|
|
}
|
|
|
|
|
}
|