10Duke Enterprise C++ SDK
Loading...
Searching...
No Matches
tenduke::crypto::aes::AESGCMCipher Class Referenceabstract

#include <AESGCMCipher.h>

Detailed Description

An AES-GCM cipher that supports encryption with an externally provided nonce.

Extends AESCipher with the ability to supply the nonce (IV) explicitly. This is needed in key-derivation schemes where the same random value serves as both the PBKDF2 salt and the AES-GCM nonce.

Inheritance diagram for tenduke::crypto::aes::AESGCMCipher:
tenduke::crypto::aes::AESCipher tenduke::crypto::Cipher tenduke::crypto::aes::libcrypto::LibcryptoAESCipher tenduke::crypto::win::cng::WinCNGAESCipher

Public Member Functions

virtual void encryptData (const ::tenduke::utl::DataSpan &nonce, const ::tenduke::utl::DataSpan &plaintext, ::tenduke::utl::DataSink &ciphertext) const =0
 Encrypts data using the provided nonce.
virtual void encryptData (const ::tenduke::utl::DataSpan &plaintext, ::tenduke::utl::DataSink &ciphertext) const=0
 Utility method to encrypt data.
Public Member Functions inherited from tenduke::crypto::aes::AESCipher
 AESCipher (const AESCipher &)=delete
AESCipheroperator= (const AESCipher &)=delete
 AESCipher (AESCipher &&other) noexcept=default
AESCipheroperator= (AESCipher &&other) noexcept=default
Public Member Functions inherited from tenduke::crypto::Cipher
 Cipher (const Cipher &)=delete
Cipher & operator= (const Cipher &)=delete
 Cipher (Cipher &&other) noexcept=default
Cipher & operator= (Cipher &&other) noexcept=default
virtual void decryptData (const ::tenduke::utl::DataSpan &ciphertext, ::tenduke::utl::DataSink &plaintext) const =0
 Utility method to decrypt data.

Member Function Documentation

◆ encryptData() [1/2]

virtual void tenduke::crypto::aes::AESGCMCipher::encryptData ( const ::tenduke::utl::DataSpan & nonce,
const ::tenduke::utl::DataSpan & plaintext,
::tenduke::utl::DataSink & ciphertext ) const
pure virtual

Encrypts data using the provided nonce.

Writes [nonce][ciphertext][authentication tag] to ciphertext.

Parameters
noncethe nonce (IV) to use; must be GCM_NONCE_SIZE bytes
plaintextdata to encrypt
ciphertextsink that receives the output

Implemented in LibcryptoAESCipher, tenduke::crypto::aes::libcrypto::LibcryptoAESCipher, and tenduke::crypto::win::cng::WinCNGAESCipher.

◆ encryptData() [2/2]

virtual void tenduke::crypto::Cipher::encryptData ( const ::tenduke::utl::DataSpan & plaintext,
::tenduke::utl::DataSink & ciphertext ) const
virtual

Utility method to encrypt data.

This method encrypts the provided data and outputs a binary data object which contains:

  • nonce / IV (if used by the cipher), automatically generated
  • the ciphertext
  • the authentication tag (if used by the cipher)
Parameters
plaintextthe data to encrypt
ciphertextthe encrypted data

Implements tenduke::crypto::Cipher.

Reimplemented in LibcryptoAESCipher, tenduke::crypto::aes::libcrypto::LibcryptoAESCipher, and tenduke::crypto::win::cng::WinCNGAESCipher.


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