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

AES block cipher with 128-bit keys and tiny memory usage. More...

#include <AES.h>

Inheritance diagram for AESTiny128:
BlockCipher AESSmall128

Public Member Functions

 AESTiny128 ()
 Constructs an AES 128-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 128-bit AES key in bytes. More...
 
bool setKey (const uint8_t *key, size_t len)
 Sets the key to use for future encryption and decryption operations. 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...
 

Detailed Description

AES block cipher with 128-bit keys and tiny memory usage.

This class differs from the AES128 class in the following ways:

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

The companion AESSmall128 class supports decryptBlock() at the cost of some additional memory and slower setKey() times.

See also
AESSmall128, AES128

Definition at line 153 of file AES.h.

Constructor & Destructor Documentation

◆ AESTiny128()

AESTiny128::AESTiny128 ( )

Constructs an AES 128-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 152 of file AES128.cpp.

Member Function Documentation

◆ blockSize()

size_t AESTiny128::blockSize ( ) const
virtual

Size of an AES block in bytes.

Returns
Always returns 16.

Implements BlockCipher.

Definition at line 165 of file AES128.cpp.

◆ clear()

void AESTiny128::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.

Reimplemented in AESSmall128.

Definition at line 240 of file AES128.cpp.

◆ decryptBlock()

void AESTiny128::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.

Reimplemented in AESSmall128.

Definition at line 235 of file AES128.cpp.

◆ encryptBlock()

void AESTiny128::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 189 of file AES128.cpp.

◆ keySize()

size_t AESTiny128::keySize ( ) const
virtual

Size of a 128-bit AES key in bytes.

Returns
Always returns 16.

Implements BlockCipher.

Definition at line 174 of file AES128.cpp.

◆ setKey()

bool AESTiny128::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()

Implements BlockCipher.

Reimplemented in AESSmall128.

Definition at line 179 of file AES128.cpp.


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