libkeepass 0.2.0
KeePass key database importer/exporter library
Loading...
Searching...
No Matches
keepass::AesCipher Class Referencefinal

AES-256-ECB block cipher using OpenSSL's EVP interface. More...

#include <cipher.hh>

Inheritance diagram for keepass::AesCipher:
keepass::Cipher< 16 >

Public Member Functions

 AesCipher (const uint8_t *key)
 Constructs an AES cipher with a zero initialization vector.
 
 AesCipher (const uint8_t *key, const std::array< uint8_t, 16 > &init_vec)
 Constructs an AES cipher with a given initialization vector.
 
 ~AesCipher ()
 Destroys the cipher and frees the OpenSSL contexts.
 
const std::array< uint8_t, 16 > & InitializationVector () const override
 Returns the initialization vector.
 
void Decrypt (const std::array< uint8_t, 16 > &src, std::array< uint8_t, 16 > &dst) const override
 Decrypts a single 16-byte block using AES-256-ECB.
 
void Encrypt (const std::array< uint8_t, 16 > &src, std::array< uint8_t, 16 > &dst) const override
 Encrypts a single 16-byte block using AES-256-ECB.
 
- Public Member Functions inherited from keepass::Cipher< 16 >
virtual void Decrypt (const std::array< uint8_t, N > &src, std::array< uint8_t, N > &dst) const=0
 Decrypts a single block.
 
virtual void Encrypt (const std::array< uint8_t, N > &src, std::array< uint8_t, N > &dst) const=0
 Encrypts a single block.
 

Detailed Description

AES-256-ECB block cipher using OpenSSL's EVP interface.

Constructor & Destructor Documentation

◆ AesCipher() [1/2]

keepass::AesCipher::AesCipher ( const uint8_t *  key)
inlineexplicit

Constructs an AES cipher with a zero initialization vector.

Parameters
keyThe 256-bit (32-byte) encryption key.

◆ AesCipher() [2/2]

keepass::AesCipher::AesCipher ( const uint8_t *  key,
const std::array< uint8_t, 16 > &  init_vec 
)

Constructs an AES cipher with a given initialization vector.

Parameters
keyThe 256-bit (32-byte) encryption key.
init_vecThe 16-byte initialization vector.
Exceptions
InternalErrorIf the OpenSSL cipher context cannot be created or initialized.

Member Function Documentation

◆ Decrypt()

void keepass::AesCipher::Decrypt ( const std::array< uint8_t, 16 > &  src,
std::array< uint8_t, 16 > &  dst 
) const
override

Decrypts a single 16-byte block using AES-256-ECB.

Parameters
srcThe ciphertext block to decrypt.
dstThe resulting plaintext block.

◆ Encrypt()

void keepass::AesCipher::Encrypt ( const std::array< uint8_t, 16 > &  src,
std::array< uint8_t, 16 > &  dst 
) const
override

Encrypts a single 16-byte block using AES-256-ECB.

Parameters
srcThe plaintext block to encrypt.
dstThe resulting ciphertext block.

◆ InitializationVector()

const std::array< uint8_t, 16 > & keepass::AesCipher::InitializationVector ( ) const
inlineoverridevirtual

Returns the initialization vector.

Implements keepass::Cipher< 16 >.


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