Botan 2.19.5 Crypto and TLS for C&

Public Member Functions | List of all members
Botan::Key_Length_Specification Class Referencefinal

`#include <sym_algo.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

## Detailed Description

Represents the length requirements on an algorithm key

Definition at line 19 of file sym_algo.h.

## Constructor & Destructor Documentation

## ◆ Key_Length_Specification() [1/2]

Botan::Key_Length_Specification::Key_Length_Specification | ( | size_t | keylen | ) |
| inline explicit

Constructor for fixed length keys

Parameters

  keylen | the supported key length

Definition at line 26 of file sym_algo.h.

26 :
27 m_min_keylen(keylen),
28 m_max_keylen(keylen),
29 m_keylen_mod(1)
30 {
31 }

## ◆ Key_Length_Specification() [2/2]

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_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 39 of file sym_algo.h.

41 :
42 m_min_keylen(min_k),
43 m_max_keylen(max_k ? max_k : min_k),
44 m_keylen_mod(k_mod)
45 {
46 }

## Member Function Documentation

## ◆ keylength_multiple()

size_t Botan::Key_Length_Specification::keylength_multiple | ( |  | ) | const
| inline

Returns
  key length multiple in bytes

Definition at line 78 of file sym_algo.h.

79 {
80 return m_keylen_mod;
81 }

## ◆ maximum_keylength()

size_t Botan::Key_Length_Specification::maximum_keylength | ( |  | ) | const
| inline

Returns
  maximum key length in bytes

Definition at line 70 of file sym_algo.h.

71 {
72 return m_max_keylen;
73 }

## ◆ minimum_keylength()

size_t Botan::Key_Length_Specification::minimum_keylength | ( |  | ) | const
| inline

Returns
  minimum key length in bytes

Definition at line 62 of file sym_algo.h.

63 {
64 return m_min_keylen;
65 }

Referenced by botan_cipher_get_keyspec().

## ◆ multiple()

Key_Length_Specification Botan::Key_Length_Specification::multiple | ( | size_t | n | ) | const
| inline

Definition at line 88 of file sym_algo.h.

89 {
90 return Key_Length_Specification(n * m_min_keylen,
91 n * m_max_keylen,
92 n * m_keylen_mod);
93 }
Botan::Key_Length_Specification::Key_Length_Specification
Key_Length_Specification(size_t keylen)
Definition: sym_algo.h:26

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

## ◆ valid_keylength()

bool Botan::Key_Length_Specification::valid_keylength | ( | size_t | length | ) | const
| inline

Parameters

  length | is a key length in bytes

Returns
  true iff this length is a valid length for this algo

Definition at line 52 of file sym_algo.h.

53 {
54 return ((length >= m_min_keylen) &&
55 (length <= m_max_keylen) &&
56 (length % m_keylen_mod == 0));
57 }

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

- src/lib/base/sym_algo.h