StormByte-Crypto 3.1.0
C++26 cryptography module of the StormByte suite
Loading...
Searching...
No Matches
certificate.hxx File Reference
#include <StormByte/crypto/keypair/generic.hxx>
#include <StormByte/crypto/visibility.h>
#include <StormByte/expected.hxx>
#include <StormByte/safe/binary.hxx>
#include <StormByte/safe/optional.hxx>
#include <StormByte/safe/string.hxx>
#include <StormByte/safe/vector.hxx>
#include <chrono>
#include <cstddef>
#include <cstdint>
#include <span>
#include <string_view>
Include dependency graph for certificate.hxx:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  StormByte::Crypto::X509::SubjectAltName
 One supported subjectAltName entry (a DNS name or an IP address). More...
class  StormByte::Crypto::X509::Certificate
 Immutable, strictly DER-parsed X.509 certificate. More...

Namespaces

namespace  StormByte
 Root namespace of the StormByte suite.
namespace  StormByte::Crypto
 Crypto module of the StormByte suite.
namespace  StormByte::Crypto::X509
 X.509 certificate parsing and chain verification.

Typedefs

using StormByte::Crypto::X509::TimePoint = std::chrono::sys_seconds
 Point in time with second precision, as stored in certificates.
using StormByte::Crypto::X509::ExpectedPurpose = StormByte::Expected<void, PurposeError>
 Success when certificate usage permits a purpose, or a typed error.
using StormByte::Crypto::X509::ExpectedSubjectAltNames = StormByte::Expected<Safe::Vector<SubjectAltName>, IdentityError>
 Supported subjectAltName entries, or a typed extraction error.
using StormByte::Crypto::X509::ExpectedIdentity = StormByte::Expected<void, IdentityError>
 Success when the expected identity is present, or a typed error.

Enumerations

enum class  StormByte::Crypto::X509::KeyUsage : std::uint16_t {
  StormByte::Crypto::X509::DigitalSignature = 1u << 0 , StormByte::Crypto::X509::NonRepudiation = 1u << 1 , StormByte::Crypto::X509::KeyEncipherment = 1u << 2 , StormByte::Crypto::X509::DataEncipherment = 1u << 3 ,
  StormByte::Crypto::X509::KeyAgreement = 1u << 4 , StormByte::Crypto::X509::KeyCertSign = 1u << 5 , StormByte::Crypto::X509::CRLSign = 1u << 6 , StormByte::Crypto::X509::EncipherOnly = 1u << 7 ,
  StormByte::Crypto::X509::DecipherOnly = 1u << 8
}
 Bits of the keyUsage extension (RFC 5280 §4.2.1.3). More...
enum class  StormByte::Crypto::X509::SubjectAltNameType { StormByte::Crypto::X509::DNS , StormByte::Crypto::X509::IP }
 Supported subjectAltName general name kinds (RFC 5280 §4.2.1.6). More...
enum class  StormByte::Crypto::X509::IdentityError {
  StormByte::Crypto::X509::InvalidExpectedName , StormByte::Crypto::X509::InvalidExpectedAddress , StormByte::Crypto::X509::MissingSubjectAltName , StormByte::Crypto::X509::MalformedSubjectAltName ,
  StormByte::Crypto::X509::NoMatch
}
 Errors of subjectAltName extraction and expected-identity verification. More...
enum class  StormByte::Crypto::X509::TLSRole { StormByte::Crypto::X509::Server , StormByte::Crypto::X509::Client }
 Certificate signing role in TLS 1.3 (RFC 8446 §4.4.2.2). More...
enum class  StormByte::Crypto::X509::DetachedSignatureAlgorithm { StormByte::Crypto::X509::ECDSA_SHA384 }
 Supported algorithms and encodings for detached signatures. More...
enum class  StormByte::Crypto::X509::PurposeError {
  StormByte::Crypto::X509::UnsupportedRole , StormByte::Crypto::X509::InvalidCertificate , StormByte::Crypto::X509::MalformedExtendedKeyUsage , StormByte::Crypto::X509::ExtendedKeyUsageNotAllowed ,
  StormByte::Crypto::X509::MalformedKeyUsage , StormByte::Crypto::X509::KeyUsageNotAllowed
}
 Errors of narrowly scoped certificate-purpose checks. More...

Functions

Safe::Optional< Certificate > StormByte::Crypto::X509::Load (std::span< const std::byte > data) noexcept
 Loads one certificate from DER or PEM.
Safe::Vector< Certificate > StormByte::Crypto::X509::LoadAll (std::span< const std::byte > data) noexcept
 Loads every CERTIFICATE block of a PEM bundle, in order.