Botan  1.11.15
Public Member Functions
Botan::Key_Length_Specification Class Reference

#include <key_spec.h>

List of all members.

Public Member Functions

 Key_Length_Specification (size_t keylen)
 Key_Length_Specification (size_t min_k, size_t max_k, size_t k_mod=1)
size_t keylength_multiple () const
size_t maximum_keylength () const
size_t minimum_keylength () const
Key_Length_Specification multiple (size_t n) const
bool valid_keylength (size_t length) const

Detailed Description

Represents the length requirements on an algorithm key

Definition at line 18 of file key_spec.h.


Constructor & Destructor Documentation

Constructor for fixed length keys

Parameters:
keylenthe supported key length

Definition at line 25 of file key_spec.h.

                                              :
         min_keylen(keylen),
         max_keylen(keylen),
         keylen_mod(1)
         {
         }
Botan::Key_Length_Specification::Key_Length_Specification ( size_t  min_k,
size_t  max_k,
size_t  k_mod = 1 
) [inline]

Constructor for variable length keys

Parameters:
min_kthe smallest supported key length
max_kthe largest supported key length
k_modthe number of bytes the key must be a multiple of

Definition at line 38 of file key_spec.h.

                                                 :
         min_keylen(min_k),
         max_keylen(max_k ? max_k : min_k),
         keylen_mod(k_mod)
         {
         }

Member Function Documentation

Returns:
key length multiple in bytes

Definition at line 77 of file key_spec.h.

         {
         return keylen_mod;
         }
Returns:
maximum key length in bytes

Definition at line 69 of file key_spec.h.

Referenced by Botan::SymmetricAlgorithm::maximum_keylength().

         {
         return max_keylen;
         }
Returns:
minimum key length in bytes

Definition at line 61 of file key_spec.h.

         {
         return min_keylen;
         }

Definition at line 82 of file key_spec.h.

Referenced by Botan::XTS_Mode::key_spec().

         {
         return Key_Length_Specification(n * min_keylen,
                                         n * max_keylen,
                                         n * keylen_mod);
         }
bool Botan::Key_Length_Specification::valid_keylength ( size_t  length) const [inline]
Parameters:
lengthis a key length in bytes
Returns:
true iff this length is a valid length for this algo

Definition at line 51 of file key_spec.h.

Referenced by Botan::Keyed_Transform::valid_keylength().

         {
         return ((length >= min_keylen) &&
                 (length <= max_keylen) &&
                 (length % keylen_mod == 0));
         }

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