Botan  2.8.0
Crypto and TLS for C++11
Public Types | Public Member Functions | Static Public Member Functions | List of all members
Botan::XMSS_Parameters Class Reference

#include <xmss_parameters.h>

Public Types

enum  xmss_algorithm_t {
  XMSS_SHA2_256_W16_H10 = 0x01000001, XMSS_SHA2_256_W16_H16 = 0x02000002, XMSS_SHA2_256_W16_H20 = 0x03000003, XMSS_SHA2_512_W16_H10 = 0x04000004,
  XMSS_SHA2_512_W16_H16 = 0x05000005, XMSS_SHA2_512_W16_H20 = 0x06000006, XMSS_SHAKE128_W16_H10 = 0x07000007, XMSS_SHAKE128_W16_H16 = 0x08000008,
  XMSS_SHAKE128_W16_H20 = 0x09000009, XMSS_SHAKE256_W16_H10 = 0x0a00000a, XMSS_SHAKE256_W16_H16 = 0x0b00000b, XMSS_SHAKE256_W16_H20 = 0x0c00000c
}
 

Public Member Functions

size_t element_size () const
 
size_t estimated_strength () const
 
const std::string & hash_function_name () const
 
size_t len () const
 
const std::string & name () const
 
xmss_algorithm_t oid () const
 
bool operator== (const XMSS_Parameters &p) const
 
XMSS_WOTS_Parameters::ots_algorithm_t ots_oid () const
 
size_t tree_height () const
 
size_t wots_parameter () const
 
 XMSS_Parameters (const std::string &algo_name)
 
 XMSS_Parameters (xmss_algorithm_t oid)
 

Static Public Member Functions

static xmss_algorithm_t xmss_id_from_string (const std::string &algo_name)
 

Detailed Description

Descibes a signature method for XMSS, as defined in: [1] XMSS: Extended Hash-Based Signatures, draft-itrf-cfrg-xmss-hash-based-signatures-06 Release: July 2016. https://datatracker.ietf.org/doc/ draft-irtf-cfrg-xmss-hash-based-signatures/?include_text=1

Definition at line 24 of file xmss_parameters.h.

Member Enumeration Documentation

◆ xmss_algorithm_t

Enumerator
XMSS_SHA2_256_W16_H10 
XMSS_SHA2_256_W16_H16 
XMSS_SHA2_256_W16_H20 
XMSS_SHA2_512_W16_H10 
XMSS_SHA2_512_W16_H16 
XMSS_SHA2_512_W16_H20 
XMSS_SHAKE128_W16_H10 
XMSS_SHAKE128_W16_H16 
XMSS_SHAKE128_W16_H20 
XMSS_SHAKE256_W16_H10 
XMSS_SHAKE256_W16_H16 
XMSS_SHAKE256_W16_H20 

Definition at line 27 of file xmss_parameters.h.

Constructor & Destructor Documentation

◆ XMSS_Parameters() [1/2]

Botan::XMSS_Parameters::XMSS_Parameters ( const std::string &  algo_name)

Definition at line 49 of file xmss_parameters.cpp.

51  {
52  }
XMSS_Parameters(const std::string &algo_name)
static xmss_algorithm_t xmss_id_from_string(const std::string &algo_name)

◆ XMSS_Parameters() [2/2]

Botan::XMSS_Parameters::XMSS_Parameters ( xmss_algorithm_t  oid)

Definition at line 54 of file xmss_parameters.cpp.

