StormByte-Crypto 3.1.0
C++26 cryptography module of the StormByte suite
Loading...
Searching...
No Matches
StormByte::Crypto::TLS::Policy Class Referencefinal

Immutable validated TLS 1.3 policy snapshot. More...

#include <StormByte/crypto/tls/policy.hxx>

Public Member Functions

 Policy ()
 Construct the validated default TLS 1.3 profile.
 Policy (const Policy &other)
 Share the immutable validated snapshot.
 Policy (Policy &&other) noexcept
 Retain the immutable snapshot without invalidating the source.
 ~Policy () noexcept
 Release this snapshot reference; the last owner releases Base storage.
Policy & operator= (const Policy &other)
 Replace this snapshot with the source's immutable snapshot.
Policy & operator= (Policy &&other) noexcept
 Replace this snapshot while preserving the source policy.
const Configuration & Preferences () const noexcept
 Read the exact validated preferences; no mutable access.

Friends

ExpectedPolicy Validate (const Configuration &configuration)
 Permit snapshot construction only after designated-profile validation.

Detailed Description

Immutable validated TLS 1.3 policy snapshot.

Safe::Shared stores a const Configuration on Base's heap; the factory copies caller preferences. Copies and moves share immutable storage; moves preserve the source, so every Policy continues to contain a validated snapshot. Assignment replaces the entire snapshot, never edits it. References from Preferences() must not outlive their snapshot. Keep compatible Crypto/Base providers loaded while any Policy or returned Safe value exists.

The policy is consumed by the buffer-driven TLS session; it does not configure network transports.

Constructor & Destructor Documentation

◆ Policy() [1/3]

StormByte::Crypto::TLS::Policy::Policy ( )

Construct the validated default TLS 1.3 profile.

Exceptions
StormByte::Safe::AllocationErrorSnapshot or preference storage cannot be allocated.

◆ Policy() [2/3]

StormByte::Crypto::TLS::Policy::Policy ( const Policy & other)

Share the immutable validated snapshot.

Parameters
otherPolicy whose snapshot is retained.

◆ Policy() [3/3]

StormByte::Crypto::TLS::Policy::Policy ( Policy && other)
noexcept

Retain the immutable snapshot without invalidating the source.

Parameters
otherPolicy whose snapshot is shared; it remains unchanged.

◆ ~Policy()

StormByte::Crypto::TLS::Policy::~Policy ( )
noexcept

Release this snapshot reference; the last owner releases Base storage.

Member Function Documentation

◆ operator=() [1/2]

Policy & StormByte::Crypto::TLS::Policy::operator= ( const Policy & other)

Replace this snapshot with the source's immutable snapshot.

Parameters
otherPolicy whose snapshot is retained.
Returns
This policy.

◆ operator=() [2/2]

Policy & StormByte::Crypto::TLS::Policy::operator= ( Policy && other)
noexcept

Replace this snapshot while preserving the source policy.

Parameters
otherPolicy whose snapshot is shared; it remains unchanged.
Returns
This policy.

◆ Preferences()

const Configuration & StormByte::Crypto::TLS::Policy::Preferences ( ) const
noexcept

Read the exact validated preferences; no mutable access.

Returns
Borrowed immutable configuration owned by the retained snapshot.

◆ Validate

ExpectedPolicy Validate ( const Configuration & configuration)
friend

Permit snapshot construction only after designated-profile validation.

Parameters
configurationCaller input to validate and copy.
Returns
Immutable owned snapshot or first typed configuration error.
Exceptions
StormByte::Safe::AllocationErrorProfile, snapshot or error storage cannot be allocated.
Parameters
configurationMutable caller input copied on success.
Returns
Immutable owned snapshot or first typed error.
Exceptions
StormByte::Safe::AllocationErrorProfile, snapshot or error storage cannot be allocated.
Note
Validation order is version, suites, groups, signatures; within a list, left to right. A valid configuration is used by the TLS session engine. Allocation exceptions propagate; borrowed input is not retained.

The documentation for this class was generated from the following file: