StormByte C++ Library: Crypto module 1.0.0
StormByte-Crypto is a StormByte library module for handling cryptographic operations
Loading...
Searching...
No Matches
Public Member Functions | List of all members
StormByte::Crypto::Asymmetric Class Referencefinal

A class for managing asymmetric encryption and decryption. More...

#include <asymetric.hxx>

Inheritance diagram for StormByte::Crypto::Asymmetric:
Inheritance graph
[legend]
Collaboration diagram for StormByte::Crypto::Asymmetric:
Collaboration graph
[legend]

Public Member Functions

 Asymmetric (const Algorithm::Asymmetric &algorithm, const KeyPair &key_pair) noexcept
 Constructs an Asymmetric instance with a specified algorithm and key pair.
 
 Asymmetric (const Algorithm::Asymmetric &algorithm, KeyPair &&key_pair) noexcept
 Constructs an Asymmetric instance with a specified algorithm and key pair (move version).
 
 Asymmetric (const Asymmetric &crypter)=default
 Copy constructor for the Asymmetric class.
 
 Asymmetric (Asymmetric &&crypter) noexcept=default
 Move constructor for the Asymmetric class.
 
 ~Asymmetric () noexcept override=default
 Destructor for the Asymmetric class.
 
Asymmetricoperator= (const Asymmetric &crypter)=default
 Copy assignment operator for the Asymmetric class.
 
Asymmetricoperator= (Asymmetric &&crypter) noexcept=default
 Move assignment operator for the Asymmetric class.
 
Expected< std::string, ExceptionEncrypt (const std::string &input) const noexcept override
 Encrypts a string input using the asymmetric encryption algorithm.
 
Expected< Buffer::Simple, ExceptionEncrypt (const Buffer::Simple &buffer) const noexcept override
 Encrypts a buffer using the asymmetric encryption algorithm.
 
Buffer::Consumer Encrypt (const Buffer::Consumer consumer) const noexcept override
 Encrypts data asynchronously using a Consumer/Producer model.
 
Expected< std::string, ExceptionDecrypt (const std::string &input) const noexcept override
 Decrypts a string input using the asymmetric encryption algorithm.
 
Expected< Buffer::Simple, ExceptionDecrypt (const Buffer::Simple &buffer) const noexcept override
 Decrypts a buffer using the asymmetric encryption algorithm.
 
Buffer::Consumer Decrypt (const Buffer::Consumer consumer) const noexcept override
 Decrypts data asynchronously using a Consumer/Producer model.
 
const KeyPairKeyPair () const noexcept
 Returns the key pair associated with this Asymmetric instance.
 
- Public Member Functions inherited from StormByte::Crypto::Crypter
 Crypter () noexcept=default
 Default constructor for the Crypter class.
 
 Crypter (const Crypter &crypter)=default
 Copy constructor for the Crypter class.
 
 Crypter (Crypter &&crypter) noexcept=default
 Move constructor for the Crypter class.
 
virtual ~Crypter () noexcept=default
 Virtual destructor for the Crypter class.
 
Crypteroperator= (const Crypter &crypter)=default
 Copy assignment operator for the Crypter class.
 
Crypteroperator= (Crypter &&crypter) noexcept=default
 Move assignment operator for the Crypter class.
 

Detailed Description

A class for managing asymmetric encryption and decryption.

This class provides methods for encrypting and decrypting data using asymmetric encryption algorithms.

Constructor & Destructor Documentation

◆ Asymmetric() [1/4]

StormByte::Crypto::Asymmetric::Asymmetric ( const Algorithm::Asymmetric &  algorithm,
const KeyPair key_pair 
)
explicitnoexcept

Constructs an Asymmetric instance with a specified algorithm and key pair.

Parameters
algorithmThe asymmetric encryption algorithm to use.
key_pairThe key pair to use for encryption and decryption.

◆ Asymmetric() [2/4]

StormByte::Crypto::Asymmetric::Asymmetric ( const Algorithm::Asymmetric &  algorithm,
KeyPair &&  key_pair 
)
explicitnoexcept

