20#include <kcenon/common/patterns/result.h>
33class certificate_impl;
34class private_key_impl;
97 [[nodiscard]]
static auto load_from_pem(std::string_view path)
113 [[nodiscard]]
static auto load_from_der(std::span<const std::uint8_t> der_data)
142 [[nodiscard]] auto
issuer_name() const -> std::
string;
154 [[nodiscard]] auto
thumbprint() const -> std::
string;
164 [[nodiscard]] auto
not_before() const -> std::chrono::system_clock::time_point;
170 [[nodiscard]] auto
not_after() const -> std::chrono::system_clock::time_point;
176 [[nodiscard]] auto
is_valid() const ->
bool;
182 [[nodiscard]] auto
is_expired() const ->
bool;
192 [[nodiscard]] auto
to_pem() const -> std::
string;
198 [[nodiscard]] auto
to_der() const -> std::vector<std::uint8_t>;
208 [[nodiscard]] auto
is_loaded() const noexcept ->
bool;
282 std::string_view path,
283 std::string_view password =
""
293 std::string_view pem_data,
294 std::string_view password =
""
305 [[nodiscard]]
auto algorithm_name() const -> std::
string;
311 [[nodiscard]] auto key_size() const ->
int;
317 [[nodiscard]] auto
is_loaded() const noexcept ->
bool;
356 [[nodiscard]]
auto end_entity() const -> const
certificate*;
362 [[nodiscard]] auto certificates() const -> const std::vector<
certificate>&;
368 [[nodiscard]] auto
empty() const noexcept ->
bool;
374 [[nodiscard]] auto size() const noexcept ->
size_t;
385 [[nodiscard]] static auto
load_from_pem(std::string_view path)
Represents a certificate chain for validation.
certificate_chain()=default
Default constructor - creates an empty chain.
auto issuer_name() const -> std::string
Get the issuer distinguished name.
auto serial_number() const -> std::string
Get the certificate serial number.
std::unique_ptr< certificate_impl > impl_
auto to_der() const -> std::vector< std::uint8_t >
Export certificate as DER bytes.
auto is_expired() const -> bool
Check if the certificate has expired.
static auto load_from_der(std::span< const std::uint8_t > der_data) -> kcenon::common::Result< certificate >
Load certificate from DER-encoded bytes.
static auto load_from_pem(std::string_view path) -> kcenon::common::Result< certificate >
Load certificate from PEM file.
auto impl() const noexcept -> const certificate_impl *
Get internal implementation (for internal use only)
auto subject_name() const -> std::string
Get the subject distinguished name.
auto is_valid() const -> bool
Check if the certificate is currently valid.
auto not_before() const -> std::chrono::system_clock::time_point
Get the not-before date.
auto operator=(certificate &&other) noexcept -> certificate &
Move assignment.
auto to_pem() const -> std::string
Export certificate as PEM string.
~certificate()
Destructor.
auto subject_common_name() const -> std::string
Get the common name from the subject.
auto operator=(const certificate &other) -> certificate &
Copy assignment.
auto thumbprint() const -> std::string
Get the certificate thumbprint (SHA-256)
auto is_loaded() const noexcept -> bool
Check if certificate is loaded.
static auto load_from_pem_string(std::string_view pem_data) -> kcenon::common::Result< certificate >
Load certificate from PEM string.
auto not_after() const -> std::chrono::system_clock::time_point
Get the not-after date.
certificate()
Default constructor - creates an empty certificate.
auto subject_organization() const -> std::string
Get the organization from the subject.
certificate(certificate &&other) noexcept
Move constructor.
auto operator=(const private_key &) -> private_key &=delete
Copy assignment (deleted)
auto operator=(private_key &&other) noexcept -> private_key &
Move assignment.
~private_key()
Destructor - securely erases key material.
private_key(const private_key &)=delete
Copy constructor (deleted - private keys should not be copied)
private_key(private_key &&other) noexcept
Move constructor.
@ empty
Z - Replace with zero-length value.