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

Abstract cipher interface — unified API for authenticated (GCM) and unauthenticated (CTR) encryption. More...

#include <cipher_interface.hpp>

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

Public Member Functions

virtual ~ICipher ()=default
 
virtual expected< std::vector< uint8_t > > encrypt (const uint8_t *data, size_t size, const std::string &aad="") const =0
 Encrypt data.
 
virtual expected< std::vector< uint8_t > > decrypt (const uint8_t *data, size_t size, const std::string &aad="") const =0
 Decrypt data produced by encrypt().
 
virtual bool is_authenticated () const noexcept=0
 Whether this cipher provides authentication (GCM=true, CTR=false).
 
virtual size_t key_size () const noexcept=0
 Key size in bytes (32 for AES-256).
 
virtual std::string_view algorithm_name () const noexcept=0
 Human-readable algorithm name.
 
 ICipher ()=default
 
 ICipher (const ICipher &)=delete
 
ICipheroperator= (const ICipher &)=delete
 
 ICipher (ICipher &&)=default
 
ICipheroperator= (ICipher &&)=default
 

Detailed Description

Abstract cipher interface — unified API for authenticated (GCM) and unauthenticated (CTR) encryption.

Implementations are move-only (hold key material).

Definition at line 64 of file cipher_interface.hpp.

Constructor & Destructor Documentation

◆ ~ICipher()

virtual signet::forge::crypto::ICipher::~ICipher ( )
virtualdefault

◆ ICipher() [1/3]

signet::forge::crypto::ICipher::ICipher ( )
default

◆ ICipher() [2/3]

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

◆ ICipher() [3/3]

signet::forge::crypto::ICipher::ICipher ( ICipher &&  )
default

Member Function Documentation

◆ algorithm_name()

virtual std::string_view signet::forge::crypto::ICipher::algorithm_name ( ) const
pure virtualnoexcept

Human-readable algorithm name.

Implemented in signet::forge::crypto::AesGcmCipher, and signet::forge::crypto::AesCtrCipher.

◆ decrypt()

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

◆ encrypt()

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

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]

Implemented in signet::forge::crypto::AesGcmCipher, and signet::forge::crypto::AesCtrCipher.

◆ is_authenticated()

virtual bool signet::forge::crypto::ICipher::is_authenticated ( ) const
pure virtualnoexcept

Whether this cipher provides authentication (GCM=true, CTR=false).

Implemented in signet::forge::crypto::AesGcmCipher, and signet::forge::crypto::AesCtrCipher.

◆ key_size()

virtual size_t signet::forge::crypto::ICipher::key_size ( ) const
pure virtualnoexcept

Key size in bytes (32 for AES-256).

Implemented in signet::forge::crypto::AesGcmCipher, and signet::forge::crypto::AesCtrCipher.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

ICipher & signet::forge::crypto::ICipher::operator= ( ICipher &&  )
default

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