Signet Forge 0.1.0
C++20 Parquet library with AI-native extensions
DEMO
Loading...
Searching...
No Matches
cipher_interface.hpp File Reference

Abstract cipher interface, GCM/CTR adapters, CipherFactory, and platform CSPRNG. More...

#include "signet/crypto/aes_gcm.hpp"
#include "signet/crypto/aes_ctr.hpp"
#include "signet/crypto/key_metadata.hpp"
#include "signet/crypto/hkdf.hpp"
#include "signet/error.hpp"
#include <array>
#include <atomic>
#include <cstddef>
#include <cstdint>
#include <cstring>
#include <functional>
#include <limits>
#include <memory>
#include <string>
#include <string_view>
#include <vector>
#include <cerrno>
#include <stdexcept>

Go to the source code of this file.

Classes

class  signet::forge::crypto::ICipher
 Abstract cipher interface — unified API for authenticated (GCM) and unauthenticated (CTR) encryption. More...
 
struct  signet::forge::crypto::detail::cipher::IvParsed
 Result of parsing an IV header from encrypted data. More...
 
struct  signet::forge::crypto::detail::crngt::CrngtState
 CRNGT state — stores the previous 32-byte RNG output for comparison. More...
 
class  signet::forge::crypto::SecureKeyBuffer
 RAII container for sensitive key material with mlock and secure zeroization. More...
 
class  signet::forge::crypto::AesGcmCipher
 AES-256-GCM adapter – wraps the low-level AesGcm class behind ICipher. More...
 
class  signet::forge::crypto::AesCtrCipher
 AES-256-CTR adapter – wraps the low-level AesCtr class behind ICipher. More...
 
struct  signet::forge::crypto::CipherFactory
 Factory for creating cipher instances from algorithm enum + raw key. More...
 

Namespaces

namespace  signet
 
namespace  signet::forge
 
namespace  signet::forge::crypto
 
namespace  signet::forge::crypto::detail
 
namespace  signet::forge::crypto::detail::cipher
 
namespace  signet::forge::crypto::detail::crngt
 
namespace  signet::forge::crypto::detail::secure_mem
 
namespace  signet::forge::crypto::detail::kat
 

Functions

void signet::forge::crypto::detail::cipher::fill_random_bytes (uint8_t *buf, size_t size)
 Fill a buffer with cryptographically random bytes using the best available OS-level CSPRNG (CWE-338: Use of Cryptographically Weak PRNG).
 
std::vector< uint8_t > signet::forge::crypto::detail::cipher::generate_iv (size_t iv_size)
 Generate a random initialization vector of the specified size.
 
std::vector< uint8_t > signet::forge::crypto::detail::cipher::prepend_iv (const std::vector< uint8_t > &iv, const std::vector< uint8_t > &ciphertext)
 Prepend an IV header to ciphertext: [1 byte: iv.size()] [iv bytes] [ciphertext].
 
expected< IvParsedsignet::forge::crypto::detail::cipher::parse_iv_header (const uint8_t *data, size_t size)
 Parse the IV header from encrypted data: [1 byte: iv_size] [iv] [ciphertext].
 
void signet::forge::crypto::detail::crngt::fill_random_bytes_tested (CrngtState &state, uint8_t *buf, size_t size)
 Generate random bytes with FIPS 140-3 §4.9.2 continuous test.
 
bool signet::forge::crypto::detail::secure_mem::lock_memory (void *ptr, size_t size)
 Lock a memory region so it is not paged to swap.
 
void signet::forge::crypto::detail::secure_mem::unlock_memory (void *ptr, size_t size)
 Unlock a previously locked memory region.
 
void signet::forge::crypto::detail::secure_mem::secure_zero (void *ptr, size_t size)
 Securely zero a memory region (not optimized out by the compiler).
 
std::vector< uint8_t > signet::forge::crypto::detail::kat::hex_decode (const char *hex)
 Decode a hex string to bytes (internal helper for KAT vectors).
 
bool signet::forge::crypto::crypto_self_test ()
 Run power-on self-tests (Known Answer Tests) for all crypto primitives.
 

Detailed Description

Abstract cipher interface, GCM/CTR adapters, CipherFactory, and platform CSPRNG.

Definition in file cipher_interface.hpp.