nstool/lib/libes/include/es/sign.h

62 lines
1.1 KiB
C
Raw Normal View History

2018-06-06 12:38:42 +00:00
#pragma once
#include <string>
#include <fnd/types.h>
#include <crypto/aes.h>
#include <crypto/rsa.h>
2018-06-22 13:30:50 +00:00
#include <crypto/ecdsa.h>
2018-06-06 12:38:42 +00:00
namespace es
{
namespace sign
{
2018-07-29 19:18:02 +00:00
enum SignatureId
2018-06-06 12:38:42 +00:00
{
2018-07-29 19:18:02 +00:00
SIGN_ID_RSA4096_SHA1 = 0x10000,
SIGN_ID_RSA2048_SHA1,
SIGN_ID_ECDSA240_SHA1,
SIGN_ID_RSA4096_SHA256,
SIGN_ID_RSA2048_SHA256,
SIGN_ID_ECDSA240_SHA256,
};
enum SignatureAlgo
{
SIGN_ALGO_RSA4096,
SIGN_ALGO_RSA2048,
SIGN_ALGO_ECDSA240
};
enum HashAlgo
{
HASH_ALGO_SHA1,
HASH_ALGO_SHA256
2018-06-06 12:38:42 +00:00
};
2018-06-22 13:30:50 +00:00
static const size_t kEcdsaSigSize = 0x3C;
2018-07-04 04:21:36 +00:00
static const std::string kRootIssuerStr = "Root";
static const std::string kIdentDelimiter = "-";
2018-06-06 12:38:42 +00:00
}
#pragma pack(push,1)
struct sRsa4096SignBlock
{
be_uint32_t sign_type;
byte_t signature[crypto::rsa::kRsa4096Size];
byte_t padding[0x3C];
};
struct sRsa2048SignBlock
{
be_uint32_t sign_type;
byte_t signature[crypto::rsa::kRsa2048Size];
byte_t padding[0x3C];
};
struct sEcdsa240SignBlock
{
be_uint32_t sign_type;
2018-06-22 13:30:50 +00:00
byte_t signature[sign::kEcdsaSigSize];
2018-06-06 12:38:42 +00:00
byte_t padding[0x40];
};
#pragma pack(pop)
}