AuroraRuntime/Source/Crypto/CA/AuPinPair.cpp
J Reece Wilson 7a0593adeb [+] AuCrypto::CA::ICertificateStore
[+] AuCrypto::CA::INewCertificateStore
[+] AuCrypto::CA::IPinCertificate
[+] AuCrypto::CA::PinAlwaysFail
[+] AuCrypto::CA::PinAlwaysPass
[+] AuCrypto::CA::PinCheckOS
[+] AuCrypto::CA::PinCheckDefault
[+] AuCrypto::CA::PinCheckBuiltin
[+] AuCrypto::CA::PinCheckGlobal
[+] AuCrypto::CA::PinCheckTwoAnd
[+] AuCrypto::CA::PinCheckTwoOr
[+] AuCrypto::CA::SetGlobalTLSPinner
[*] Minor AuCrypto::X509 decoder work
[*] AuCrypto::X509: transition to memory views (x509 is bytebuffer era and earlier code, beri early)
[+] AuCrypto::IPrivateKeyProvider
[+] AuCrypto::IPrivateKeyPair
[+] AuCrypto::PrivateKeyPair
[+] AuCrypto::ImportPrivateKeyPair
[*] Refactor: AuCrypto::X509::GenerateCertificate(...)
[+] AuCrypto::X509::NewChainFromOneDer
[+] AuCrypto::X509::NewChainFromManyDer
[+] AuCrypto::X509::NewChainFromManyDerInStream
[+] AuCrypto::X509::NewChainFromOnePem
[+] AuCrypto::X509::NewChainFromManyPem
[+] AuCrypto::X509::NewChainFromManyPemInStream
[*] Fix TLS code that was abandoned since its introduction with the net code. mbedtls is a hairbrained mess. so many *blocking* github issues starting after 2017. so little progress.
[+] AuIO::TLS::TLSMeta::pKeyPairProvider
[+] AuIO::TLS::TLSServer::bAllowSNIToFallBackDefault
[+] AuIO::TLS::TLSServer::bAllowSNILessUseDefaultCert
2024-10-16 02:07:24 +01:00

68 lines
2.1 KiB
C++
Executable File

/***
Copyright (C) 2024 Jamie Reece Wilson (a/k/a "Reece"). All rights reserved.
File: AuPinPair.cpp
Date: 2024-10-14
Author: Reece
***/
#include <Source/RuntimeInternal.hpp>
#include "AuPinPair.hpp"
namespace Aurora::Crypto::CA
{
OpAndPinner::OpAndPinner(const AuSPtr<IPinCertificate> &pA,
const AuSPtr<IPinCertificate> &pB) :
pA(pA),
pB(pB)
{
}
bool OpAndPinner::CheckCertificate(const AuSPtr<X509::ICertificateChain> &pChain,
const AuMemoryViewRead &derCertificate)
{
return this->pA->CheckCertificate(pChain, derCertificate) &&
this->pB->CheckCertificate(pChain, derCertificate);
}
OpOrPinner::OpOrPinner(const AuSPtr<IPinCertificate> &pA,
const AuSPtr<IPinCertificate> &pB) :
pA(pA),
pB(pB)
{
}
bool OpOrPinner::CheckCertificate(const AuSPtr<X509::ICertificateChain> &pChain,
const AuMemoryViewRead &derCertificate)
{
return this->pA->CheckCertificate(pChain, derCertificate) ||
this->pB->CheckCertificate(pChain, derCertificate);
}
AUKN_SYM IPinCertificate *PinCheckTwoAndNew(const AuSPtr<IPinCertificate> &pCheckA,
const AuSPtr<IPinCertificate> &pCheckB)
{
SysCheckArgNotNull(pCheckA, {});
SysCheckArgNotNull(pCheckB, {});
return _new OpOrPinner(pCheckA, pCheckB);
}
AUKN_SYM void PinCheckTwoAndRelease(IPinCertificate *pHandle)
{
AuSafeDelete<OpAndPinner *>(pHandle);
}
AUKN_SYM IPinCertificate *PinCheckTwoOrNew(const AuSPtr<IPinCertificate> &pCheckA,
const AuSPtr<IPinCertificate> &pCheckB)
{
SysCheckArgNotNull(pCheckA, {});
SysCheckArgNotNull(pCheckB, {});
return _new OpOrPinner(pCheckA, pCheckB);
}
AUKN_SYM void PinCheckTwoOrRelease(IPinCertificate *pHandle)
{
AuSafeDelete<OpOrPinner *>(pHandle);
}
}