Botan::SymmetricAlgorithm Class Reference

#include <sym_algo.h>

Inheritance diagram for Botan::SymmetricAlgorithm:

Botan::BlockCipher Botan::MessageAuthenticationCode Botan::StreamCipher Botan::AES Botan::AES_128_Intel Botan::AES_128_SSSE3 Botan::AES_192_Intel Botan::AES_192_SSSE3 Botan::AES_256_Intel Botan::AES_256_SSSE3 Botan::Blowfish Botan::Cascade_Cipher Botan::CAST_128 Botan::CAST_256 Botan::DES Botan::DESX Botan::GOST_28147_89 Botan::IDEA Botan::KASUMI Botan::Lion Botan::LubyRackoff Botan::MARS Botan::MISTY1 Botan::Noekeon Botan::RC2 Botan::RC5 Botan::RC6 Botan::SAFER_SK Botan::SEED Botan::Serpent Botan::Skipjack Botan::Square Botan::TEA Botan::TripleDES Botan::Twofish Botan::XTEA Botan::ANSI_X919_MAC Botan::CBC_MAC Botan::CMAC Botan::HMAC Botan::SSL3_MAC Botan::ARC4 Botan::CTR_BE Botan::OFB Botan::Salsa20 Botan::Turing Botan::WiderWake_41_BE

List of all members.

Public Member Functions

virtual std::string name () const =0
void set_key (const byte key[], u32bit length)
void set_key (const SymmetricKey &key)
 SymmetricAlgorithm (u32bit key_min, u32bit key_max, u32bit key_mod)
bool valid_keylength (u32bit length) const
virtual ~SymmetricAlgorithm ()

Public Attributes

const u32bit KEYLENGTH_MULTIPLE
const u32bit MAXIMUM_KEYLENGTH
const u32bit MINIMUM_KEYLENGTH


Detailed Description

This class represents a symmetric algorithm object.

Definition at line 20 of file sym_algo.h.


Constructor & Destructor Documentation

Botan::SymmetricAlgorithm::SymmetricAlgorithm ( u32bit  key_min,
u32bit  key_max,
u32bit  key_mod 
) [inline]

Construct a SymmetricAlgorithm.

Parameters:
key_min the minimum allowed key length
key_max the maximum allowed key length
key_mod any valid key length must be a multiple of this value

Definition at line 82 of file sym_algo.h.

00082                                                                          :
00083          MAXIMUM_KEYLENGTH(key_max ? key_max : key_min),
00084          MINIMUM_KEYLENGTH(key_min),
00085          KEYLENGTH_MULTIPLE(key_mod)
00086             {}

virtual Botan::SymmetricAlgorithm::~SymmetricAlgorithm (  )  [inline, virtual]

Definition at line 88 of file sym_algo.h.

00088 {}


Member Function Documentation

virtual std::string Botan::SymmetricAlgorithm::name (  )  const [pure virtual]

The name of the algorithm.

Returns:
name of the algorithm

Implemented in Botan::AES, Botan::AES_128, Botan::AES_192, Botan::AES_256, Botan::AES_128_Intel, Botan::AES_192_Intel, Botan::AES_256_Intel, Botan::AES_128_SSSE3, Botan::AES_192_SSSE3, Botan::AES_256_SSSE3, Botan::Blowfish, Botan::Cascade_Cipher, Botan::CAST_128, Botan::CAST_256, Botan::DES, Botan::TripleDES, Botan::DESX, Botan::GOST_28147_89, Botan::IDEA, Botan::KASUMI, Botan::Lion, Botan::LubyRackoff, Botan::MARS, Botan::MISTY1, Botan::Noekeon, Botan::RC2, Botan::RC5, Botan::RC6, Botan::SAFER_SK, Botan::SEED, Botan::Serpent, Botan::Skipjack, Botan::Square, Botan::TEA, Botan::Twofish, Botan::XTEA, Botan::CBC_MAC, Botan::CMAC, Botan::HMAC, Botan::MessageAuthenticationCode, Botan::SSL3_MAC, Botan::ANSI_X919_MAC, Botan::ARC4, Botan::CTR_BE, Botan::OFB, Botan::Salsa20, Botan::Turing, and Botan::WiderWake_41_BE.

Referenced by Botan::Algorithm_Factory::add_block_cipher(), Botan::Algorithm_Factory::add_stream_cipher(), Botan::ANSI_X919_MAC::ANSI_X919_MAC(), Botan::CMAC::CMAC(), Botan::OFB::name(), Botan::CTR_BE::name(), Botan::ANSI_X931_RNG::name(), Botan::Randpool::name(), Botan::PBE_PKCS5v20::name(), Botan::PBE_PKCS5v15::name(), Botan::CMAC::name(), Botan::CBC_MAC::name(), Botan::XTS_Decryption::name(), Botan::XTS_Encryption::name(), Botan::ECB_Decryption::name(), Botan::ECB_Encryption::name(), Botan::CBC_Decryption::name(), Botan::CBC_Encryption::name(), Botan::Lion::name(), Botan::Cascade_Cipher::name(), Botan::PBE_PKCS5v15::PBE_PKCS5v15(), Botan::PBE_PKCS5v20::PBE_PKCS5v20(), Botan::Randpool::Randpool(), Botan::StreamCipher::set_iv(), Botan::XTS_Decryption::XTS_Decryption(), and Botan::XTS_Encryption::XTS_Encryption().

void Botan::SymmetricAlgorithm::set_key ( const byte  key[],
u32bit  length 
) [inline]

Set the symmetric key of this object.

Parameters:
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]

bool Botan::SymmetricAlgorithm::valid_keylength ( u32bit  length  )  const [inline]

Check whether a given key length is valid for this algorithm.

Parameters:
length the key length to be checked.
Returns:
true if the key length is valid.

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          }


Member Data Documentation

A valid keylength is a multiple of this value.

Definition at line 37 of file sym_algo.h.

Referenced by Botan::keylength_multiple_of().

The maximum allowed key length.

Definition at line 27 of file sym_algo.h.

Referenced by Botan::max_keylength_of().

The minimal allowed key length.

Definition at line 32 of file sym_algo.h.

Referenced by Botan::min_keylength_of().


The documentation for this class was generated from the following file:

Generated on Fri Aug 13 16:21:00 2010 for Botan by  doxygen 1.5.8