Arduino Cryptography Library
Public Member Functions | List of all members
AESSmall256 Class Reference

AES block cipher with 256-bit keys and reduced memory usage. More...

#include <AES.h>

Inheritance diagram for AESSmall256:
AESTiny256 BlockCipher

Public Member Functions

 AESSmall256 ()
 Constructs an AES 256-bit block cipher with no initial key. More...
 
bool setKey (const uint8_t *key, size_t len)
 Sets the key to use for future encryption and decryption operations. 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 AESTiny256
 AESTiny256 ()
 Constructs an AES 256-bit block cipher with no initial key. More...
 
size_t blockSize () const
 Size of an AES block in bytes. More...
 
size_t keySize () const
 Size of a 256-bit AES key in bytes. More...
 
void encryptBlock (uint8_t *output, const uint8_t *input)
 Encrypts a single block using this cipher. More...
 
- Public Member Functions inherited from BlockCipher
 BlockCipher ()
 Constructs a block cipher.
 
virtual ~BlockCipher ()
 Destroys this block cipher object. More...
 

Detailed Description

AES block cipher with 256-bit keys and reduced memory usage.

This class differs from the AES256 class in that the RAM requirements are vastly reduced. The key schedule is expanded round by round instead of being generated and stored by setKey(). The performance of encryption and decryption is slightly less because of this.

This class is useful when RAM is at a premium and reduced encryption performance is not a hindrance to the application.

The companion AESTiny256 class uses even less RAM but only supports the encryptBlock() operation. Block cipher modes like CTR, EAX, and GCM do not need the decryptBlock() operation, so AESTiny256 may be a better option than AESSmall256 for many applications.

See also
AESTiny256, AES256

Definition at line 137 of file AES.h.

Constructor & Destructor Documentation

◆ AESSmall256()

AESSmall256::AESSmall256 ( )

Constructs an AES 256-bit block cipher with no initial key.

This constructor must be followed by a call to setKey() before the block cipher can be used for encryption or decryption.

Definition at line 308 of file AES256.cpp.

Member Function Documentation

◆ clear()

void AESSmall256::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()

Reimplemented from AESTiny256.

Definition at line 395 of file AES256.cpp.

◆ decryptBlock()

void AESSmall256::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()

Reimplemented from AESTiny256.

Definition at line 351 of file AES256.cpp.

◆ setKey()

bool AESSmall256::setKey ( const uint8_t *  key,
size_t  len 
)
virtual

Sets the key to use for future encryption and decryption operations.

Parameters
keyThe key to use.
lenThe length of the key.
Returns
Returns false if the key length is not supported, or the key is somehow "weak" and unusable by this cipher.

Use clear() or the destructor to remove the key and any other sensitive data from the object once encryption or decryption is complete.

See also
keySize(), clear()

Reimplemented from AESTiny256.

Definition at line 317 of file AES256.cpp.


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