Signet Forge 0.1.0
C++20 Parquet library with AI-native extensions
DEMO
Loading...
Searching...
No Matches
signet::forge::crypto::AesCtrCipher Class Referencefinal

AES-256-CTR adapter – wraps the low-level AesCtr class behind ICipher. More...

#include <cipher_interface.hpp>

Inheritance diagram for signet::forge::crypto::AesCtrCipher:
signet::forge::crypto::ICipher

Public Member Functions

 AesCtrCipher (const std::vector< uint8_t > &key)
 Construct from a key vector (must be 32 bytes for AES-256).
 
 AesCtrCipher (const uint8_t *key, size_t key_len)
 Construct from a raw key pointer and length.
 
expected< std::vector< uint8_t > > encrypt (const uint8_t *data, size_t size, const std::string &aad="") const override
 Encrypt data.
 
expected< std::vector< uint8_t > > decrypt (const uint8_t *data, size_t size, const std::string &aad="") const override
 Decrypt data produced by encrypt().
 
 ~AesCtrCipher () override
 Destructor: securely zeroes key material (CWE-244: heap inspection).
 
bool is_authenticated () const noexcept override
 
size_t key_size () const noexcept override
 
std::string_view algorithm_name () const noexcept override
 
- Public Member Functions inherited from signet::forge::crypto::ICipher
virtual ~ICipher ()=default
 
 ICipher ()=default
 
 ICipher (const ICipher &)=delete
 
ICipheroperator= (const ICipher &)=delete
 
 ICipher (ICipher &&)=default
 
ICipheroperator= (ICipher &&)=default
 

Static Public Attributes

static constexpr uint8_t AAD_TAGGED_IV_FLAG = 0x80u
 
static constexpr size_t AAD_TAG_SIZE = 32u
 

Detailed Description

AES-256-CTR adapter – wraps the low-level AesCtr class behind ICipher.

Unauthenticated encryption (the AAD parameter is ignored). Generates a random 16-byte IV per encrypt() call and prepends it to the output.

Note
The destructor securely zeroes key material using volatile writes.
See also
AesGcmCipher for the authenticated counterpart

Definition at line 526 of file cipher_interface.hpp.

Constructor & Destructor Documentation

◆ AesCtrCipher() [1/2]

signet::forge::crypto::AesCtrCipher::AesCtrCipher ( const std::vector< uint8_t > &  key)
inlineexplicit

Construct from a key vector (must be 32 bytes for AES-256).

Definition at line 532 of file cipher_interface.hpp.

◆ AesCtrCipher() [2/2]

signet::forge::crypto::AesCtrCipher::AesCtrCipher ( const uint8_t *  key,
size_t  key_len 
)
inlineexplicit

Construct from a raw key pointer and length.

Definition at line 539 of file cipher_interface.hpp.

◆ ~AesCtrCipher()

signet::forge::crypto::AesCtrCipher::~AesCtrCipher ( )
inlineoverride

Destructor: securely zeroes key material (CWE-244: heap inspection).

Uses volatile write + compiler barrier to prevent dead-store elimination.

Definition at line 634 of file cipher_interface.hpp.

Member Function Documentation

◆ algorithm_name()

std::string_view signet::forge::crypto::AesCtrCipher::algorithm_name ( ) const
inlineoverridevirtualnoexcept
Returns
"AES-256-CTR".

Implements signet::forge::crypto::ICipher.

Definition at line 647 of file cipher_interface.hpp.

◆ decrypt()

expected< std::vector< uint8_t > > signet::forge::crypto::AesCtrCipher::decrypt ( const uint8_t *  data,
size_t  size,
const std::string &  aad = "" 
) const
inlineoverridevirtual

Decrypt data produced by encrypt().

Implements signet::forge::crypto::ICipher.

Definition at line 575 of file cipher_interface.hpp.

◆ encrypt()

expected< std::vector< uint8_t > > signet::forge::crypto::AesCtrCipher::encrypt ( const uint8_t *  data,
size_t  size,
const std::string &  aad = "" 
) const
inlineoverridevirtual

Encrypt data.

For authenticated ciphers, aad is bound into the tag. For unauthenticated ciphers, aad is ignored. Returns: [iv_size(1)] [iv] [ciphertext] [tag if authenticated]

Implements signet::forge::crypto::ICipher.

Definition at line 545 of file cipher_interface.hpp.

◆ is_authenticated()

bool signet::forge::crypto::AesCtrCipher::is_authenticated ( ) const
inlineoverridevirtualnoexcept
Returns
Always false (CTR mode has no authentication).

Implements signet::forge::crypto::ICipher.

Definition at line 643 of file cipher_interface.hpp.

◆ key_size()

size_t signet::forge::crypto::AesCtrCipher::key_size ( ) const
inlineoverridevirtualnoexcept
Returns
32 (AES-256 key size in bytes).

Implements signet::forge::crypto::ICipher.

Definition at line 645 of file cipher_interface.hpp.

Member Data Documentation

◆ AAD_TAG_SIZE

constexpr size_t signet::forge::crypto::AesCtrCipher::AAD_TAG_SIZE = 32u
staticconstexpr

Definition at line 529 of file cipher_interface.hpp.

◆ AAD_TAGGED_IV_FLAG

constexpr uint8_t signet::forge::crypto::AesCtrCipher::AAD_TAGGED_IV_FLAG = 0x80u
staticconstexpr

Definition at line 528 of file cipher_interface.hpp.


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