StormByte-Crypto 2.0.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 std::optional< Secure::Password > Share (std::string_view peerPublicKey) const noexcept=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 (const Clonable &)=default
 
constexpr Clonable (Clonable &&) noexcept=default
 
constexpr Clonable & operator= (const Clonable &)=default
 
constexpr Clonable & operator= (Clonable &&) noexcept=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.

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]

Copy assignment.

Parameters
otherObject to copy.
Returns
Reference to this object.

◆ operator=() [2/2]

Move assignment.

Parameters
otherObject to move.
Returns
Reference to this object.

◆ Share()

virtual std::optional< Secure::Password > StormByte::Crypto::Secret::Generic::Share ( std::string_view  peerPublicKey) const
pure virtualnoexcept

Derive a shared secret from a peer public key.

Parameters
peerPublicKeyPeer public key as Base64. Accepts String and std::string via string_view.
Returns
Password on success, or empty.

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: