AuroraRuntime/Include/Aurora/Crypto/X509/X509.hpp

78 lines
1.6 KiB
C++
Raw Normal View History

2021-06-27 21:25:29 +00:00
/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: X509.hpp
Date: 2021-6-11
Author: Reece
***/
#pragma once
#include "EExtendedUsage.hpp"
2021-06-27 21:25:29 +00:00
namespace Aurora::Crypto::X509
{
struct CertName
{
AU_COPY_MOVE_DEF(CertName);
AuString commonName;
2021-06-27 21:25:29 +00:00
AuString department;
AuString organization;
AuString address;
AuString locality;
AuString state;
AuString countryCode;
AuString postcode;
2021-06-27 21:25:29 +00:00
AuString name;
AuString email;
AuString title;
2021-06-27 21:25:29 +00:00
};
struct DecodedCertificate
{
AU_COPY_MOVE_DEF(DecodedCertificate);
int version {};
2021-06-27 21:25:29 +00:00
struct Issuer : CertName
{
AU_COPY_MOVE_DEF(Issuer);
Memory::ByteBuffer id;
2021-06-27 21:25:29 +00:00
} issuer;
2021-06-27 21:25:29 +00:00
struct Subject : CertName
{
AU_COPY_MOVE_DEF(Subject);
Memory::ByteBuffer id;
2021-06-27 21:25:29 +00:00
} subject;
struct Vaildity
{
AU_COPY_MOVE_DEF(Vaildity);
AuUInt issued;
AuUInt expire;
} validity;
AuList<AuUInt8> serialNumber;
AuList<AuUInt8> algorithmOid;
2021-06-27 21:25:29 +00:00
AuList<AuString> AIAs;
// TODO: AuString CRL;
2021-06-27 21:25:29 +00:00
// TODO: AuList<String> subjectNames;
Hashing::EHashType digest;
AuList<EExtendedUsage> usage;
int iMaxPath {};
bool bIsCA {};
// TODO: ...
2021-06-27 21:25:29 +00:00
};
AUKN_SYM bool Decode(const Certificate &der, DecodedCertificate &out);
AUKN_SYM bool Validate(const Certificate &der, const Certificate &parentDer);
}
#include "GenerateCertificate.hpp"