Abstract base class for block ciphers. More...
#include <BlockCipher.h>
Public Member Functions | |
BlockCipher () | |
Constructs a block cipher. | |
virtual | ~BlockCipher () |
Destroys this block cipher object. More... | |
virtual size_t | blockSize () const =0 |
Size of a single block processed by this cipher, in bytes. 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... | |
virtual void | encryptBlock (uint8_t *output, const uint8_t *input)=0 |
Encrypts a single block using this cipher. More... | |
virtual void | decryptBlock (uint8_t *output, const uint8_t *input)=0 |
Decrypts a single block using this cipher. More... | |
virtual void | clear ()=0 |
Clears all security-sensitive state from this block cipher. More... | |
Abstract base class for block ciphers.
Block ciphers always operate in electronic codebook (ECB) mode. Higher-level classes such as CFB128 and CTR128 wrap the block cipher to create more useful classes for encryption and decryption of bulk data.
References: http://en.wikipedia.org/wiki/Block_cipher, http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Electronic_codebook_.28ECB.29
Definition at line 29 of file BlockCipher.h.
|
virtual |
Destroys this block cipher object.
Subclasses are responsible for clearing temporary key schedules and other buffers so as to avoid leaking sensitive information.
Definition at line 52 of file BlockCipher.cpp.
|
pure virtual |
Size of a single block processed by this cipher, in bytes.
|
pure 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.
Implemented in Skinny128_Tweaked, Skinny64_Tweaked, Mantis8, Skinny128, and Skinny64.
|
pure virtual |
Decrypts a single block using this cipher.
output | The output buffer to put the plaintext into. Must be at least blockSize() bytes in length. |
input | The input buffer to read the ciphertext from which is allowed to overlap with output. Must be at least blockSize() bytes in length. |
|
pure virtual |
Encrypts a single block using this cipher.
output | The output buffer to put the ciphertext into. Must be at least blockSize() bytes in length. |
input | The input buffer to read the plaintext from which is allowed to overlap with output. Must be at least blockSize() bytes in length. |
|
pure virtual |
Default size of the key for this block cipher, in bytes.
This value indicates the default, or recommended, size for the key.
Implemented in Skinny128_384_Tweaked, Skinny64_192_Tweaked, Skinny128_384, Skinny64_192, Skinny128_256_Tweaked, Skinny64_128_Tweaked, Skinny128_256, Skinny64_128, Skinny128_128, Skinny64_64, and Mantis8.
|
pure virtual |
Sets the key to use for future encryption and decryption operations.
key | The key to use. |
len | The length of the key. |
Use clear() or the destructor to remove the key and any other sensitive data from the object once encryption or decryption is complete.
Implemented in Skinny128_384_Tweaked, Skinny64_192_Tweaked, Skinny128_384, Skinny64_192, Skinny128_256_Tweaked, Skinny64_128_Tweaked, Skinny128_256, Skinny64_128, Skinny128_128, Skinny64_64, and Mantis8.