PCL

AES-256 cipher. More...

#include <Cryptography.h>

+ Inheritance diagram for pcl::AES256:

Public Types

using block_type = uint8[block_length]
 
using key_type = uint8[key_length]
 

Public Member Functions

 AES256 (const AES256 &)=default
 
 AES256 (IsoString &key)
 
 AES256 (void *key)
 
 ~AES256 () override
 
String AlgorithmName () const override
 
void Decrypt (void *output, const void *input, size_type length) const override
 
void DecryptBlock (void *output, const void *input) const
 
void Encrypt (void *output, const void *input, size_type length) const override
 
void EncryptBlock (void *output, const void *input) const
 
size_type KeyLength () const override
 
AES256operator= (const AES256 &)=default
 
- Public Member Functions inherited from pcl::Cipher
 Cipher ()=default
 
 Cipher (const Cipher &)=default
 
virtual ~Cipher ()
 
template<class C >
ByteArray Decrypt (const C &input) const
 
template<class C >
void Decrypt (void *output, const C &input) const
 
template<class C >
ByteArray Encrypt (const C &input) const
 
template<class C >
void Encrypt (void *output, const C &input) const
 
Cipheroperator= (const Cipher &)=default
 

Detailed Description

The AES256 class is a FIPS-197 compliant implementation of the Advanced Encryption Standard (AES) cipher using 256-bit keys.

References

The AES (Advanced Encryption Standard) block cipher algorithm (originally called Rijndael) was designed by Vincent Rijmen and Joan Daemen:

http://csrc.nist.gov/encryption/aes/rijndael/Rijndael.pdf http://csrc.nist.gov/publications/fips/fips197/fips-197.pdf

Definition at line 933 of file Cryptography.h.

Member Typedef Documentation

◆ block_type

using pcl::AES256::block_type = uint8[ block_length ]

Represents a 16-byte ECB encryption/decription block for the AES-256 algorithm.

Definition at line 948 of file Cryptography.h.

◆ key_type

using pcl::AES256::key_type = uint8[ key_length ]

Represents a 256-bit cipher key for the AES-256 algorithm.

Definition at line 942 of file Cryptography.h.

Constructor & Destructor Documentation

◆ AES256() [1/3]

pcl::AES256::AES256 ( void *  key)
inline

Constructs an AES-256 cipher object.

Parameters
keyStarting address of a contiguous block of 32 bytes, which will be treated as the 256-bit cipher key. The first 32 bytes stored at this address will be wiped out (replaced with zeros) by this constructor.
Note
For enhanced security, this constructor wipes out the specified cipher key, filling it with 32 zero bytes. If you want to preserve the key (which in general is a bad idea for security reasons), make a safe copy before invoking this constructor.

Definition at line 963 of file Cryptography.h.

◆ AES256() [2/3]

pcl::AES256::AES256 ( IsoString key)
inline

Constructs an AES-256 cipher object.

Parameters
key256-bit cipher key specified as an 8-bit string. The contents of this string Will be wiped out (filled with null characters) by this constructor.

The AES-256 cipher key will be initialized with the lowercase hexadecimal representation of 20 successive MD5 checksum operations applied to the specified key string (note that an MD5 checksum is a sequence of 16 bytes, whose hexadecimal representation has 32 characters, or 256 bits).

Note
For enhanced security, this constructor wipes out the specified cipher key string, filling it with null characters. If you want to preserve the original key (which in general is a bad idea for security reasons), make a copy and ensure it references its string data uniquely before invoking this constructor.

Definition at line 986 of file Cryptography.h.

References pcl::GenericString< T, R, A >::Begin(), pcl::Array< T, A >::Fill(), pcl::CryptographicHash::Hash(), pcl::GenericString< T, R, A >::SecureFill(), and pcl::IsoString::ToHex().

◆ AES256() [3/3]

pcl::AES256::AES256 ( const AES256 )
default

Copy constructor.

◆ ~AES256()

pcl::AES256::~AES256 ( )
inlineoverride

Destroys an AES-256 cipher object.

Definition at line 1010 of file Cryptography.h.

Member Function Documentation

◆ AlgorithmName()

String pcl::AES256::AlgorithmName ( ) const
inlineoverridevirtual

Returns "AES256", the name of this cipher algorithm.

Implements pcl::Cipher.

Definition at line 1017 of file Cryptography.h.

◆ Decrypt()

void pcl::AES256::Decrypt ( void *  output,
const void *  input,
size_type  length 
) const
overridevirtual

AES buffer decryption (CBC mode).

Parameters
[out]outputStarting address of the output buffer, where the decrypted data (or plain text) will be stored.
inputStarting address of the input buffer, where the encrypted data (or cipher text) is stored.
lengthThe buffer length in bytes. Must be an integer multiple of 16 bytes.

If the specified length is not an integer multiple of 16 bytes, this function throws an Error exception.

Implements pcl::Cipher.

◆ DecryptBlock()

void pcl::AES256::DecryptBlock ( void *  output,
const void *  input 
) const

AES block decryption (ECB mode).

Parameters
[out]outputStarting address of the decrypted 16-byte block.
inputStarting address of the input 16-byte block.

◆ Encrypt()

void pcl::AES256::Encrypt ( void *  output,
const void *  input,
size_type  length 
) const
overridevirtual

AES-256 buffer encryption (CBC mode).

Parameters
[out]outputStarting address of the output buffer, where the encrypted data (or cipher text) will be stored.
inputStarting address of the input buffer, where the original data (or plain text) is stored.
lengthThe buffer length in bytes. Must be an integer multiple of 16 bytes.

If the specified length is not an integer multiple of 16 bytes, this function throws an Error exception. If necessary, the source data must be padded with zeros or spaces, as required to achieve a valid length.

Implements pcl::Cipher.

◆ EncryptBlock()

void pcl::AES256::EncryptBlock ( void *  output,
const void *  input 
) const

AES block encryption (ECB mode).

Parameters
[out]outputStarting address of the encrypted 16-byte block.
inputStarting address of the input 16-byte block.

◆ KeyLength()

size_type pcl::AES256::KeyLength ( ) const
inlineoverridevirtual

Returns 32, the length in bytes of a key in the AES-256 cipher algorithm.

Implements pcl::Cipher.

Definition at line 1025 of file Cryptography.h.

◆ operator=()

AES256& pcl::AES256::operator= ( const AES256 )
default

Copy assignment operator. Returns a reference to this object.


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