StormByte-Crypto 3.1.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 override
 Clone this object.
PointerType Move () override
 Move this object into a new instance.
StormByte::Safe::Optional< Secure::Password > Share (const StormByte::Safe::String &peerPublicKey) const 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)
 Construct by cloning an ECDH keypair.
 ECDH (KeyPair::ECDH &&keypair, unsigned short bits=256)
 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 & operator= (const Clonable &)=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.

Note
MaybeSafe inherits all provider requirements of StormByte::Crypto::Secret::Generic. The added arithmetic curve-size field is Safe; exported Clone/Move preserve it and bind ownership callbacks in Crypto.

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 )
inlineexplicit

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 )
inlineexplicit

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
overridevirtual

Clone this object.

Returns
Shared pointer to the clone.

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

◆ Move()

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

Move this object into a new instance.

Returns
Shared pointer to the moved object.

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

◆ operator=() [1/2]

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

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()

StormByte::Safe::Optional< Secure::Password > StormByte::Crypto::Secret::ECDH::Share ( const StormByte::Safe::String & peerPublicKey) const
overridevirtual

Derive a shared secret.

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.

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


The documentation for this class was generated from the following file:
  • lib/public/StormByte/crypto/secret/ecdh.hxx