23 #ifndef CRYPTO_CIPHER_h
24 #define CRYPTO_CIPHER_h
35 virtual size_t keySize()
const = 0;
36 virtual size_t ivSize()
const = 0;
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;
44 virtual void clear() = 0;
virtual size_t ivSize() const =0
Size of the initialization vector for this cipher, in bytes.
Abstract base class for stream ciphers.
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.
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 bool setIV(const uint8_t *iv, size_t len)=0
Sets the initialization vector to use for future encryption and decryption operations.
Cipher()
Constructs a new cipher object.
virtual ~Cipher()
Destroys this cipher object.
virtual size_t keySize() const =0
Default size of the key for this cipher, in bytes.
virtual void clear()=0
Clears all security-sensitive state from this cipher.
virtual bool setKey(const uint8_t *key, size_t len)=0
Sets the key to use for future encryption and decryption operations.