#include <x919_mac.h>

Public Member Functions | |
| ANSI_X919_MAC (BlockCipher *cipher) | |
| void | clear () |
| MessageAuthenticationCode * | clone () const |
| SecureVector< byte > | final () |
| void | final (byte out[]) |
| std::string | name () const |
| SecureVector< byte > | process (const std::string &in) |
| SecureVector< byte > | process (const MemoryRegion< byte > &in) |
| SecureVector< byte > | process (const byte in[], u32bit length) |
| void | set_key (const byte key[], u32bit length) |
| void | set_key (const SymmetricKey &key) |
| void | update (byte in) |
| void | update (const std::string &str) |
| void | update (const MemoryRegion< byte > &in) |
| void | update (const byte in[], u32bit length) |
| bool | valid_keylength (u32bit length) const |
| virtual bool | verify_mac (const byte in[], u32bit length) |
| ~ANSI_X919_MAC () | |
Public Attributes | |
| const u32bit | KEYLENGTH_MULTIPLE |
| const u32bit | MAXIMUM_KEYLENGTH |
| const u32bit | MINIMUM_KEYLENGTH |
| const u32bit | OUTPUT_LENGTH |
Definition at line 19 of file x919_mac.h.
| Botan::ANSI_X919_MAC::ANSI_X919_MAC | ( | BlockCipher * | cipher | ) |
| cipher | the underlying block cipher to use |
Definition at line 87 of file x919_mac.cpp.
References Botan::SymmetricAlgorithm::name().
Referenced by clone().
00087 : 00088 MessageAuthenticationCode(e_in->BLOCK_SIZE, 00089 e_in->MINIMUM_KEYLENGTH, 00090 2*e_in->MAXIMUM_KEYLENGTH, 00091 2*e_in->KEYLENGTH_MULTIPLE), 00092 e(e_in), d(e->clone()), position(0) 00093 { 00094 if(e->name() != "DES") 00095 throw Invalid_Argument("ANSI X9.19 MAC only supports DES"); 00096 }
| Botan::ANSI_X919_MAC::~ANSI_X919_MAC | ( | ) |
| void Botan::ANSI_X919_MAC::clear | ( | ) | [virtual] |
Reset the internal state of this object.
Implements Botan::MessageAuthenticationCode.
Definition at line 66 of file x919_mac.cpp.
References Botan::MemoryRegion< T >::clear(), and Botan::BlockCipher::clear().
| MessageAuthenticationCode * Botan::ANSI_X919_MAC::clone | ( | ) | const [virtual] |
Get a new object representing the same algorithm as *this
Implements Botan::MessageAuthenticationCode.
Definition at line 79 of file x919_mac.cpp.
References ANSI_X919_MAC(), and Botan::BlockCipher::clone().
00080 { 00081 return new ANSI_X919_MAC(e->clone()); 00082 }
| SecureVector<byte> Botan::BufferedComputation::final | ( | ) | [inline, inherited] |
Complete the computation and retrieve the final result.
Definition at line 72 of file buf_comp.h.
00073 { 00074 SecureVector<byte> output(OUTPUT_LENGTH); 00075 final_result(output); 00076 return output; 00077 }
| void Botan::BufferedComputation::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 65 of file buf_comp.h.
Referenced by Botan::LubyRackoff::decrypt_n(), Botan::Lion::decrypt_n(), Botan::X942_PRF::derive(), Botan::KDF2::derive(), Botan::KDF1::derive(), Botan::OpenPGP_S2K::derive_key(), Botan::PKCS5_PBKDF2::derive_key(), Botan::PKCS5_PBKDF1::derive_key(), Botan::EMSA2::EMSA2(), Botan::LubyRackoff::encrypt_n(), Botan::Lion::encrypt_n(), Botan::MAC_Filter::end_msg(), Botan::Hash_Filter::end_msg(), Botan::HandshakeHash::final(), Botan::HandshakeHash::final_ssl3(), Botan::MGF1::mask(), Botan::EMSA3::raw_data(), Botan::Randpool::reseed(), and Botan::HMAC_RNG::reseed().
| std::string Botan::ANSI_X919_MAC::name | ( | ) | const [virtual] |
Get the name of this algorithm.
Implements Botan::MessageAuthenticationCode.
Definition at line 74 of file x919_mac.cpp.
| SecureVector<byte> Botan::BufferedComputation::process | ( | const std::string & | in | ) | [inline, inherited] |
| SecureVector<byte> Botan::BufferedComputation::process | ( | const MemoryRegion< 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 98 of file buf_comp.h.
References Botan::MemoryRegion< T >::size().
| SecureVector<byte> Botan::BufferedComputation::process | ( | const byte | in[], | |
| u32bit | 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 86 of file buf_comp.h.
Referenced by Botan::Randpool::add_entropy(), Botan::EME1::EME1(), Botan::RTSS_Share::split(), and Botan::Cert_Extension::Subject_Key_ID::Subject_Key_ID().
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 57 of file sym_algo.h.
00058 { 00059 if(!valid_keylength(length)) 00060 throw Invalid_Key_Length(name(), length); 00061 key_schedule(key, length); 00062 }
| 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 49 of file sym_algo.h.
References Botan::OctetString::begin(), Botan::OctetString::length(), and Botan::SymmetricAlgorithm::set_key().
Referenced by Botan::aont_package(), Botan::aont_unpackage(), Botan::Lion::decrypt_n(), Botan::PKCS5_PBKDF2::derive_key(), Botan::ECB_Decryption::ECB_Decryption(), Botan::ECB_Encryption::ECB_Encryption(), Botan::Lion::encrypt_n(), Botan::HMAC_RNG::HMAC_RNG(), Botan::MAC_Filter::MAC_Filter(), Botan::HMAC_RNG::reseed(), Botan::SymmetricAlgorithm::set_key(), Botan::XTS_Decryption::set_key(), Botan::XTS_Encryption::set_key(), Botan::EAX_Base::set_key(), Botan::MAC_Filter::set_key(), and Botan::StreamCipher_Filter::StreamCipher_Filter().
00050 { set_key(key.begin(), key.length()); }
| void Botan::BufferedComputation::update | ( | byte | in | ) | [inline, inherited] |
| void Botan::BufferedComputation::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 48 of file buf_comp.h.
| void Botan::BufferedComputation::update | ( | const MemoryRegion< byte > & | in | ) | [inline, inherited] |
Add new input to process.
| in | the input to process as a MemoryRegion |
Definition at line 40 of file buf_comp.h.
References Botan::MemoryRegion< T >::size().
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::HMAC_RNG::add_entropy(), Botan::Comb4P::clear(), Botan::LubyRackoff::decrypt_n(), Botan::Lion::decrypt_n(), Botan::X942_PRF::derive(), Botan::KDF2::derive(), Botan::KDF1::derive(), Botan::OpenPGP_S2K::derive_key(), Botan::PKCS5_PBKDF2::derive_key(), Botan::PKCS5_PBKDF1::derive_key(), Botan::LubyRackoff::encrypt_n(), Botan::Lion::encrypt_n(), Botan::HandshakeHash::final(), Botan::HandshakeHash::final_ssl3(), Botan::MGF1::mask(), Botan::HMAC_RNG::reseed(), Botan::EAX_Base::start_msg(), Botan::EMSA3::update(), and Botan::MAC_Filter::write().
| bool Botan::SymmetricAlgorithm::valid_keylength | ( | u32bit | 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 69 of file sym_algo.h.
Referenced by Botan::aont_package(), Botan::aont_unpackage(), Botan::HMAC_RNG::HMAC_RNG(), Botan::Lion::Lion(), Botan::Randpool::Randpool(), Botan::XTS_Decryption::set_key(), Botan::XTS_Encryption::set_key(), Botan::EAX_Base::valid_keylength(), Botan::MAC_Filter::valid_keylength(), and Botan::valid_keylength_for().
00070 { 00071 return ((length >= MINIMUM_KEYLENGTH) && 00072 (length <= MAXIMUM_KEYLENGTH) && 00073 (length % KEYLENGTH_MULTIPLE == 0)); 00074 }
| bool Botan::MessageAuthenticationCode::verify_mac | ( | const byte | in[], | |
| u32bit | length | |||
| ) | [virtual, inherited] |
Verify a MAC.
| in | the MAC to verify as a byte array | |
| length | the length of param in |
Definition at line 15 of file mac.cpp.
References Botan::MemoryRegion< T >::size().
00016 { 00017 SecureVector<byte> our_mac = final(); 00018 if(our_mac.size() != length) 00019 return false; 00020 for(u32bit j = 0; j != length; ++j) 00021 if(mac[j] != our_mac[j]) 00022 return false; 00023 return true; 00024 }
const u32bit Botan::SymmetricAlgorithm::KEYLENGTH_MULTIPLE [inherited] |
A valid keylength is a multiple of this value.
Definition at line 37 of file sym_algo.h.
Referenced by Botan::keylength_multiple_of().
const u32bit Botan::SymmetricAlgorithm::MAXIMUM_KEYLENGTH [inherited] |
The maximum allowed key length.
Definition at line 27 of file sym_algo.h.
Referenced by Botan::max_keylength_of().
const u32bit Botan::SymmetricAlgorithm::MINIMUM_KEYLENGTH [inherited] |
The minimal allowed key length.
Definition at line 32 of file sym_algo.h.
Referenced by Botan::min_keylength_of().
const u32bit Botan::BufferedComputation::OUTPUT_LENGTH [inherited] |
The length of the output of this function in bytes.
Definition at line 27 of file buf_comp.h.
Referenced by Botan::choose_sig_format(), Botan::CMAC::CMAC(), Botan::Comb4P::Comb4P(), Botan::SHA_160::copy_out(), Botan::MD5::copy_out(), Botan::MD4::copy_out(), Botan::LubyRackoff::decrypt_n(), Botan::SSL3_PRF::derive(), Botan::OpenPGP_S2K::derive_key(), Botan::PKCS5_PBKDF2::derive_key(), Botan::PKCS5_PBKDF1::derive_key(), Botan::EAX_Base::EAX_Base(), Botan::EMSA3::encoding_of(), Botan::LubyRackoff::encrypt_n(), Botan::HMAC_RNG::HMAC_RNG(), Botan::MDx_HashFunction::MDx_HashFunction(), Botan::Tiger::name(), Botan::output_length_of(), Botan::Randpool::Randpool(), Botan::Tiger::Tiger(), and Botan::EMSA3::verify().
1.5.8