StormByte-Crypto 2.0.0
C++26 cryptography module of the StormByte suite
 
Loading...
Searching...
No Matches
StormByte::Crypto::Secret::ECDH Class Referencefinal

ECDH shared-secret derivation. More...

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

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

Public Member Functions

PointerType Clone () const noexcept override
 Clone this object.
 
PointerType Move () noexcept override
 Move this object into a new instance.
 
std::optional< Secure::Password > Share (std::string_view peerPublicKey) const noexcept override
 Derive a shared secret.
 
Construction
 ECDH (KeyPair::Generic::PointerType keypair, unsigned short bits=256) noexcept
 Construct from a keypair pointer.
 
 ECDH (const KeyPair::ECDH &keypair, unsigned short bits=256) noexcept
 Construct by cloning an ECDH keypair.
 
 ECDH (KeyPair::ECDH &&keypair, unsigned short bits=256) noexcept
 Construct by moving an ECDH keypair.
 
 ECDH (const ECDH &other)=default
 Copy constructor.
 
 ECDH (ECDH &&other) noexcept=default
 Move constructor.
 
 ~ECDH () noexcept
 Destructor.
 
ECDH & operator= (const ECDH &other)=default
 Copy assignment.
 
ECDH & operator= (ECDH &&other) noexcept=default
 Move assignment.
 
- Public Member Functions inherited from StormByte::Crypto::Secret::Generic
Type Type () const noexcept
 Algorithm of this instance.
 
 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
 

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)
 
- Protected Member Functions inherited from StormByte::Crypto::Secret::Generic
 Generic (enum Type type, KeyPair::Generic::PointerType keypair) noexcept
 Construct with algorithm and keypair.
 
- Protected Attributes inherited from StormByte::Crypto::Secret::Generic
enum Type m_type
 Algorithm.
 
KeyPair::Generic::PointerType m_keypair
 Local keypair (needs private key)
 

Detailed Description

ECDH shared-secret derivation.

Constructor & Destructor Documentation

◆ ECDH() [1/5]

StormByte::Crypto::Secret::ECDH::ECDH ( KeyPair::Generic::PointerType  keypair,
unsigned short  bits = 256 
)
inlinenoexcept

Construct from a keypair pointer.

Parameters
keypairMust be KeyPair::Type::ECDH.
bitsCurve size in bits. Must match the keypair.

◆ ECDH() [2/5]

StormByte::Crypto::Secret::ECDH::ECDH ( const KeyPair::ECDH &  keypair,
unsigned short  bits = 256 
)
inlinenoexcept

Construct by cloning an ECDH keypair.

Parameters
keypairKeypair.
bitsCurve size in bits.

◆ ECDH() [3/5]

StormByte::Crypto::Secret::ECDH::ECDH ( KeyPair::ECDH &&  keypair,
unsigned short  bits = 256 
)
inlinenoexcept

Construct by moving an ECDH keypair.

Parameters
keypairKeypair.
bitsCurve size in bits.

◆ ECDH() [4/5]

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

Copy constructor.

Parameters
otherObject to copy.

◆ ECDH() [5/5]

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

Move constructor.

Parameters
otherObject to move.

◆ ~ECDH()

StormByte::Crypto::Secret::ECDH::~ECDH ( )
noexcept

Destructor.

Member Function Documentation

◆ Clone()

PointerType StormByte::Crypto::Secret::ECDH::Clone ( ) const
inlineoverridevirtualnoexcept

Clone this object.

Returns
Shared pointer to the clone.

Implements StormByte::Safe::Clonable< Generic >.

◆ Move()

PointerType StormByte::Crypto::Secret::ECDH::Move ( )
inlineoverridevirtualnoexcept

Move this object into a new instance.

Returns
Shared pointer to the moved object.

Implements StormByte::Safe::Clonable< Generic >.

◆ operator=() [1/2]

Copy assignment.

Parameters
otherObject to copy.
Returns
Reference to this object.

◆ operator=() [2/2]

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

Move assignment.

Parameters
otherObject to move.
Returns
Reference to this object.

◆ Share()

std::optional< Secure::Password > StormByte::Crypto::Secret::ECDH::Share ( std::string_view  peerPublicKey) const
overridevirtualnoexcept

Derive a shared secret.

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

Implements StormByte::Crypto::Secret::Generic.


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