StormByte-Crypto 3.1.0
C++26 cryptography module of the StormByte suite
Loading...
Searching...
No Matches
StormByte::Crypto::Secret::Generic Class Referenceabstract

Abstract key-agreement object. More...

#include <StormByte/crypto/secret/generic.hxx>

Inheritance diagram for StormByte::Crypto::Secret::Generic:
Collaboration diagram for StormByte::Crypto::Secret::Generic:

Public Member Functions

Type Type () const noexcept
 Algorithm of this instance.
virtual StormByte::Safe::Optional< Secure::Password > Share (const StormByte::Safe::String &peerPublicKey) const =0
 Derive a shared secret from a peer public key.
Construction
 Generic (const Generic &other)=default
 Copy constructor.
 Generic (Generic &&other) noexcept=default
 Move constructor.
virtual ~Generic () noexcept
 Destructor.
Generic & operator= (const Generic &other)=default
 Copy assignment.
Generic & operator= (Generic &&other) noexcept=default
 Move assignment.
Public Member Functions inherited from StormByte::Safe::Clonable< Generic >
constexpr Clonable ()=default
constexpr Clonable & operator= (const Clonable &)=default
virtual constexpr ~Clonable () noexcept=default
virtual PointerType Clone () const =0
virtual PointerType Move ()=0

Protected Member Functions

 Generic (enum Type type, KeyPair::Generic::PointerType keypair) noexcept
 Construct with algorithm and keypair.

Protected Attributes

enum Type m_type
 Algorithm.
KeyPair::Generic::PointerType m_keypair
 Local keypair (needs private key).

Additional Inherited Members

Public Types inherited from StormByte::Safe::Clonable< Generic >
typedef SmartPointer PointerType
Static Public Member Functions inherited from StormByte::Safe::Clonable< Generic >
static PointerType MakePointer (Args &&... args)

Detailed Description

Abstract key-agreement object.

Holds a local keypair and derives a shared secret from a peer public key.

Note
MaybeSafe requires ABI-compatible toolchains and all provider modules to remain loaded while objects, virtual functions or ownership callbacks can be used. The algorithm enum is Safe; the keypair uses Safe shared ownership and must satisfy its provider's MaybeSafe contract. Inline construction and special members delegate to Safe ownership rather than owning local heap storage; returned Password values are Safe. Destruction is exported, and owning Clone/Move implementations must allocate and bind creator/deleter callbacks in their provider module through Safe ownership operations. Derived providers must keep every field Safe or satisfy its MaybeSafe requirements, and preserve provider-owned allocation, copying, assignment, movement and destruction.

Constructor & Destructor Documentation

◆ Generic() [1/3]

StormByte::Crypto::Secret::Generic::Generic ( const Generic & other)
default

Copy constructor.

Parameters
otherObject to copy.

◆ Generic() [2/3]

StormByte::Crypto::Secret::Generic::Generic ( Generic && other)
defaultnoexcept

Move constructor.

Parameters
otherObject to move.

◆ ~Generic()

virtual StormByte::Crypto::Secret::Generic::~Generic ( )
virtualnoexcept

Destructor.

◆ Generic() [3/3]

StormByte::Crypto::Secret::Generic::Generic ( enum Type type,
KeyPair::Generic::PointerType keypair )
inlineprotectednoexcept

Construct with algorithm and keypair.

Parameters
typeAlgorithm.
keypairLocal keypair.

Member Function Documentation

◆ operator=() [1/2]

Generic & StormByte::Crypto::Secret::Generic::operator= ( const Generic & other)
default

Copy assignment.

Parameters
otherObject to copy.
Returns
Reference to this object.

◆ operator=() [2/2]

Generic & StormByte::Crypto::Secret::Generic::operator= ( Generic && other)
defaultnoexcept

Move assignment.

Parameters
otherObject to move.
Returns
Reference to this object.

◆ Share()

virtual StormByte::Safe::Optional< Secure::Password > StormByte::Crypto::Secret::Generic::Share ( const StormByte::Safe::String & peerPublicKey) const
pure virtual

Derive a shared secret from a peer public key.

Parameters
peerPublicKeyPeer public key as Base64, borrowed for this call.
Returns
Password on success, or empty.
Exceptions
StormByte::ExceptionIf Safe result storage cannot be created.

Implemented in StormByte::Crypto::Secret::ECDH, and StormByte::Crypto::Secret::X25519.

◆ Type()

Type StormByte::Crypto::Secret::Generic::Type ( ) const
inlinenoexcept

Algorithm of this instance.

Returns
Agreement type.

Member Data Documentation

◆ m_keypair

KeyPair::Generic::PointerType StormByte::Crypto::Secret::Generic::m_keypair
protected

Local keypair (needs private key).

◆ m_type

enum Type StormByte::Crypto::Secret::Generic::m_type
protected

Algorithm.


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