StormByte C++ Library: Crypto module 1.0.0
StormByte-Crypto is a StormByte library module for handling cryptographic operations
|
A class for managing symmetric encryption and decryption. More...
#include <symmetric.hxx>
Public Member Functions | |
Symmetric (const Algorithm::Symmetric &algorithm, const size_t &password_size=16) noexcept | |
Constructs a Symmetric instance with a randomly generated password. | |
Symmetric (const Algorithm::Symmetric &algorithm, const std::string &password) noexcept | |
Constructs a Symmetric instance with a user-provided password. | |
Symmetric (const Symmetric &crypter)=default | |
Copy constructor for the Symmetric class. | |
Symmetric (Symmetric &&crypter) noexcept=default | |
Move constructor for the Symmetric class. | |
~Symmetric () noexcept override=default | |
Destructor for the Symmetric class. | |
Symmetric & | operator= (const Symmetric &crypter)=default |
Copy assignment operator for the Symmetric class. | |
Symmetric & | operator= (Symmetric &&crypter) noexcept=default |
Move assignment operator for the Symmetric class. | |
Expected< std::string, Exception > | Encrypt (const std::string &input) const noexcept override |
Encrypts a string input. | |
Expected< Buffer::Simple, Exception > | Encrypt (const Buffer::Simple &buffer) const noexcept override |
Encrypts a buffer. | |
Buffer::Consumer | Encrypt (const Buffer::Consumer consumer) const noexcept override |
Encrypts data asynchronously using a Consumer/Producer model. | |
Expected< std::string, Exception > | Decrypt (const std::string &input) const noexcept override |
Decrypts a string input. | |
Expected< Buffer::Simple, Exception > | Decrypt (const Buffer::Simple &buffer) const noexcept override |
Decrypts a buffer. | |
Buffer::Consumer | Decrypt (const Buffer::Consumer consumer) const noexcept override |
Decrypts data asynchronously using a Consumer/Producer model. | |
const std::string & | Password () const noexcept |
Returns the password used for encryption and decryption. | |
void | Password (const std::string &password) noexcept |
Sets the password for encryption and decryption. | |
void | Password (std::string &&password) noexcept |
Sets the password for encryption and decryption (move version). | |
![]() | |
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. | |
Crypter & | operator= (const Crypter &crypter)=default |
Copy assignment operator for the Crypter class. | |
Crypter & | operator= (Crypter &&crypter) noexcept=default |
Move assignment operator for the Crypter class. | |
A class for managing symmetric encryption and decryption.
This class provides methods for encrypting and decrypting data using symmetric encryption algorithms.
|
noexcept |
Constructs a Symmetric instance with a randomly generated password.
This constructor initializes the Symmetric
instance with the specified symmetric encryption algorithm and a randomly generated password of the specified size.
algorithm | The symmetric encryption algorithm to use. |
password_size | The size of the randomly generated password (default is 16 bytes). |
|
explicitnoexcept |
Constructs a Symmetric instance with a user-provided password.
This constructor initializes the Symmetric
instance with the specified symmetric encryption algorithm and a user-provided password.
algorithm | The symmetric encryption algorithm to use. |
password | The password to use for encryption and decryption. |
|
default |
|
defaultnoexcept |
|
overridedefaultnoexcept |
|
overridevirtualnoexcept |
Decrypts data asynchronously using a Consumer/Producer model.
This method decrypts the data provided by the Consumer buffer using the symmetric encryption algorithm.
consumer | The Consumer buffer containing the encrypted data. |
Implements StormByte::Crypto::Crypter.
|
overridevirtualnoexcept |
Decrypts a buffer.
This method decrypts the given buffer using the symmetric encryption algorithm.
buffer | The buffer to decrypt. |
Implements StormByte::Crypto::Crypter.
|
overridevirtualnoexcept |
Decrypts a string input.
This method decrypts the given string input using the symmetric encryption algorithm.
input | The string to decrypt. |
Implements StormByte::Crypto::Crypter.
|
overridevirtualnoexcept |
Encrypts data asynchronously using a Consumer/Producer model.
This method encrypts the data provided by the Consumer buffer using the symmetric encryption algorithm.
consumer | The Consumer buffer containing the input data. |
Implements StormByte::Crypto::Crypter.
|
overridevirtualnoexcept |
Encrypts a buffer.
This method encrypts the given buffer using the symmetric encryption algorithm.
buffer | The buffer to encrypt. |
Implements StormByte::Crypto::Crypter.
|
overridevirtualnoexcept |
Encrypts a string input.
This method encrypts the given string input using the symmetric encryption algorithm.
input | The string to encrypt. |
Implements StormByte::Crypto::Crypter.
|
noexcept |
Returns the password used for encryption and decryption.
This method returns the password used by the Symmetric
instance for encryption and decryption.
|
noexcept |
Sets the password for encryption and decryption.
This method sets a new password for the Symmetric
instance to use for encryption and decryption.
password | The new password to use. |
|
noexcept |
Sets the password for encryption and decryption (move version).
This method sets a new password for the Symmetric
instance to use for encryption and decryption. The password is moved into the instance to avoid unnecessary copying.
password | The new password to use (rvalue reference). |