2022-11-18 21:03:11 +00:00
|
|
|
/***
|
|
|
|
Copyright (C) 2022 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
|
|
|
|
File: GenerateCertificate.hpp
|
|
|
|
Date: 2022-11-18
|
|
|
|
Author: Reece
|
|
|
|
***/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
namespace Aurora::IO::TLS
|
|
|
|
{
|
|
|
|
struct ITLSPrivateKeyPair;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Aurora::Crypto::X509
|
|
|
|
{
|
|
|
|
struct CertRequest
|
|
|
|
{
|
|
|
|
// subject --
|
|
|
|
CertName name;
|
|
|
|
|
|
|
|
// metadata --
|
|
|
|
Hashing::EHashType digest;
|
|
|
|
AuUInt8 uVersion { 3 };
|
2023-07-10 19:56:45 +00:00
|
|
|
bool bIsCA { };
|
|
|
|
AuInt8 iMaxPathLength { -1 };
|
|
|
|
bool bSubjectKeyId { };
|
2022-11-18 21:03:11 +00:00
|
|
|
AuList<EExtendedUsage> usage;
|
|
|
|
AuUInt8 uSerialRadix { 10 };
|
|
|
|
AuString sSerial { "69420" };
|
|
|
|
|
|
|
|
// validity --
|
|
|
|
AuSInt iIssuedDateMs {};
|
|
|
|
AuSInt iExpirationDateMs {};
|
|
|
|
|
|
|
|
// public key ---
|
|
|
|
AuSPtr<RSA::IRSAPublic> pRSAKey;
|
|
|
|
AuSPtr<ECC::IECCPublic> pECCKey;
|
|
|
|
|
|
|
|
// private key ---
|
|
|
|
AuSPtr<RSA::IRSAPrivate> pSelfSigningRSAKey;
|
|
|
|
AuSPtr<ECC::IECCPrivate> pSelfSigningECCKey;
|
|
|
|
|
|
|
|
// or
|
|
|
|
|
|
|
|
AuSPtr<Aurora::IO::TLS::ITLSPrivateKeyPair> pSigningChain;
|
|
|
|
};
|
|
|
|
|
|
|
|
AUKN_SYM AuResult<Memory::ByteBuffer> GenerateCertificate(const CertRequest &request);
|
|
|
|
}
|