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

Abstract crypter. More...

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

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

Public Member Functions

enum Type Type () const noexcept
 Cipher of this crypter.
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.
Encrypt
bool Encrypt (std::span< const std::byte > input, Buffer::WriteOnly &output) const noexcept
 Encrypt a byte span.
template<StormByte::Type::ByteInputRange Range>
bool Encrypt (const Range &input, Buffer::WriteOnly &output) const
 Encrypt an input range of byte-convertible values.
bool Encrypt (const Buffer::ReadOnly &input, Buffer::WriteOnly &output) const noexcept
 Encrypt a read-only buffer (copy).
bool Encrypt (Buffer::ReadOnly &input, Buffer::WriteOnly &output) const noexcept
 Encrypt a buffer, consuming it.
Buffer::Consumer Encrypt (Buffer::Consumer consumer, ReadMode mode=ReadMode::Move) const noexcept
 Encrypt a Consumer into another Consumer.
Decrypt
bool Decrypt (std::span< const std::byte > input, Buffer::WriteOnly &output) const noexcept
 Decrypt a byte span.
template<StormByte::Type::ByteInputRange Range>
bool Decrypt (const Range &input, Buffer::WriteOnly &output) const
 Decrypt an input range of byte-convertible values.
bool Decrypt (const Buffer::ReadOnly &input, Buffer::WriteOnly &output) const noexcept
 Decrypt a read-only buffer (copy).
bool Decrypt (Buffer::ReadOnly &input, Buffer::WriteOnly &output) const noexcept
 Decrypt a buffer, consuming it.
Buffer::Consumer Decrypt (Buffer::Consumer consumer, ReadMode mode=ReadMode::Move) const noexcept
 Decrypt a Consumer into another Consumer.
Public Member Functions inherited from StormByte::Safe::Clonable< Generic >
constexpr Clonable ()=default
constexpr Clonable & operator= (const Clonable &)=default
virtual constexpr ~Clonable () noexcept=default
virtual PointerType Clone () const =0
virtual PointerType Move ()=0

Protected Member Functions

 Generic (enum Type type)
 Construct with a cipher.
virtual bool DoEncrypt (std::span< const std::byte > input, Buffer::WriteOnly &output) const noexcept=0
 Encrypt a byte span.
virtual Buffer::Consumer DoEncrypt (Buffer::Consumer consumer, ReadMode mode) const noexcept=0
 Encrypt a Consumer.
virtual bool DoDecrypt (std::span< const std::byte > input, Buffer::WriteOnly &output) const noexcept=0
 Decrypt a byte span.
virtual Buffer::Consumer DoDecrypt (Buffer::Consumer consumer, ReadMode mode) const noexcept=0
 Decrypt a Consumer.

Protected Attributes

enum Type m_type
 Cipher.

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

Concrete ciphers derive from this.

Note
MaybeSafe requires ABI-compatible toolchains and all provider modules to remain loaded while objects, virtual functions or ownership callbacks can be used. The stored cipher enum is Safe; inline special members own no local heap storage. Destruction is exported, and owning Clone/Move implementations must allocate and bind creator/deleter callbacks in their provider module through Safe ownership operations. Derived providers must keep every field Safe or satisfy its MaybeSafe requirements, and preserve provider-owned allocation, copying, assignment, movement and destruction.

Constructor & Destructor Documentation

◆ Generic() [1/3]

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

Copy constructor.

Parameters
otherCrypter to copy.

◆ Generic() [2/3]

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

Move constructor.

Parameters
otherCrypter to move.

◆ ~Generic()

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

Destructor.

◆ Generic() [3/3]

StormByte::Crypto::Crypter::Generic::Generic ( enum Type type)
inlineprotected

Construct with a cipher.

Parameters
typeCipher.

Member Function Documentation

◆ Decrypt() [1/5]

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

Decrypt a Consumer into another Consumer.

Parameters
consumerInput consumer.
modeCopy or move.
Returns
Consumer with plaintext.

◆ Decrypt() [2/5]

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

Decrypt a buffer, consuming it.

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

◆ Decrypt() [3/5]

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

Decrypt a read-only buffer (copy).

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

◆ Decrypt() [4/5]

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

Decrypt an input range of byte-convertible values.

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

◆ Decrypt() [5/5]

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

Decrypt a byte span.

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

◆ DoDecrypt() [1/2]

virtual Buffer::Consumer StormByte::Crypto::Crypter::Generic::DoDecrypt ( Buffer::Consumer consumer,
ReadMode mode ) const
protectedpure virtualnoexcept

Decrypt a Consumer.

Parameters
consumerInput consumer.
modeCopy or move.
Returns
Consumer with plaintext.

◆ DoDecrypt() [2/2]

virtual bool StormByte::Crypto::Crypter::Generic::DoDecrypt ( std::span< const std::byte > input,
Buffer::WriteOnly & output ) const
protectedpure virtualnoexcept

Decrypt a byte span.

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

◆ DoEncrypt() [1/2]

virtual Buffer::Consumer StormByte::Crypto::Crypter::Generic::DoEncrypt ( Buffer::Consumer consumer,
ReadMode mode ) const
protectedpure virtualnoexcept

Encrypt a Consumer.

Parameters
consumerInput consumer.
modeCopy or move.
Returns
Consumer with ciphertext.

◆ DoEncrypt() [2/2]

virtual bool StormByte::Crypto::Crypter::Generic::DoEncrypt ( std::span< const std::byte > input,
Buffer::WriteOnly & output ) const
protectedpure virtualnoexcept

Encrypt a byte span.

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

◆ Encrypt() [1/5]

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

Encrypt a Consumer into another Consumer.

Parameters
consumerInput consumer.
modeCopy or move.
Returns
Consumer with ciphertext.

◆ Encrypt() [2/5]

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

Encrypt a buffer, consuming it.

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

◆ Encrypt() [3/5]

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

Encrypt a read-only buffer (copy).

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

◆ Encrypt() [4/5]

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

Encrypt an input range of byte-convertible values.

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

◆ Encrypt() [5/5]

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

Encrypt a byte span.

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

◆ operator=() [1/2]

Generic & StormByte::Crypto::Crypter::Generic::operator= ( const Generic & other)
default

Copy assignment.

Parameters
otherCrypter to copy.
Returns
Reference to this crypter.

◆ operator=() [2/2]

Generic & StormByte::Crypto::Crypter::Generic::operator= ( Generic && other)
defaultnoexcept

Move assignment.

Parameters
otherCrypter to move.
Returns
Reference to this crypter.

◆ Type()

enum Type StormByte::Crypto::Crypter::Generic::Type ( ) const
inlinenoexcept

Cipher of this crypter.

Returns
Crypter type.

Member Data Documentation

◆ m_type

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

Cipher.


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