Botan
2.1.0
Crypto and TLS for C++11
|
#include <stream_cipher.h>
Public Member Functions | |
virtual void | cipher (const uint8_t in[], uint8_t out[], size_t len)=0 |
void | cipher1 (uint8_t buf[], size_t len) |
virtual void | clear ()=0 |
virtual StreamCipher * | clone () const =0 |
template<typename Alloc > | |
void | decrypt (std::vector< uint8_t, Alloc > &inout) |
template<typename Alloc > | |
void | encipher (std::vector< uint8_t, Alloc > &inout) |
template<typename Alloc > | |
void | encrypt (std::vector< uint8_t, Alloc > &inout) |
virtual Key_Length_Specification | key_spec () const =0 |
size_t | maximum_keylength () const |
size_t | minimum_keylength () const |
virtual std::string | name () const =0 |
virtual std::string | provider () const |
virtual void | seek (uint64_t offset)=0 |
virtual void | set_iv (const uint8_t iv[], size_t iv_len)=0 |
void | set_key (const SymmetricKey &key) |
template<typename Alloc > | |
void | set_key (const std::vector< uint8_t, Alloc > &key) |
void | set_key (const uint8_t key[], size_t length) |
virtual bool | valid_iv_length (size_t iv_len) const |
bool | valid_keylength (size_t length) const |
virtual | ~StreamCipher ()=default |
Static Public Member Functions | |
static std::unique_ptr< StreamCipher > | create (const std::string &algo_spec, const std::string &provider="") |
static std::unique_ptr< StreamCipher > | create_or_throw (const std::string &algo_spec, const std::string &provider="") |
static std::vector< std::string > | providers (const std::string &algo_spec) |
Base class for all stream ciphers
Definition at line 19 of file stream_cipher.h.
|
virtualdefault |
|
pure virtual |
Encrypt or decrypt a message
in | the plaintext |
out | the byte array to hold the output, i.e. the ciphertext |
len | the length of both in and out in bytes |
Implemented in Botan::ChaCha, Botan::SHAKE_128_Cipher, Botan::CTR_BE, Botan::OFB, Botan::RC4, and Botan::Salsa20.
Referenced by Botan::SIV_Decryption::finish().
|
inline |
Encrypt or decrypt a message The message is encrypted/decrypted in place.
buf | the plaintext / ciphertext |
len | the length of buf in bytes |
Definition at line 65 of file stream_cipher.h.
Referenced by Botan::SIV_Encryption::finish().
|
pure virtualinherited |
Reset the state.
Implemented in Botan::GHASH, Botan::AES_256, Botan::Camellia_256, Botan::GOST_28147_89, Botan::AES_192, Botan::SHAKE_128_Cipher, Botan::ChaCha, Botan::Camellia_192, Botan::TripleDES, Botan::CTR_BE, Botan::OFB, Botan::Lion, Botan::Salsa20, Botan::Cascade_Cipher, Botan::Blowfish, Botan::Poly1305, Botan::Threefish_512, Botan::CMAC, Botan::GMAC, Botan::RC4, Botan::Noekeon, Botan::Serpent, Botan::CBC_MAC, Botan::AES_128, Botan::Camellia_128, Botan::CAST_128, Botan::CAST_256, Botan::DES, Botan::DESX, Botan::IDEA, Botan::KASUMI, Botan::MISTY1, Botan::SEED, Botan::Twofish, Botan::XTEA, Botan::HMAC, Botan::ANSI_X919_MAC, and Botan::SipHash.
Referenced by botan_block_cipher_clear(), botan_mac_clear(), and Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::clear().
|
pure virtual |
Implemented in Botan::SHAKE_128_Cipher, Botan::CTR_BE, Botan::OFB, Botan::Salsa20, Botan::RC4, and Botan::ChaCha.
|
static |
Create an instance based on a name If provider is empty then best available is chosen.
algo_spec | algorithm name |
provider | provider implementation to use |
Definition at line 41 of file stream_cipher.cpp.
References Botan::SCAN_Name::algo_name(), Botan::SCAN_Name::arg(), Botan::SCAN_Name::arg_as_integer(), Botan::SCAN_Name::arg_count(), BOTAN_UNUSED, and Botan::BlockCipher::create().
Referenced by Botan::BlockCipher::create(), create_or_throw(), Botan::get_cipher_mode(), and Botan::get_stream_cipher().
|
static |
Create an instance based on a name If provider is empty then best available is chosen.
algo_spec | algorithm name |
provider | provider implementation to use Throws a Lookup_Error if the algo/provider combination cannot be found |
Definition at line 123 of file stream_cipher.cpp.
References create().
Referenced by Botan::make_stream_cipher().
|
inline |
Decrypt a message in place The message is decrypted in place.
inout | the plaintext / ciphertext |
Definition at line 92 of file stream_cipher.h.
|
inline |
Encrypt a message The message is encrypted/decrypted in place.
inout | the plaintext / ciphertext |
Definition at line 74 of file stream_cipher.h.
|
inline |
Encrypt a message The message is encrypted in place.
inout | the plaintext / ciphertext |
Definition at line 83 of file stream_cipher.h.
|
pure virtualinherited |
Implemented in Botan::Block_Cipher_Fixed_Params< BS, KMIN, KMAX, KMOD >, Botan::Block_Cipher_Fixed_Params< 16, 32 >, Botan::Block_Cipher_Fixed_Params< 8, 1, 56 >, Botan::Block_Cipher_Fixed_Params< 8, 32 >, Botan::Block_Cipher_Fixed_Params< 16, 16 >, Botan::Block_Cipher_Fixed_Params< 8, 11, 16 >, Botan::Block_Cipher_Fixed_Params< 8, 16, 24, 8 >, Botan::Block_Cipher_Fixed_Params< 16, 16, 32, 8 >, Botan::Block_Cipher_Fixed_Params< 16, 4, 32, 4 >, Botan::Block_Cipher_Fixed_Params< 64, 64 >, Botan::Block_Cipher_Fixed_Params< 16, 24 >, Botan::Block_Cipher_Fixed_Params< 8, 16 >, Botan::Block_Cipher_Fixed_Params< 8, 8 >, Botan::Block_Cipher_Fixed_Params< 8, 24 >, Botan::GHASH, Botan::GMAC, Botan::SHAKE_128_Cipher, Botan::ChaCha, Botan::Lion, Botan::Poly1305, Botan::RC4, Botan::CTR_BE, Botan::OFB, Botan::CMAC, Botan::HMAC, Botan::ANSI_X919_MAC, Botan::Salsa20, Botan::CBC_MAC, Botan::SipHash, and Botan::Cascade_Cipher.
Referenced by Botan::CBC_Mode::key_spec(), Botan::XTS_Mode::key_spec(), and Botan::CFB_Mode::key_spec().
|
inlineinherited |
Definition at line 39 of file sym_algo.h.
|
inlineinherited |
Definition at line 47 of file sym_algo.h.
|
pure virtualinherited |
Implemented in Botan::GHASH, Botan::AES_256, Botan::Camellia_256, Botan::AES_192, Botan::GOST_28147_89, Botan::SHAKE_128_Cipher, Botan::ChaCha, Botan::Camellia_192, Botan::TripleDES, Botan::Lion, Botan::CTR_BE, Botan::OFB, Botan::Salsa20, Botan::Cascade_Cipher, Botan::Blowfish, Botan::Threefish_512, Botan::AES_128, Botan::IDEA, Botan::Serpent, Botan::GMAC, Botan::RC4, Botan::Noekeon, Botan::Camellia_128, Botan::CAST_128, Botan::CAST_256, Botan::DES, Botan::DESX, Botan::KASUMI, Botan::MISTY1, Botan::SEED, Botan::Twofish, Botan::XTEA, Botan::HMAC, Botan::Poly1305, Botan::ANSI_X919_MAC, Botan::CBC_MAC, Botan::CMAC, and Botan::SipHash.
Referenced by Botan::CBC_Mode::CBC_Mode(), Botan::XTS_Mode::name(), Botan::CFB_Mode::name(), Botan::CBC_Mode::name(), Botan::pbkdf2(), and Botan::XTS_Mode::XTS_Mode().
|
inlinevirtual |
Reimplemented in Botan::ChaCha.
Definition at line 123 of file stream_cipher.h.
|
static |
Definition at line 133 of file stream_cipher.cpp.
Referenced by Botan::get_stream_cipher_providers().
|
pure virtual |
Set the offset and the state used later to generate the keystream
offset | the offset where we begin to generate the keystream |
Implemented in Botan::ChaCha, Botan::CTR_BE, Botan::OFB, Botan::RC4, Botan::Salsa20, and Botan::SHAKE_128_Cipher.
|
pure virtual |
Resync the cipher using the IV
iv | the initialization vector |
iv_len | the length of the IV in bytes |
Implemented in Botan::SHAKE_128_Cipher, Botan::ChaCha, Botan::CTR_BE, Botan::OFB, Botan::RC4, and Botan::Salsa20.
Referenced by Botan::SIV_Mode::set_ctr_iv().
|
inlineinherited |
Set the symmetric key of this object.
key | the SymmetricKey to be set. |
Definition at line 66 of file sym_algo.h.
References Botan::OctetString::begin(), and Botan::OctetString::length().
Referenced by Botan::aont_package(), Botan::aont_unpackage(), botan_block_cipher_set_key(), botan_mac_set_key(), and Botan::pbkdf2().
|
inlineinherited |
Definition at line 72 of file sym_algo.h.
|
inlineinherited |
Set the symmetric key of this object.
key | the to be set as a byte array. |
length | in bytes of key param |
Definition at line 82 of file sym_algo.h.
|
inlinevirtual |
iv_len | the length of the IV in bytes |
Reimplemented in Botan::ChaCha, Botan::SHAKE_128_Cipher, Botan::CTR_BE, Botan::OFB, and Botan::Salsa20.
Definition at line 106 of file stream_cipher.h.
|
inlineinherited |
Check whether a given key length is valid for this algorithm.
length | the key length to be checked. |
Definition at line 57 of file sym_algo.h.
Referenced by Botan::aont_package(), and Botan::aont_unpackage().