Exemple #1
0
/*************************************************
* 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);
   }
Exemple #2
0
/*************************************************
* 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);
   }
Exemple #3
0
/*************************************************
* 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);
   }
Exemple #4
0
/*************************************************
* OFB Constructor                                *
*************************************************/
OFB::OFB(const std::string& cipher_name) :
   BlockCipherMode(cipher_name, "OFB", block_size_of(cipher_name), 2)
   {
   }
Exemple #5
0
/*************************************************
* CTR-BE Constructor                             *
*************************************************/
CTR_BE::CTR_BE(const std::string& cipher_name) :
   BlockCipherMode(cipher_name, "CTR-BE", block_size_of(cipher_name), 1)
   {
   }