LibLogicalAccess
2.5.0
An Open Source RFID Library
|
AES cipher class. More...
#include <aes_cipher.hpp>
Public Member Functions | |
AESCipher (EncMode _mode=ENC_MODE_CBC) | |
Constructor. | |
unsigned char | getBlockSize () const override |
![]() | |
OpenSSLSymmetricCipher (EncMode mode) | |
Constructor. | |
virtual | ~OpenSSLSymmetricCipher () |
OpenSSLSymmetricCipherContext | start (Method method, const SymmetricKey &key, const InitializationVector &iv, bool padding) const |
Initialize a new encryption/decryption session. | |
void | cipher (const ByteVector &src, ByteVector &dest, const SymmetricKey &key, const InitializationVector &iv, bool padding) override |
Cipher a buffer. | |
void | decipher (const ByteVector &src, ByteVector &dest, const SymmetricKey &key, const InitializationVector &iv, bool padding) override |
Decipher a buffer. | |
![]() | |
virtual | ~SymmetricCipher () |
Destructor. | |
virtual void | cipher (const ByteVector &src, ByteVector &dest, const SymmetricKey &key, const InitializationVector &iv, bool padding)=0 |
Cipher a buffer. | |
void | cipher (const ByteVector &src, ByteVector &dest, const SymmetricKey &key) |
void | cipher (const ByteVector &src, ByteVector &dest, const ByteVector &key, const ByteVector &iv={}) |
virtual void | decipher (const ByteVector &src, ByteVector &dest, const SymmetricKey &key, const InitializationVector &iv, bool padding)=0 |
Decipher a buffer. | |
void | decipher (const ByteVector &src, ByteVector &dest, const SymmetricKey &key) |
void | decipher (const ByteVector &src, ByteVector &dest, const ByteVector &key, const ByteVector &iv={}) |
virtual unsigned char | getBlockSize () const =0 |
Protected Member Functions | |
const EVP_CIPHER * | getEVPCipher (const SymmetricKey &key) const override |
Get the OpenSSL EVP cipher. | |
![]() | |
virtual const EVP_CIPHER * | getEVPCipher (const SymmetricKey &key) const =0 |
Get the openssl EVP cipher. | |
EncMode | mode () const |
Get the encryption mode. | |
Additional Inherited Members | |
![]() | |
enum | EncMode { ENC_MODE_CBC , ENC_MODE_CFB , ENC_MODE_CFB1 , ENC_MODE_CFB8 , ENC_MODE_ECB , ENC_MODE_OFB } |
Encryption mode. More... | |
enum | Method { M_ENCRYPT , M_DECRYPT } |
A method. More... | |
![]() | |
static void | update (OpenSSLSymmetricCipherContext &context, const ByteVector &src) |
Add data to encrypt/decrypt. | |
static ByteVector | stop (OpenSSLSymmetricCipherContext &context) |
Finalize an encryption/decryption session. | |
AES cipher class.
AESCipher is a symmetric cipher class that relies on OpenSSL's implementation of the AES algorithm. Take a look at SymmetricCipher for usage.
|
inlineexplicit |
Constructor.
_mode | The encryption mode. Default is CBC. |
|
overridevirtual |
Implements logicalaccess::openssl::SymmetricCipher.
|
overrideprotectedvirtual |
Get the OpenSSL EVP cipher.
key | The key. |
getEVPCipher() returns the OpenSSL EVP cipher that should be used with key. The resulting EVP cipher mainly depends on the size of key.
If no suitable cipher is found, getEVPCipher() returns NULL.
Implements logicalaccess::openssl::OpenSSLSymmetricCipher.