/************************************************* * OFB Constructor * *************************************************/ OFB::OFB(const std::string& cipher_name, const SymmetricKey& key, const InitializationVector& iv) : BlockCipherMode(cipher_name, "OFB", block_size_of(cipher_name), 2) { set_key(key); set_iv(iv); }
/************************************************* * CTR-BE Constructor * *************************************************/ CTR_BE::CTR_BE(const std::string& cipher_name, const SymmetricKey& key, const InitializationVector& iv) : BlockCipherMode(cipher_name, "CTR-BE", block_size_of(cipher_name), 1) { set_key(key); set_iv(iv); }
/************************************************* * HMAC Constructor * *************************************************/ HMAC::HMAC(const std::string& hash_name) : MessageAuthenticationCode(output_length_of(hash_name), 1, 2*block_size_of(hash_name)), hash(get_hash(hash_name)) { if(hash->HASH_BLOCK_SIZE == 0) throw Invalid_Argument("HMAC cannot be used with " + hash->name()); i_key.create(hash->HASH_BLOCK_SIZE); o_key.create(hash->HASH_BLOCK_SIZE); }
/************************************************* * OFB Constructor * *************************************************/ OFB::OFB(const std::string& cipher_name) : BlockCipherMode(cipher_name, "OFB", block_size_of(cipher_name), 2) { }
/************************************************* * CTR-BE Constructor * *************************************************/ CTR_BE::CTR_BE(const std::string& cipher_name) : BlockCipherMode(cipher_name, "CTR-BE", block_size_of(cipher_name), 1) { }