Botan 3.6.1
Crypto and TLS for C&
|
#include <sym_algo.h>
Public Member Functions | |
virtual void | clear ()=0 |
virtual bool | has_keying_material () const =0 |
virtual Key_Length_Specification | key_spec () const =0 |
size_t | maximum_keylength () const |
size_t | minimum_keylength () const |
virtual std::string | name () const =0 |
void | set_key (const SymmetricKey &key) |
void | set_key (const uint8_t key[], size_t length) |
void | set_key (std::span< const uint8_t > key) |
bool | valid_keylength (size_t length) const |
virtual | ~SymmetricAlgorithm ()=default |
Protected Member Functions | |
void | assert_key_material_set () const |
void | assert_key_material_set (bool predicate) const |
This class represents a symmetric algorithm object.
Definition at line 77 of file sym_algo.h.
|
virtualdefault |
|
inlineprotected |
Definition at line 139 of file sym_algo.h.
References assert_key_material_set().
Referenced by assert_key_material_set(), Botan::Salsa20::cipher_bytes(), 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::DES::decrypt_n(), Botan::GOST_28147_89::decrypt_n(), Botan::IDEA::decrypt_n(), Botan::Kuznyechik::decrypt_n(), Botan::Lion::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::TripleDES::decrypt_n(), Botan::Twofish::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::DES::encrypt_n(), Botan::GOST_28147_89::encrypt_n(), Botan::IDEA::encrypt_n(), Botan::Kuznyechik::encrypt_n(), Botan::Lion::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::TripleDES::encrypt_n(), Botan::Twofish::encrypt_n(), Botan::GHASH::final(), Botan::GHASH::ghash_update(), Botan::ChaCha::seek(), Botan::CTR_BE::seek(), Botan::Salsa20::seek(), Botan::OCB_Mode::set_associated_data_n(), Botan::Salsa20::set_iv_bytes(), Botan::GHASH::update(), and Botan::GHASH::update_associated_data().
|
inlineprotected |
Definition at line 141 of file sym_algo.h.
|
pure virtual |
Reset the internal state. This includes not just the key, but any partial message that may have been in process.
Implemented in Botan::AES_128, Botan::AES_192, Botan::AES_256, Botan::ANSI_X919_MAC, Botan::ARIA_128, Botan::ARIA_192, Botan::ARIA_256, Botan::BLAKE2b, Botan::BLAKE2bMAC, Botan::Blowfish, Botan::Camellia_128, Botan::Camellia_192, Botan::Camellia_256, Botan::Cascade_Cipher, Botan::CAST_128, Botan::CBC_Mode, Botan::CCM_Mode, Botan::CFB_Mode, Botan::ChaCha20Poly1305_Mode, Botan::ChaCha, Botan::CMAC, Botan::CTR_BE, Botan::DES, Botan::EAX_Mode, Botan::FPE_FE1, Botan::GCM_Mode, Botan::GHASH, Botan::GMAC, Botan::GOST_28147_89, Botan::HMAC, Botan::IDEA, Botan::KMAC, Botan::Kuznyechik, Botan::Lion, Botan::Noekeon, Botan::OCB_Mode, Botan::OFB, Botan::Poly1305, Botan::RC4, Botan::Salsa20, Botan::SEED, Botan::Serpent, Botan::SHACAL2, Botan::SHAKE_Cipher, Botan::SipHash, Botan::SIV_Mode, Botan::SM4, Botan::Threefish_512, Botan::TLS::TLS_CBC_HMAC_AEAD_Mode, Botan::TripleDES, Botan::Twofish, and Botan::XTS_Mode.
Referenced by Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::clear().
|
pure virtual |
Implemented in Botan::AES_128, Botan::AES_192, Botan::AES_256, Botan::ANSI_X919_MAC, Botan::ARIA_128, Botan::ARIA_192, Botan::ARIA_256, Botan::BLAKE2b, Botan::BLAKE2bMAC, Botan::Blowfish, Botan::Camellia_128, Botan::Camellia_192, Botan::Camellia_256, Botan::Cascade_Cipher, Botan::CAST_128, Botan::CBC_Mode, Botan::CCM_Mode, Botan::CFB_Mode, Botan::ChaCha20Poly1305_Mode, Botan::ChaCha, Botan::CMAC, Botan::CTR_BE, Botan::DES, Botan::EAX_Mode, Botan::FPE_FE1, Botan::GCM_Mode, Botan::GHASH, Botan::GMAC, Botan::GOST_28147_89, Botan::HMAC, Botan::IDEA, Botan::KMAC, Botan::Kuznyechik, Botan::Lion, Botan::Noekeon, Botan::OCB_Mode, Botan::OFB, Botan::Poly1305, Botan::RC4, Botan::Salsa20, Botan::SEED, Botan::Serpent, Botan::SHACAL2, Botan::SHAKE_Cipher, Botan::SipHash, Botan::SIV_Mode, Botan::SM4, Botan::Threefish_512, Botan::TLS::TLS_CBC_HMAC_AEAD_Mode, Botan::TripleDES, Botan::Twofish, and Botan::XTS_Mode.
Referenced by Botan::TLS::TLS_CBC_HMAC_AEAD_Mode::has_keying_material().
|
pure virtual |
Implemented in Botan::ANSI_X919_MAC, Botan::BLAKE2b, Botan::BLAKE2bMAC, Botan::Block_Cipher_Fixed_Params< BS, KMIN, KMAX, KMOD, BaseClass >, Botan::Block_Cipher_Fixed_Params< 16, 16 >, Botan::Block_Cipher_Fixed_Params< 16, 16, 32, 8 >, Botan::Block_Cipher_Fixed_Params< 16, 24 >, Botan::Block_Cipher_Fixed_Params< 16, 32 >, Botan::Block_Cipher_Fixed_Params< 32, 16, 64, 4 >, Botan::Block_Cipher_Fixed_Params< 64, 64, 0, 1, Tweakable_Block_Cipher >, Botan::Block_Cipher_Fixed_Params< 8, 1, 56 >, Botan::Block_Cipher_Fixed_Params< 8, 11, 16 >, Botan::Block_Cipher_Fixed_Params< 8, 16 >, Botan::Block_Cipher_Fixed_Params< 8, 16, 24, 8 >, Botan::Block_Cipher_Fixed_Params< 8, 32 >, Botan::Block_Cipher_Fixed_Params< 8, 8 >, Botan::Cascade_Cipher, Botan::CBC_Mode, Botan::CCM_Mode, Botan::CFB_Mode, Botan::ChaCha20Poly1305_Mode, Botan::ChaCha, Botan::CMAC, Botan::CTR_BE, Botan::EAX_Mode, Botan::FPE_FE1, Botan::GCM_Mode, Botan::GHASH, Botan::GMAC, Botan::HMAC, Botan::KMAC, Botan::Lion, Botan::OCB_Mode, Botan::OFB, Botan::Poly1305, Botan::RC4, Botan::Salsa20, Botan::SHAKE_Cipher, Botan::SipHash, Botan::SIV_Mode, Botan::TLS::TLS_CBC_HMAC_AEAD_Mode, and Botan::XTS_Mode.
Referenced by Botan::CBC_Mode::key_spec(), Botan::CFB_Mode::key_spec(), and Botan::XTS_Mode::key_spec().
|
inline |
Definition at line 95 of file sym_algo.h.
|
inline |
Definition at line 100 of file sym_algo.h.
|
pure virtual |
Implemented in Botan::AES_128, Botan::AES_192, Botan::AES_256, Botan::ANSI_X919_MAC, Botan::ARIA_128, Botan::ARIA_192, Botan::ARIA_256, Botan::BLAKE2b, Botan::BLAKE2bMAC, Botan::Blowfish, Botan::Camellia_128, Botan::Camellia_192, Botan::Camellia_256, Botan::Cascade_Cipher, Botan::CAST_128, Botan::CBC_Mode, Botan::CCM_Mode, Botan::CFB_Mode, Botan::ChaCha20Poly1305_Mode, Botan::ChaCha, Botan::CMAC, Botan::CTR_BE, Botan::DES, Botan::EAX_Mode, Botan::FPE_FE1, Botan::GCM_Mode, Botan::GHASH, Botan::GMAC, Botan::GOST_28147_89, Botan::HMAC, Botan::IDEA, Botan::KMAC128, Botan::KMAC256, Botan::Kuznyechik, Botan::Lion, Botan::Noekeon, Botan::OCB_Mode, Botan::OFB, Botan::Poly1305, Botan::RC4, Botan::Salsa20, Botan::SEED, Botan::Serpent, Botan::SHACAL2, Botan::SHAKE_128_Cipher, Botan::SHAKE_256_Cipher, Botan::SipHash, Botan::SIV_Mode, Botan::SM4, Botan::Threefish_512, Botan::TLS::TLS_CBC_HMAC_AEAD_Mode, Botan::TripleDES, Botan::Twofish, and Botan::XTS_Mode.
Referenced by Botan::XTS_Mode::name(), set_key(), and Botan::MessageAuthenticationCode::start_msg().
|
inline |
Set the symmetric key of this object.
key | the SymmetricKey to be set. |
Definition at line 113 of file sym_algo.h.
References Botan::OctetString::begin(), Botan::OctetString::length(), and set_key().
Referenced by Botan::create_aes_row_generator(), 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(), Botan::Sphincs_Hash_Functions_Sha2::PRF_msg(), Botan::Sodium::randombytes_buf_deterministic(), and set_key().
|
inline |
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 126 of file sym_algo.h.
References set_key().
Referenced by set_key().
void Botan::SymmetricAlgorithm::set_key | ( | std::span< const uint8_t > | key | ) |
Set the symmetric key of this object.
key | the contiguous byte range to be set. |
Definition at line 17 of file sym_algo.cpp.
References name(), and valid_keylength().
|
inline |
Check whether a given key length is valid for this algorithm.
length | the key length to be checked. |
Definition at line 107 of file sym_algo.h.
Referenced by set_key().