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

Abstract signer. More...

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

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

Public Member Functions

KeyPair::Generic::PointerType KeyPair () const noexcept
 Keypair used to sign and verify.
 
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.
 
Sign
bool Sign (std::span< const std::byte > input, Buffer::WriteOnly &output) const noexcept
 Sign a byte span.
 
template<StormByte::Type::ByteInputRange Range>
bool Sign (const Range &input, Buffer::WriteOnly &output) const
 Sign an input range of byte-convertible values.
 
bool Sign (const Buffer::ReadOnly &input, Buffer::WriteOnly &output) const noexcept
 Sign a ReadOnly buffer (copy).
 
bool Sign (Buffer::ReadOnly &input, Buffer::WriteOnly &output) const noexcept
 Sign a ReadOnly buffer (move).
 
Buffer::Consumer Sign (Buffer::Consumer consumer, ReadMode mode=ReadMode::Move) const noexcept
 Sign a Consumer.
 
Verify
bool Verify (std::span< const std::byte > input, std::string_view signature) const noexcept
 Verify a byte span against a signature.
 
template<StormByte::Type::ByteInputRange Range>
bool Verify (const Range &input, std::string_view signature) const
 Verify an input range of byte-convertible values against a signature.
 
bool Verify (const Buffer::ReadOnly &input, std::string_view signature) const noexcept
 Verify a ReadOnly buffer (copy).
 
bool Verify (Buffer::ReadOnly &input, std::string_view signature) const noexcept
 Verify a ReadOnly buffer (move).
 
bool Verify (Buffer::Consumer consumer, std::string_view signature, ReadMode mode=ReadMode::Move) const noexcept
 Verify a Consumer.
 
- 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)
 Construct from a keypair pointer.
 
 Generic (enum Type type, const KeyPair::Generic &keypair)
 Construct by cloning a keypair.
 
 Generic (enum Type type, KeyPair::Generic &&keypair)
 Construct by moving a keypair.
 

Protected Attributes

enum Type m_type
 Algorithm.
 
KeyPair::Generic::PointerType m_keypair
 Keypair.
 

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 signer.

Concrete algorithms derive from this.

Constructor & Destructor Documentation

◆ Generic() [1/5]

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

Copy constructor.

Parameters
otherSigner to copy.

◆ Generic() [2/5]

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

Move constructor.

Parameters
otherSigner to move.

◆ ~Generic()

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

Destructor.

◆ Generic() [3/5]

StormByte::Crypto::Signer::Generic::Generic ( enum Type  type,
KeyPair::Generic::PointerType  keypair 
)
inlineprotected

Construct from a keypair pointer.

Parameters
typeAlgorithm.
keypairKeypair.

◆ Generic() [4/5]

StormByte::Crypto::Signer::Generic::Generic ( enum Type  type,
const KeyPair::Generic &  keypair 
)
inlineprotected

Construct by cloning a keypair.

Parameters
typeAlgorithm.
keypairKeypair.

◆ Generic() [5/5]

StormByte::Crypto::Signer::Generic::Generic ( enum Type  type,
KeyPair::Generic &&  keypair 
)
inlineprotected

Construct by moving a keypair.

Parameters
typeAlgorithm.
keypairKeypair.

Member Function Documentation

◆ KeyPair()

KeyPair::Generic::PointerType StormByte::Crypto::Signer::Generic::KeyPair ( ) const
inlinenoexcept

Keypair used to sign and verify.

Returns
Keypair pointer.

◆ operator=() [1/2]

Copy assignment.

Parameters
otherSigner to copy.
Returns
Reference to this signer.

◆ operator=() [2/2]

Move assignment.

Parameters
otherSigner to move.
Returns
Reference to this signer.

◆ Sign() [1/5]

Buffer::Consumer StormByte::Crypto::Signer::Generic::Sign ( Buffer::Consumer  consumer,
ReadMode  mode = ReadMode::Move 
) const
inlinenoexcept

Sign a Consumer.

Parameters
consumerInput consumer.
modeCopy or move.
Returns
Consumer with the signature.

◆ Sign() [2/5]

bool StormByte::Crypto::Signer::Generic::Sign ( Buffer::ReadOnly &  input,
Buffer::WriteOnly &  output 
) const
inlinenoexcept

Sign a ReadOnly buffer (move).

Parameters
inputInput buffer.
outputDestination buffer.
Returns
true on success.

◆ Sign() [3/5]

bool StormByte::Crypto::Signer::Generic::Sign ( const Buffer::ReadOnly &  input,
Buffer::WriteOnly &  output 
) const
inlinenoexcept

Sign a ReadOnly buffer (copy).

Parameters
inputInput buffer.
outputDestination buffer.
Returns
true on success.

◆ Sign() [4/5]

bool StormByte::Crypto::Signer::Generic::Sign ( const Range &  input,
Buffer::WriteOnly &  output 
) const
inline

Sign an input range of byte-convertible values.

Template Parameters
RangeInput range type.
Parameters
inputInput values.
outputDestination buffer.
Returns
true on success.

◆ Sign() [5/5]

bool StormByte::Crypto::Signer::Generic::Sign ( std::span< const std::byte >  input,
Buffer::WriteOnly &  output 
) const
inlinenoexcept

Sign a byte span.

Parameters
inputInput bytes.
outputDestination buffer.
Returns
true on success.

◆ Verify() [1/5]

bool StormByte::Crypto::Signer::Generic::Verify ( Buffer::Consumer  consumer,
std::string_view  signature,
ReadMode  mode = ReadMode::Move 
) const
inlinenoexcept

Verify a Consumer.

Parameters
consumerInput consumer.
signatureSignature. Accepts String and std::string via string_view.
modeCopy or move.
Returns
true if valid.

◆ Verify() [2/5]

bool StormByte::Crypto::Signer::Generic::Verify ( Buffer::ReadOnly &  input,
std::string_view  signature 
) const
inlinenoexcept

Verify a ReadOnly buffer (move).

Parameters
inputInput buffer.
signatureSignature. Accepts String and std::string via string_view.
Returns
true if valid.

◆ Verify() [3/5]

bool StormByte::Crypto::Signer::Generic::Verify ( const Buffer::ReadOnly &  input,
std::string_view  signature 
) const
inlinenoexcept

Verify a ReadOnly buffer (copy).

Parameters
inputInput buffer.
signatureSignature. Accepts String and std::string via string_view.
Returns
true if valid.

◆ Verify() [4/5]

bool StormByte::Crypto::Signer::Generic::Verify ( const Range &  input,
std::string_view  signature 
) const
inline

Verify an input range of byte-convertible values against a signature.

Template Parameters
RangeInput range type.
Parameters
inputInput values.
signatureSignature. Accepts String and std::string via string_view.
Returns
true if valid.

◆ Verify() [5/5]

bool StormByte::Crypto::Signer::Generic::Verify ( std::span< const std::byte >  input,
std::string_view  signature 
) const
inlinenoexcept

Verify a byte span against a signature.

Parameters
inputInput bytes.
signatureSignature. Accepts String and std::string via string_view.
Returns
true if valid.

Member Data Documentation

◆ m_keypair

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

Keypair.

◆ m_type

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

Algorithm.


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