23 #ifndef CRYPTO_CIPHER_h
24 #define CRYPTO_CIPHER_h
38 virtual bool setKey(
const uint8_t *key,
size_t len) = 0;
39 virtual bool setIV(
const uint8_t *iv,
size_t len) = 0;
41 virtual void encrypt(uint8_t *output,
const uint8_t *input,
size_t len) = 0;
42 virtual void decrypt(uint8_t *output,
const uint8_t *input,
size_t len) = 0;
Abstract base class for stream ciphers.
virtual bool setKey(const uint8_t *key, size_t len)=0
Sets the key to use for future encryption and decryption operations.
virtual bool setIV(const uint8_t *iv, size_t len)=0
Sets the initialization vector to use for future encryption and decryption operations.
virtual void clear()=0
Clears all security-sensitive state from this cipher.
virtual size_t keySize() const =0
Default size of the key for this cipher, in bytes.
Cipher()
Constructs a new cipher object.
virtual ~Cipher()
Destroys this cipher object.
virtual size_t ivSize() const =0
Size of the initialization vector for this cipher, in bytes.
virtual void decrypt(uint8_t *output, const uint8_t *input, size_t len)=0
Decrypts an input buffer and writes the plaintext to an output buffer.
virtual void encrypt(uint8_t *output, const uint8_t *input, size_t len)=0
Encrypts an input buffer and writes the ciphertext to an output buffer.