Files
Matt Nadareski 7689c6dd07 Libraries
This change looks dramatic, but it's just separating out the already-split namespaces into separate top-level folders. In theory, every single one could be built into their own Nuget package. `SabreTools.Serialization` still builds the normal Nuget package that is used by all other projects and includes all namespaces.
2026-03-21 16:26:56 -04:00

93 lines
2.4 KiB
C#

namespace SabreTools.Data.Models.N3DS
{
/// <summary>
/// Certificates contain cryptography information for verifying Signatures.
/// These certificates are also signed. The parent/child relationship between
/// certificates, makes all the certificates effectively signed by 'Root',
/// the public key for which is stored in NATIVE_FIRM.
/// </summary>
/// <see href="https://www.3dbrew.org/wiki/Certificates"/>
public sealed class Certificate
{
/// <summary>
/// Signature Type
/// </summary>
public SignatureType SignatureType { get; set; }
/// <summary>
/// Signature size
/// </summary>
public ushort SignatureSize { get; set; }
/// <summary>
/// Padding size
/// </summary>
public byte PaddingSize { get; set; }
/// <summary>
/// Signature
/// </summary>
public byte[] Signature { get; set; } = [];
/// <summary>
/// Padding to align next data to 0x40 bytes
/// </summary>
public byte[] Padding { get; set; } = [];
/// <summary>
/// Issuer
/// </summary>
public string Issuer { get; set; } = string.Empty;
/// <summary>
/// Key Type
/// </summary>
public PublicKeyType KeyType { get; set; }
/// <summary>
/// Name
/// </summary>
public string Name { get; set; } = string.Empty;
/// <summary>
/// Expiration time as UNIX Timestamp, used at least for CTCert
/// </summary>
public uint ExpirationTime { get; set; }
// This contains the Public Key (i.e. Modulus & Public Exponent)
#region RSA-4096 and RSA-2048
/// <summary>
/// Modulus
/// </summary>
public byte[]? RSAModulus { get; set; }
/// <summary>
/// Public Exponent
/// </summary>
public uint RSAPublicExponent { get; set; }
/// <summary>
/// Padding
/// </summary>
public byte[]? RSAPadding { get; set; }
#endregion
// This contains the ECC public key, and is as follows:
#region ECC
/// <summary>
/// Public Key
/// </summary>
public byte[]? ECCPublicKey { get; set; }
/// <summary>
/// Padding
/// </summary>
public byte[]? ECCPadding { get; set; }
#endregion
}
}