Botan 2.19.1
Crypto and TLS for C&
|
#include <shake_cipher.h>
Public Member Functions | |
void | cipher (const uint8_t in[], uint8_t out[], size_t length) override |
void | cipher1 (uint8_t buf[], size_t len) |
void | clear () override |
StreamCipher * | clone () const override |
template<typename Alloc > | |
void | decrypt (std::vector< uint8_t, Alloc > &inout) |
virtual size_t | default_iv_length () const |
template<typename Alloc > | |
void | encipher (std::vector< uint8_t, Alloc > &inout) |
template<typename Alloc > | |
void | encrypt (std::vector< uint8_t, Alloc > &inout) |
Key_Length_Specification | key_spec () const override |
size_t | maximum_keylength () const |
size_t | minimum_keylength () const |
std::string | name () const override |
virtual std::string | provider () const |
void | seek (uint64_t offset) override |
void | set_iv (const uint8_t iv[], size_t iv_len) override |
template<typename Alloc > | |
void | set_key (const std::vector< uint8_t, Alloc > &key) |
void | set_key (const SymmetricKey &key) |
void | set_key (const uint8_t key[], size_t length) |
SHAKE_128_Cipher () | |
virtual bool | valid_iv_length (size_t iv_len) const |
bool | valid_keylength (size_t length) const |
virtual void | write_keystream (uint8_t out[], size_t len) |
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) |
Protected Member Functions | |
void | verify_key_set (bool cond) const |
SHAKE-128 XOF presented as a stream cipher
Definition at line 21 of file shake_cipher.h.
Botan::SHAKE_128_Cipher::SHAKE_128_Cipher | ( | ) |
|
overridevirtual |
Produce more XOF output
Implements Botan::StreamCipher.
Definition at line 19 of file shake_cipher.cpp.
References Botan::copy_out_le(), Botan::SHA_3::permute(), Botan::SymmetricAlgorithm::verify_key_set(), and Botan::xor_buf().
|
inlineinherited |
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 78 of file stream_cipher.h.
Referenced by Botan::SIV_Encryption::finish().
|
overridevirtual |
Reset the state.
Implements Botan::SymmetricAlgorithm.
Definition at line 53 of file shake_cipher.cpp.
References Botan::zap().
|
overridevirtual |
Implements Botan::StreamCipher.
Definition at line 85 of file shake_cipher.cpp.
References SHAKE_128_Cipher().
|
staticinherited |
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 42 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::SCAN_Name::arg_count_between(), BOTAN_UNUSED, Botan::StreamCipher::cipher(), Botan::BlockCipher::create(), and Botan::StreamCipher::provider().
Referenced by Botan::Cipher_Mode::create(), Botan::BlockCipher::create(), and Botan::StreamCipher::create_or_throw().
|
staticinherited |
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 134 of file stream_cipher.cpp.
References Botan::StreamCipher::create(), and Botan::StreamCipher::provider().
Referenced by Botan::ChaCha_RNG::ChaCha_RNG(), Botan::Sodium::crypto_secretbox_detached(), Botan::Sodium::crypto_secretbox_open_detached(), Botan::Sodium::crypto_secretbox_xsalsa20poly1305(), Botan::Sodium::crypto_secretbox_xsalsa20poly1305_open(), Botan::Sodium::crypto_stream_chacha20(), Botan::Sodium::crypto_stream_chacha20_ietf(), Botan::Sodium::crypto_stream_chacha20_ietf_xor_ic(), Botan::Sodium::crypto_stream_chacha20_xor_ic(), Botan::Sodium::crypto_stream_xchacha20(), and Botan::Sodium::crypto_stream_xchacha20_xor_ic().
|
inlineinherited |
Decrypt a message in place The message is decrypted in place.
inout | the plaintext / ciphertext |
Definition at line 105 of file stream_cipher.h.
|
inlinevirtualinherited |
Return the default (preferred) nonce length If this function returns 0, then this cipher does not support nonces
Reimplemented in Botan::ChaCha, Botan::CTR_BE, Botan::OFB, and Botan::Salsa20.
Definition at line 119 of file stream_cipher.h.
|
inlineinherited |
Encrypt a message The message is encrypted/decrypted in place.
inout | the plaintext / ciphertext |
Definition at line 87 of file stream_cipher.h.
|
inlineinherited |
Encrypt a message The message is encrypted in place.
inout | the plaintext / ciphertext |
Definition at line 96 of file stream_cipher.h.
|
overridevirtual |
Implements Botan::SymmetricAlgorithm.
Definition at line 75 of file shake_cipher.cpp.
|
inlineinherited |
Definition at line 120 of file sym_algo.h.
|
inlineinherited |
Definition at line 128 of file sym_algo.h.
Referenced by botan_block_cipher_get_keyspec(), and botan_mac_get_keyspec().
|
overridevirtual |
Implements Botan::SymmetricAlgorithm.
Definition at line 80 of file shake_cipher.cpp.
Referenced by set_iv().
|
inlinevirtualinherited |
Reimplemented in Botan::ChaCha.
Definition at line 142 of file stream_cipher.h.
Referenced by Botan::StreamCipher::create(), and Botan::StreamCipher::create_or_throw().
|
staticinherited |
Definition at line 144 of file stream_cipher.cpp.
|
overridevirtual |
Seeking is not supported, this function will throw
Implements Botan::StreamCipher.
Definition at line 70 of file shake_cipher.cpp.
|
overridevirtual |
IV not supported, this function will throw unless iv_len == 0
Implements Botan::StreamCipher.
Definition at line 60 of file shake_cipher.cpp.
References name().
|
inlineinherited |
Definition at line 153 of file sym_algo.h.
|
inlineinherited |
Set the symmetric key of this object.
key | the SymmetricKey to be set. |
Definition at line 147 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_cipher_set_key(), botan_mac_set_key(), Botan::Sodium::crypto_stream_salsa20(), Botan::Sodium::crypto_stream_salsa20_xor_ic(), Botan::Sodium::crypto_stream_xsalsa20(), Botan::Sodium::crypto_stream_xsalsa20_xor_ic(), Botan::FPE::fe1_decrypt(), Botan::FPE::fe1_encrypt(), and Botan::Sodium::randombytes_buf_deterministic().
|
inherited |
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 17 of file sym_algo.cpp.
References Botan::SymmetricAlgorithm::name(), and Botan::SymmetricAlgorithm::valid_keylength().
|
inlinevirtualinherited |
iv_len | the length of the IV in bytes |
Reimplemented in Botan::ChaCha, Botan::CTR_BE, Botan::OFB, and Botan::Salsa20.
Definition at line 125 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 138 of file sym_algo.h.
Referenced by Botan::aont_package(), Botan::aont_unpackage(), and Botan::SymmetricAlgorithm::set_key().
|
inlineprotectedinherited |
Definition at line 171 of file sym_algo.h.
Referenced by Botan::ChaCha::cipher(), Botan::CTR_BE::cipher(), Botan::RC4::cipher(), Botan::Salsa20::cipher(), cipher(), Botan::AES_128::decrypt_n(), Botan::AES_192::decrypt_n(), Botan::AES_256::decrypt_n(), Botan::ARIA_128::decrypt_n(), Botan::ARIA_192::decrypt_n(), Botan::ARIA_256::decrypt_n(), Botan::Blowfish::decrypt_n(), Botan::Camellia_128::decrypt_n(), Botan::Camellia_192::decrypt_n(), Botan::Camellia_256::decrypt_n(), Botan::CAST_128::decrypt_n(), Botan::CAST_256::decrypt_n(), Botan::DES::decrypt_n(), Botan::TripleDES::decrypt_n(), Botan::DESX::decrypt_n(), Botan::GOST_28147_89::decrypt_n(), Botan::IDEA::decrypt_n(), Botan::KASUMI::decrypt_n(), Botan::Lion::decrypt_n(), Botan::MISTY1::decrypt_n(), Botan::Noekeon::decrypt_n(), Botan::SEED::decrypt_n(), Botan::Serpent::decrypt_n(), Botan::SHACAL2::decrypt_n(), Botan::SM4::decrypt_n(), Botan::Threefish_512::decrypt_n(), Botan::Twofish::decrypt_n(), Botan::XTEA::decrypt_n(), Botan::AES_128::encrypt_n(), Botan::AES_192::encrypt_n(), Botan::AES_256::encrypt_n(), Botan::ARIA_128::encrypt_n(), Botan::ARIA_192::encrypt_n(), Botan::ARIA_256::encrypt_n(), Botan::Blowfish::encrypt_n(), Botan::Camellia_128::encrypt_n(), Botan::Camellia_192::encrypt_n(), Botan::Camellia_256::encrypt_n(), Botan::CAST_128::encrypt_n(), Botan::CAST_256::encrypt_n(), Botan::DES::encrypt_n(), Botan::TripleDES::encrypt_n(), Botan::DESX::encrypt_n(), Botan::GOST_28147_89::encrypt_n(), Botan::IDEA::encrypt_n(), Botan::KASUMI::encrypt_n(), Botan::Lion::encrypt_n(), Botan::MISTY1::encrypt_n(), Botan::Noekeon::encrypt_n(), Botan::SEED::encrypt_n(), Botan::Serpent::encrypt_n(), Botan::SHACAL2::encrypt_n(), Botan::SM4::encrypt_n(), Botan::Threefish_512::encrypt_n(), Botan::Twofish::encrypt_n(), Botan::XTEA::encrypt_n(), Botan::OCB_Encryption::finish(), Botan::OCB_Decryption::finish(), Botan::GHASH::ghash_update(), Botan::CFB_Encryption::process(), Botan::CFB_Decryption::process(), Botan::ChaCha::seek(), Botan::CTR_BE::seek(), Botan::Salsa20::seek(), Botan::OCB_Mode::set_associated_data(), Botan::ChaCha::set_iv(), Botan::Salsa20::set_iv(), Botan::GHASH::update(), Botan::GHASH::update_associated_data(), and Botan::ChaCha::write_keystream().
|
inlinevirtualinherited |
Write keystream bytes to a buffer
out | the byte array to hold the keystream |
len | the length of out in bytes |
Reimplemented in Botan::ChaCha.
Definition at line 66 of file stream_cipher.h.
References Botan::clear_mem().
Referenced by Botan::Sodium::crypto_stream_salsa20(), and Botan::Sodium::crypto_stream_xsalsa20().