Arduino Cryptography Library
Public Member Functions | Protected Member Functions | Friends | List of all members
AESCommon Class Reference

Abstract base class for AES block ciphers. More...

#include <AES.h>

Inheritance diagram for AESCommon:
BlockCipher AES128 AES192 AES256

Public Member Functions

virtual ~AESCommon ()
 Destroys this AES block cipher object after clearing sensitive information.
 
size_t blockSize () const
 Size of an AES block in bytes. More...
 
void encryptBlock (uint8_t *output, const uint8_t *input)
 Encrypts a single block using this cipher. More...
 
void decryptBlock (uint8_t *output, const uint8_t *input)
 Decrypts a single block using this cipher. More...
 
void clear ()
 Clears all security-sensitive state from this block cipher. More...
 
- Public Member Functions inherited from BlockCipher
 BlockCipher ()
 Constructs a block cipher.
 
virtual ~BlockCipher ()
 Destroys this block cipher object. More...
 
virtual size_t keySize () const =0
 Default size of the key for this block cipher, in bytes. More...
 
virtual bool setKey (const uint8_t *key, size_t len)=0
 Sets the key to use for future encryption and decryption operations. More...
 

Protected Member Functions

 AESCommon ()
 Constructs an AES block cipher object.
 

Friends

class AESTiny128
 
class AESTiny256
 
class AESSmall128
 
class AESSmall256
 

Detailed Description

Abstract base class for AES block ciphers.

This class is abstract. The caller should instantiate AES128, AES192, or AES256 to create an AES block cipher with a specific key size.

Note
This AES implementation does not have constant cache behaviour due to the use of table lookups. It may not be safe to use this implementation in an environment where the attacker can observe the timing of encryption and decryption operations. Unless AES compatibility is required, it is recommended that the ChaCha stream cipher be used instead.

Reference: http://en.wikipedia.org/wiki/Advanced_Encryption_Standard

See also
ChaCha, AES128, AES192, AES256

Definition at line 42 of file AES.h.

Member Function Documentation

◆ blockSize()

size_t AESCommon::blockSize ( ) const
virtual

Size of an AES block in bytes.

Returns
Always returns 16.

Implements BlockCipher.

Definition at line 144 of file AESCommon.cpp.

◆ clear()

void AESCommon::clear ( )
virtual

Clears all security-sensitive state from this block cipher.

Security-sensitive information includes key schedules and any temporary state that is used by encryptBlock() or decryptBlock() which is stored in the object itself.

See also
setKey(), encryptBlock(), decryptBlock()

Implements BlockCipher.

Definition at line 332 of file AESCommon.cpp.

◆ decryptBlock()

void AESCommon::decryptBlock ( uint8_t *  output,
const uint8_t *  input 
)
virtual

Decrypts a single block using this cipher.

Parameters
outputThe output buffer to put the plaintext into. Must be at least blockSize() bytes in length.
inputThe input buffer to read the ciphertext from which is allowed to overlap with output. Must be at least blockSize() bytes in length.
See also
encryptBlock(), blockSize()

Implements BlockCipher.

Definition at line 301 of file AESCommon.cpp.

◆ encryptBlock()

void AESCommon::encryptBlock ( uint8_t *  output,
const uint8_t *  input 
)
virtual

Encrypts a single block using this cipher.

Parameters
outputThe output buffer to put the ciphertext into. Must be at least blockSize() bytes in length.
inputThe input buffer to read the plaintext from which is allowed to overlap with output. Must be at least blockSize() bytes in length.
See also
decryptBlock(), blockSize()

Implements BlockCipher.

Definition at line 270 of file AESCommon.cpp.


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