Botan
1.11.15
|
#include <key_spec.h>
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 |
Represents the length requirements on an algorithm key
Definition at line 18 of file key_spec.h.
Botan::Key_Length_Specification::Key_Length_Specification | ( | size_t | keylen | ) | [inline] |
Constructor for fixed length keys
keylen | the 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
min_k | the smallest supported key length |
max_k | the largest supported key length |
k_mod | the 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) { }
size_t Botan::Key_Length_Specification::keylength_multiple | ( | ) | const [inline] |
Definition at line 77 of file key_spec.h.
{
return keylen_mod;
}
size_t Botan::Key_Length_Specification::maximum_keylength | ( | ) | const [inline] |
Definition at line 69 of file key_spec.h.
Referenced by Botan::SymmetricAlgorithm::maximum_keylength().
{
return max_keylen;
}
size_t Botan::Key_Length_Specification::minimum_keylength | ( | ) | const [inline] |
Definition at line 61 of file key_spec.h.
{
return min_keylen;
}
Key_Length_Specification Botan::Key_Length_Specification::multiple | ( | size_t | n | ) | const [inline] |
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] |
length | is a key length in bytes |
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));
}