55  : m_oid(oid)
56  {
57  switch(oid)
58  {
60  m_element_size = 32;
61  m_w = 16;
62  m_len = 67;
63  m_tree_height = 10;
64  m_name = "XMSS_SHA2-256_W16_H10";
65  m_hash_name = "SHA-256";
66  m_strength = 256;
67  m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHA2_256_W16;
68  break;
70  m_element_size = 32;
71  m_w = 16;
72  m_len = 67;
73  m_tree_height = 16;
74  m_name = "XMSS_SHA2-256_W16_H16";
75  m_hash_name = "SHA-256";
76  m_strength = 256;
77  m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHA2_256_W16;
78  break;
80  m_element_size = 32;
81  m_w = 16;
82  m_len = 67;
83  m_tree_height = 20;
84  m_name = "XMSS_SHA2-256_W16_H20";
85  m_hash_name = "SHA-256";
86  m_strength = 256;
87  m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHA2_256_W16;
88  break;
90  m_element_size = 64;
91  m_w = 16;
92  m_len = 131;
93  m_tree_height = 10;
94  m_name = "XMSS_SHA2-512_W16_H10";
95  m_hash_name = "SHA-512";
96  m_strength = 512;
97  m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHA2_512_W16;
98  break;
100  m_element_size = 64;
101  m_w = 16;
102  m_len = 131;
103  m_tree_height = 16;
104  m_name = "XMSS_SHA2-512_W16_H16";
105  m_hash_name = "SHA-512";
106  m_strength = 512;
107  m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHA2_512_W16;
108  break;
110  m_element_size = 64;
111  m_w = 16;
112  m_len = 131;
113  m_tree_height = 20;
114  m_name = "XMSS_SHA2-512_W16_H20";
115  m_hash_name = "SHA-512";
116  m_strength = 512;
117  m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHA2_512_W16;
118  break;
120  m_element_size = 32;
121  m_w = 16;
122  m_len = 67;
123  m_tree_height = 10;
124  m_name = "XMSS_SHAKE128_W16_H10";
125  m_hash_name = "SHAKE-128(256)";
126  m_strength = 256;
127  m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHAKE128_W16;
128  break;
130  m_element_size = 32;
131  m_w = 16;
132  m_len = 67;
133  m_tree_height = 16;
134  m_name = "XMSS_SHAKE128_W16_H16";
135  m_hash_name = "SHAKE-128(256)";
136  m_strength = 256;
137  m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHAKE128_W16;
138  break;
140  m_element_size = 32;
141  m_w = 16;
142  m_len = 67;
143  m_tree_height = 20;
144  m_name = "XMSS_SHAKE128_W16_H20";
145  m_hash_name = "SHAKE-128(256)";
146  m_strength = 256;
147  m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHAKE128_W16;
148  break;
150  m_element_size = 64;
151  m_w = 16;
152  m_len = 131;
153  m_tree_height = 10;
154  m_name = "XMSS_SHAKE256_W16_H10";
155  m_hash_name = "SHAKE-256(512)";
156  m_strength = 512;
157  m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHAKE256_W16;
158  break;
160  m_element_size = 64;
161  m_w = 16;
162  m_len = 131;
163  m_tree_height = 16;
164  m_name = "XMSS_SHAKE256_W16_H16";
165  m_hash_name = "SHAKE-256(512)";
166  m_strength = 512;
167  m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHAKE256_W16;
168  break;
170  m_element_size = 64;
171  m_w = 16;
172  m_len = 131;
173  m_tree_height = 20;
174  m_name = "XMSS_SHAKE256_W16_H20";
175  m_hash_name = "SHAKE-256(512)";
176  m_strength = 512;
177  m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHAKE256_W16;
178  break;
179  default:
180  throw Unsupported_Argument(
181  "Algorithm id does not match any XMSS algorithm id.");
182  break;
183  }
184  }
xmss_algorithm_t oid() const

Member Function Documentation

◆ element_size()

size_t Botan::XMSS_Parameters::element_size ( ) const
inline

Retrieves the uniform length of a message, and the size of each node. This correlates to XMSS parameter "n" defined in [1].

Returns
element length in bytes.

Definition at line 68 of file xmss_parameters.h.

Referenced by Botan::XMSS_Common_Ops::randomize_tree_hash(), Botan::XMSS_Signature_Operation::signature_length(), Botan::XMSS_PrivateKey::XMSS_PrivateKey(), Botan::XMSS_PublicKey::XMSS_PublicKey(), and Botan::XMSS_Signature::XMSS_Signature().

68 { return m_element_size; }

◆ estimated_strength()

size_t Botan::XMSS_Parameters::estimated_strength ( ) const
inline

Returns the estimated pre-quantum security level of the chosen algorithm.

Definition at line 96 of file xmss_parameters.h.

97  {
98  return m_strength;
99  }

◆ hash_function_name()

