Botan
1.11.15
|
#include <mac.h>
Public Types | |
typedef SCAN_Name | Spec |
Public Member Functions | |
virtual void | clear ()=0 |
virtual MessageAuthenticationCode * | clone () const =0 |
void | final (byte out[]) |
secure_vector< byte > | final () |
template<typename Alloc > | |
void | final (std::vector< byte, Alloc > &out) |
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 size_t | output_length () const =0 |
secure_vector< byte > | process (const byte in[], size_t length) |
secure_vector< byte > | process (const secure_vector< byte > &in) |
secure_vector< byte > | process (const std::vector< byte > &in) |
secure_vector< byte > | process (const std::string &in) |
void | set_key (const SymmetricKey &key) |
template<typename Alloc > | |
void | set_key (const std::vector< byte, Alloc > &key) |
void | set_key (const byte key[], size_t length) |
void | update (const byte in[], size_t length) |
void | update (const secure_vector< byte > &in) |
void | update (const std::vector< byte > &in) |
void | update (const std::string &str) |
void | update (byte in) |
template<typename T > | |
void | update_be (const T in) |
bool | valid_keylength (size_t length) const |
virtual bool | verify_mac (const byte in[], size_t length) |
This class represents Message Authentication Code (MAC) objects.
virtual void Botan::SymmetricAlgorithm::clear | ( | ) | [pure virtual, inherited] |
Implemented in Botan::GHASH, Botan::AES_256_NI, Botan::AES_256, Botan::AES_256_SSSE3, Botan::Camellia_256, Botan::GOST_28147_89, Botan::AES_192_NI, Botan::AES_192, Botan::AES_192_SSSE3, Botan::Camellia_192, Botan::TripleDES, Botan::CTR_BE, Botan::OFB, Botan::Lion, Botan::ChaCha, Botan::Salsa20, Botan::Cascade_Cipher, Botan::RC2, Botan::Blowfish, Botan::Poly1305, Botan::AES_128_NI, Botan::Threefish_512, Botan::CMAC, Botan::CBC_MAC, Botan::AES_128, Botan::AES_128_SSSE3, Botan::Camellia_128, Botan::CAST_128, Botan::CAST_256, Botan::DES, Botan::DESX, Botan::IDEA, Botan::KASUMI, Botan::MARS, Botan::MISTY1, Botan::Noekeon, Botan::RC5, Botan::RC6, Botan::SAFER_SK, Botan::SEED, Botan::Serpent, Botan::TEA, Botan::Twofish, Botan::XTEA, Botan::RC4, Botan::HMAC, Botan::ANSI_X919_MAC, and Botan::SipHash.
Referenced by botan_mac_clear().
virtual MessageAuthenticationCode* Botan::MessageAuthenticationCode::clone | ( | ) | const [pure virtual] |
Get a new object representing the same algorithm as *this
Implemented in Botan::ANSI_X919_MAC, Botan::Poly1305, Botan::CMAC, Botan::HMAC, Botan::CBC_MAC, and Botan::SipHash.
void Botan::Buffered_Computation::final | ( | byte | out[] | ) | [inline, inherited] |
Complete the computation and retrieve the final result.
out | The byte array to be filled with the result. Must be of length output_length() |
Definition at line 90 of file buf_comp.h.
Referenced by botan_hash_final(), botan_mac_final(), Botan::McEliece_KEM_Decryptor::decrypt(), Botan::TLS::Session::decrypt(), Botan::McEliece_KEM_Encryptor::encrypt(), Botan::TLS::Session::encrypt(), Botan::mgf1_mask(), Botan::pbkdf2(), and Botan::TLS::write_record().
{ final_result(out); }
secure_vector<byte> Botan::Buffered_Computation::final | ( | ) | [inline, inherited] |
Complete the computation and retrieve the final result.
Definition at line 97 of file buf_comp.h.
{ secure_vector<byte> output(output_length()); final_result(&output[0]); return output; }
void Botan::Buffered_Computation::final | ( | std::vector< byte, Alloc > & | out | ) | [inline, inherited] |
Definition at line 105 of file buf_comp.h.
{ out.resize(output_length()); final_result(&out[0]); }
virtual Key_Length_Specification Botan::SymmetricAlgorithm::key_spec | ( | ) | const [pure virtual, inherited] |
Implemented in Botan::Block_Cipher_Fixed_Params< BS, KMIN, KMAX, KMOD >, Botan::Block_Cipher_Fixed_Params< 16, 32 >, Botan::Block_Cipher_Fixed_Params< 16, 16, 32, 4 >, 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< 8, 1, 32 >, Botan::Block_Cipher_Fixed_Params< 16, 24 >, Botan::Block_Cipher_Fixed_Params< 8, 16 >, Botan::Block_Cipher_Fixed_Params< 16, 1, 32 >, Botan::Block_Cipher_Fixed_Params< 8, 8 >, Botan::Block_Cipher_Fixed_Params< 8, 24 >, Botan::GHASH, Botan::Lion, Botan::Poly1305, Botan::CTR_BE, Botan::OFB, Botan::RC4, Botan::CMAC, Botan::HMAC, Botan::ANSI_X919_MAC, Botan::ChaCha, Botan::Salsa20, Botan::CBC_MAC, Botan::SipHash, and Botan::Cascade_Cipher.
Referenced by Botan::CBC_Mode::key_spec(), Botan::ECB_Mode::key_spec(), Botan::XTS_Mode::key_spec(), and Botan::CFB_Mode::key_spec().
size_t Botan::SymmetricAlgorithm::maximum_keylength | ( | ) | const [inline, inherited] |
Definition at line 36 of file sym_algo.h.
References Botan::Key_Length_Specification::maximum_keylength().
{ return key_spec().maximum_keylength(); }
size_t Botan::SymmetricAlgorithm::minimum_keylength | ( | ) | const [inline, inherited] |
Definition at line 44 of file sym_algo.h.
{ return key_spec().minimum_keylength(); }
virtual std::string Botan::MessageAuthenticationCode::name | ( | ) | const [pure virtual] |
Get the name of this algorithm.
Implements Botan::SymmetricAlgorithm.
Implemented in Botan::HMAC, Botan::Poly1305, Botan::ANSI_X919_MAC, Botan::CBC_MAC, Botan::CMAC, and Botan::SipHash.
Referenced by Botan::pbkdf2().
virtual size_t Botan::Buffered_Computation::output_length | ( | ) | const [pure virtual, inherited] |
Implemented in Botan::SHA_512_256, Botan::SHA_256, Botan::SHA_512, Botan::Skein_512, Botan::Comb4P, Botan::Keccak_1600, Botan::Poly1305, Botan::Parallel, Botan::HMAC, Botan::SipHash, Botan::CBC_MAC, Botan::ANSI_X919_MAC, Botan::GOST_34_11, Botan::HAS_160, Botan::SHA_224, Botan::CMAC, Botan::Adler32, Botan::CRC24, Botan::CRC32, Botan::MD2, Botan::MD4, Botan::MD5, Botan::RIPEMD_128, Botan::RIPEMD_160, Botan::SHA_160, Botan::SHA_384, Botan::Tiger, and Botan::Whirlpool.
Referenced by botan_hash_output_length(), botan_mac_output_length(), Botan::pbkdf2(), and Botan::MDx_HashFunction::write_count().
secure_vector<byte> Botan::Buffered_Computation::process | ( | const byte | in[], |
size_t | length | ||
) | [inline, inherited] |
Update and finalize computation. Does the same as calling update() and final() consecutively.
in | the input to process as a byte array |
length | the length of the byte array |
Definition at line 118 of file buf_comp.h.
Referenced by Botan::HMAC_RNG::HMAC_RNG(), Botan::RTSS_Share::split(), and Botan::Cert_Extension::Subject_Key_ID::Subject_Key_ID().
{ add_data(in, length); return final(); }
secure_vector<byte> Botan::Buffered_Computation::process | ( | const secure_vector< byte > & | in | ) | [inline, inherited] |
Update and finalize computation. Does the same as calling update() and final() consecutively.
in | the input to process |
Definition at line 130 of file buf_comp.h.
{ add_data(&in[0], in.size()); return final(); }
secure_vector<byte> Botan::Buffered_Computation::process | ( | const std::vector< byte > & | in | ) | [inline, inherited] |
Update and finalize computation. Does the same as calling update() and final() consecutively.
in | the input to process |
Definition at line 142 of file buf_comp.h.
{ add_data(&in[0], in.size()); return final(); }
secure_vector<byte> Botan::Buffered_Computation::process | ( | const std::string & | in | ) | [inline, inherited] |
void Botan::SymmetricAlgorithm::set_key | ( | const SymmetricKey & | key | ) | [inline, inherited] |
Set the symmetric key of this object.
key | the SymmetricKey to be set. |
Definition at line 63 of file sym_algo.h.
References Botan::OctetString::begin(), and Botan::OctetString::length().
Referenced by Botan::aont_package(), Botan::aont_unpackage(), botan_mac_set_key(), Botan::TLS::Session::decrypt(), Botan::TLS::Session::encrypt(), and Botan::pbkdf2().
{ set_key(key.begin(), key.length()); }
void Botan::SymmetricAlgorithm::set_key | ( | const std::vector< byte, Alloc > & | key | ) | [inline, inherited] |
Definition at line 69 of file sym_algo.h.
{ set_key(&key[0], key.size()); }
void Botan::SymmetricAlgorithm::set_key | ( | const byte | key[], |
size_t | length | ||
) | [inline, 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 79 of file sym_algo.h.
{ if(!valid_keylength(length)) throw Invalid_Key_Length(name(), length); key_schedule(key, length); }
void Botan::Buffered_Computation::update | ( | const byte | in[], |
size_t | length | ||
) | [inline, inherited] |
Add new input to process.
in | the input to process as a byte array |
length | of param in in bytes |
Definition at line 34 of file buf_comp.h.
Referenced by botan_hash_update(), botan_mac_update(), Botan::McEliece_KEM_Decryptor::decrypt(), Botan::TLS::Session::decrypt(), Botan::McEliece_KEM_Encryptor::encrypt(), Botan::TLS::Session::encrypt(), Botan::mgf1_mask(), Botan::pbkdf2(), and Botan::TLS::write_record().
{ add_data(in, length); }
void Botan::Buffered_Computation::update | ( | const secure_vector< byte > & | in | ) | [inline, inherited] |
Add new input to process.
in | the input to process as a secure_vector |
Definition at line 40 of file buf_comp.h.
{ add_data(&in[0], in.size()); }
void Botan::Buffered_Computation::update | ( | const std::vector< byte > & | in | ) | [inline, inherited] |
Add new input to process.
in | the input to process as a std::vector |
Definition at line 49 of file buf_comp.h.
{ add_data(&in[0], in.size()); }
void Botan::Buffered_Computation::update | ( | const std::string & | str | ) | [inline, inherited] |
Add new input to process.
str | the input to process as a std::string. Will be interpreted as a byte array based on the strings encoding. |
Definition at line 73 of file buf_comp.h.
{ add_data(reinterpret_cast<const byte*>(str.data()), str.size()); }
void Botan::Buffered_Computation::update | ( | byte | in | ) | [inline, inherited] |
Process a single byte.
in | the byte to process |
Definition at line 82 of file buf_comp.h.
{ add_data(&in, 1); }
void Botan::Buffered_Computation::update_be | ( | const T | in | ) | [inline, inherited] |
Add an integer in big-endian order
in | the value |
Definition at line 58 of file buf_comp.h.
References Botan::get_byte().
Referenced by Botan::mgf1_mask(), and Botan::pbkdf2().
bool Botan::SymmetricAlgorithm::valid_keylength | ( | size_t | length | ) | const [inline, inherited] |
Check whether a given key length is valid for this algorithm.
length | the key length to be checked. |
Definition at line 54 of file sym_algo.h.
Referenced by Botan::aont_package(), and Botan::aont_unpackage().
{ return key_spec().valid_keylength(length); }
bool Botan::MessageAuthenticationCode::verify_mac | ( | const byte | in[], |
size_t | length | ||
) | [virtual] |
Verify a MAC.
in | the MAC to verify as a byte array |
length | the length of param in |
Definition at line 16 of file mac.cpp.
References Botan::same_mem().