Constructs an Asymmetric instance with a specified algorithm and key pair (move version).

Parameters
algorithmThe asymmetric encryption algorithm to use.
key_pairThe key pair to use for encryption and decryption (rvalue reference).

◆ Asymmetric() [3/4]

StormByte::Crypto::Asymmetric::Asymmetric ( const Asymmetric crypter)
default

Copy constructor for the Asymmetric class.

Parameters
crypterThe Asymmetric instance to copy.

◆ Asymmetric() [4/4]

StormByte::Crypto::Asymmetric::Asymmetric ( Asymmetric &&  crypter)
defaultnoexcept

Move constructor for the Asymmetric class.

Parameters
crypterThe Asymmetric instance to move.

Member Function Documentation

◆ Decrypt() [1/3]

Buffer::Consumer StormByte::Crypto::Asymmetric::Decrypt ( const Buffer::Consumer  consumer) const
overridevirtualnoexcept

Decrypts data asynchronously using a Consumer/Producer model.

Parameters
consumerThe Consumer buffer containing the encrypted data.
Returns
A Consumer buffer containing the decrypted data.

Implements StormByte::Crypto::Crypter.

◆ Decrypt() [2/3]

Expected< Buffer::Simple, Exception > StormByte::Crypto::Asymmetric::Decrypt ( const Buffer::Simple &  buffer) const
overridevirtualnoexcept

Decrypts a buffer using the asymmetric encryption algorithm.

Parameters
bufferThe buffer to decrypt.
Returns
An Expected containing the decrypted buffer or an error.

Implements StormByte::Crypto::Crypter.

◆ Decrypt() [3/3]

Expected< std::string, Exception > StormByte::Crypto::Asymmetric::Decrypt ( const std::string &  input) const
overridevirtualnoexcept

Decrypts a string input using the asymmetric encryption algorithm.

Parameters
inputThe string to decrypt.
Returns
An Expected containing the decrypted string or an error.

Implements StormByte::Crypto::Crypter.

◆ Encrypt() [1/3]

Buffer::Consumer StormByte::Crypto::Asymmetric::Encrypt ( const Buffer::Consumer  consumer) const
overridevirtualnoexcept

Encrypts data asynchronously using a Consumer/Producer model.

Parameters
consumerThe Consumer buffer containing the input data.
Returns
A Consumer buffer containing the encrypted data.

Implements StormByte::Crypto::Crypter.

◆ Encrypt() [2/3]

Expected< Buffer::Simple, Exception > StormByte::Crypto::Asymmetric::Encrypt ( const Buffer::Simple &  buffer) const
overridevirtualnoexcept

Encrypts a buffer using the asymmetric encryption algorithm.

Parameters
bufferThe buffer to encrypt.
Returns
An Expected containing the encrypted buffer or an error.

Implements StormByte::Crypto::Crypter.

◆ Encrypt() [3/3]

Expected< std::string, Exception > StormByte::Crypto::Asymmetric::Encrypt ( const std::string &  input) const
overridevirtualnoexcept

Encrypts a string input using the asymmetric encryption algorithm.

Parameters
inputThe string to encrypt.
Returns
An Expected containing the encrypted string or an error.

Implements StormByte::Crypto::Crypter.

◆ KeyPair()

const KeyPair & StormByte::Crypto::Asymmetric::KeyPair ( ) const
noexcept

Returns the key pair associated with this Asymmetric instance.

Returns
A reference to the key pair.

◆ operator=() [1/2]

Asymmetric & StormByte::Crypto::Asymmetric::operator= ( Asymmetric &&  crypter)
defaultnoexcept

Move assignment operator for the Asymmetric class.

Parameters
crypterThe Asymmetric instance to move.
Returns
A reference to the updated Asymmetric instance.

◆ operator=() [2/2]

Asymmetric & StormByte::Crypto::Asymmetric::operator= ( const Asymmetric crypter)
default

Copy assignment operator for the Asymmetric class.

Parameters
crypterThe Asymmetric instance to copy.
Returns
A reference to the updated Asymmetric instance.

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