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

AES-256 in Counter Mode (CTR) as specified in NIST SP 800-38A. More...

#include <aes_ctr.hpp>

Public Member Functions

 AesCtr (const uint8_t key[KEY_SIZE])
 Initialize with a 32-byte key.
 
 AesCtr (const AesCtr &)=delete
 
AesCtroperator= (const AesCtr &)=delete
 
expected< std::vector< uint8_t > > process (const uint8_t *data, size_t size, const uint8_t iv[IV_SIZE]) const
 Encrypt or decrypt data using AES-CTR.
 
expected< std::vector< uint8_t > > encrypt (const uint8_t *data, size_t size, const uint8_t iv[IV_SIZE]) const
 Convenience alias for process() – encrypt data with AES-CTR.
 
expected< std::vector< uint8_t > > decrypt (const uint8_t *data, size_t size, const uint8_t iv[IV_SIZE]) const
 Convenience alias for process() – decrypt data with AES-CTR.
 

Static Public Attributes

static constexpr size_t KEY_SIZE = 32
 AES-256 key size in bytes.
 
static constexpr size_t IV_SIZE = 16
 Full 128-bit IV/counter size in bytes.
 

Detailed Description

AES-256 in Counter Mode (CTR) as specified in NIST SP 800-38A.

CTR mode converts AES into a stream cipher by encrypting sequential counter blocks and XORing the resulting keystream with the data. Because XOR is its own inverse, encryption and decryption are the same operation.

This mode is used for Parquet column data encryption where authentication is not needed (column integrity is verified by page checksums).

Note
Counter increment uses the last 4 bytes of the 16-byte IV as a big-endian uint32, matching the Parquet PME specification.
See also
AesGcm for authenticated encryption (footer encryption)
NIST SP 800-38A Section 6.5 (CTR mode)

Definition at line 68 of file aes_ctr.hpp.

Constructor & Destructor Documentation

◆ AesCtr() [1/2]

signet::forge::crypto::AesCtr::AesCtr ( const uint8_t  key[KEY_SIZE])
inlineexplicit

Initialize with a 32-byte key.

Definition at line 74 of file aes_ctr.hpp.

◆ AesCtr() [2/2]

signet::forge::crypto::AesCtr::AesCtr ( const AesCtr )
delete

Member Function Documentation

◆ decrypt()

expected< std::vector< uint8_t > > signet::forge::crypto::AesCtr::decrypt ( const uint8_t *  data,
size_t  size,
const uint8_t  iv[IV_SIZE] 
) const
inline

Convenience alias for process() – decrypt data with AES-CTR.

Parameters
dataPointer to ciphertext bytes.
sizeNumber of bytes to decrypt.
iv16-byte initialization vector (must match encryption IV).
Returns
Plaintext bytes (same length as input).

Definition at line 173 of file aes_ctr.hpp.

◆ encrypt()

expected< std::vector< uint8_t > > signet::forge::crypto::AesCtr::encrypt ( const uint8_t *  data,
size_t  size,
const uint8_t  iv[IV_SIZE] 
) const
inline

Convenience alias for process() – encrypt data with AES-CTR.

Parameters
dataPointer to plaintext bytes.
sizeNumber of bytes to encrypt.
iv16-byte initialization vector.
Returns
Ciphertext bytes (same length as input).

Definition at line 162 of file aes_ctr.hpp.

◆ operator=()

AesCtr & signet::forge::crypto::AesCtr::operator= ( const AesCtr )
delete

◆ process()

expected< std::vector< uint8_t > > signet::forge::crypto::AesCtr::process ( const uint8_t *  data,
size_t  size,
const uint8_t  iv[IV_SIZE] 
) const
inline

Encrypt or decrypt data using AES-CTR.

CTR mode is symmetric: encrypt(plaintext) == decrypt(ciphertext), because the keystream is generated independently and simply XORed.

Parameters
dataPointer to input bytes (plaintext or ciphertext).
sizeNumber of bytes to process.
iv16-byte initialization vector / initial counter value.
Returns
Processed output bytes (same length as input).

Definition at line 108 of file aes_ctr.hpp.

Member Data Documentation

◆ IV_SIZE

constexpr size_t signet::forge::crypto::AesCtr::IV_SIZE = 16
staticconstexpr

Full 128-bit IV/counter size in bytes.

Definition at line 71 of file aes_ctr.hpp.

◆ KEY_SIZE

constexpr size_t signet::forge::crypto::AesCtr::KEY_SIZE = 32
staticconstexpr

AES-256 key size in bytes.

Definition at line 70 of file aes_ctr.hpp.


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