const std::string& Botan::XMSS_Parameters::hash_function_name ( ) const
inline

Definition at line 56 of file xmss_parameters.h.

57  {
58  return m_hash_name;
59  }

◆ len()

size_t Botan::XMSS_Parameters::len ( ) const
inline

◆ name()

const std::string& Botan::XMSS_Parameters::name ( ) const
inline
Returns
XMSS registry name for the chosen parameter set.

Definition at line 51 of file xmss_parameters.h.

52  {
53  return m_name;
54  }

◆ oid()

xmss_algorithm_t Botan::XMSS_Parameters::oid ( ) const
inline

◆ operator==()

bool Botan::XMSS_Parameters::operator== ( const XMSS_Parameters p) const
inline

Definition at line 101 of file xmss_parameters.h.

102  {
103  return m_oid == p.m_oid;
104  }

◆ ots_oid()

XMSS_WOTS_Parameters::ots_algorithm_t Botan::XMSS_Parameters::ots_oid ( ) const
inline

Definition at line 87 of file xmss_parameters.h.

88  {
89  return m_wots_oid;
90  }

◆ tree_height()

size_t Botan::XMSS_Parameters::tree_height ( ) const
inline
Returns
The height (number of levels - 1) of the tree

Definition at line 73 of file xmss_parameters.h.

Referenced by Botan::XMSS_Signature_Operation::signature_length(), and Botan::XMSS_Signature::XMSS_Signature().

73 { return m_tree_height; }

◆ wots_parameter()

size_t Botan::XMSS_Parameters::wots_parameter ( ) const
inline

The Winternitz parameter.

Returns
numeric base used for internal representation of data.

Definition at line 81 of file xmss_parameters.h.

81 { return m_w; }

◆ xmss_id_from_string()

XMSS_Parameters::xmss_algorithm_t Botan::XMSS_Parameters::xmss_id_from_string ( const std::string &  algo_name)
static

Definition at line 20 of file xmss_parameters.cpp.

References XMSS_SHA2_256_W16_H10, XMSS_SHA2_256_W16_H16, XMSS_SHA2_256_W16_H20, XMSS_SHA2_512_W16_H10, XMSS_SHA2_512_W16_H16, XMSS_SHA2_512_W16_H20, XMSS_SHAKE128_W16_H10, XMSS_SHAKE128_W16_H16, XMSS_SHAKE128_W16_H20, XMSS_SHAKE256_W16_H10, XMSS_SHAKE256_W16_H16, and XMSS_SHAKE256_W16_H20.

21  {
22  if(param_set == "XMSS_SHA2-256_W16_H10")
23  { return XMSS_SHA2_256_W16_H10; }
24  if(param_set == "XMSS_SHA2-256_W16_H16")
25  { return XMSS_SHA2_256_W16_H16; }
26  if(param_set == "XMSS_SHA2-256_W16_H20")
27  { return XMSS_SHA2_256_W16_H20; }
28  if(param_set == "XMSS_SHA2-512_W16_H10")
29  { return XMSS_SHA2_512_W16_H10; }
30  if(param_set == "XMSS_SHA2-512_W16_H16")
31  { return XMSS_SHA2_512_W16_H16; }
32  if(param_set == "XMSS_SHA2-512_W16_H20")
33  { return XMSS_SHA2_512_W16_H20; }
34  if(param_set == "XMSS_SHAKE128_W16_H10")
35  { return XMSS_SHAKE128_W16_H10; }
36  if(param_set == "XMSS_SHAKE128_W16_H16")
37  { return XMSS_SHAKE128_W16_H16; }
38  if(param_set == "XMSS_SHAKE128_W16_H20")
39  { return XMSS_SHAKE128_W16_H20; }
40  if(param_set == "XMSS_SHAKE256_W16_H10")
41  { return XMSS_SHAKE256_W16_H10; }
42  if(param_set == "XMSS_SHAKE256_W16_H16")
43  { return XMSS_SHAKE256_W16_H16; }
44  if(param_set == "XMSS_SHAKE256_W16_H20")
45  { return XMSS_SHAKE256_W16_H20; }
46  throw Lookup_Error("Unknown XMSS algorithm param '" + param_set + "'");
47  }

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