2018-06-06 12:38:42 +00:00
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include <fnd/types.h>
|
2018-08-07 08:35:03 +00:00
|
|
|
#include <fnd/aes.h>
|
|
|
|
#include <fnd/rsa.h>
|
|
|
|
#include <fnd/ecdsa.h>
|
2018-06-06 12:38:42 +00:00
|
|
|
|
2018-08-07 07:17:51 +00:00
|
|
|
namespace nn
|
|
|
|
{
|
2018-08-06 08:59:56 +00:00
|
|
|
namespace pki
|
2018-06-06 12:38:42 +00:00
|
|
|
{
|
|
|
|
namespace cert
|
|
|
|
{
|
|
|
|
enum PublicKeyType
|
|
|
|
{
|
|
|
|
RSA4096,
|
|
|
|
RSA2048,
|
|
|
|
ECDSA240
|
|
|
|
};
|
|
|
|
|
|
|
|
static const size_t kIssuerSize = 0x40;
|
|
|
|
static const size_t kSubjectSize = 0x40;
|
|
|
|
}
|
|
|
|
#pragma pack(push,1)
|
2018-06-22 13:57:55 +00:00
|
|
|
struct sCertificateHeader
|
2018-06-06 12:38:42 +00:00
|
|
|
{
|
|
|
|
char issuer[cert::kIssuerSize];
|
|
|
|
be_uint32_t key_type;
|
|
|
|
char subject[cert::kSubjectSize];
|
|
|
|
be_uint32_t cert_id;
|
2018-06-22 13:57:55 +00:00
|
|
|
};
|
2018-06-06 12:38:42 +00:00
|
|
|
|
|
|
|
struct sRsa4096PublicKeyBlock
|
|
|
|
{
|
2018-08-07 08:35:03 +00:00
|
|
|
byte_t modulus[fnd::rsa::kRsa4096Size];
|
|
|
|
byte_t public_exponent[fnd::rsa::kRsaPublicExponentSize];
|
2018-06-06 12:38:42 +00:00
|
|
|
byte_t padding[0x34];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sRsa2048PublicKeyBlock
|
|
|
|
{
|
2018-08-07 08:35:03 +00:00
|
|
|
byte_t modulus[fnd::rsa::kRsa2048Size];
|
|
|
|
byte_t public_exponent[fnd::rsa::kRsaPublicExponentSize];
|
2018-06-06 12:38:42 +00:00
|
|
|
byte_t padding[0x34];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct sEcdsa240PublicKeyBlock
|
|
|
|
{
|
2018-08-07 08:35:03 +00:00
|
|
|
fnd::ecdsa::sEcdsa240Point public_key;
|
2018-06-06 12:38:42 +00:00
|
|
|
byte_t padding[0x3C];
|
|
|
|
};
|
|
|
|
#pragma pack(pop)
|
2018-08-07 07:17:51 +00:00
|
|
|
}
|
2018-06-06 12:38:42 +00:00
|
|
|
}
|