Botan  2.18.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_10_256 = 0x00000001, XMSS_SHA2_16_256 = 0x00000002, XMSS_SHA2_20_256 = 0x00000003, XMSS_SHA2_10_512 = 0x00000004,
  XMSS_SHA2_16_512 = 0x00000005, XMSS_SHA2_20_512 = 0x00000006, XMSS_SHAKE_10_256 = 0x00000007, XMSS_SHAKE_16_256 = 0x00000008,
  XMSS_SHAKE_20_256 = 0x00000009, XMSS_SHAKE_10_512 = 0x0000000a, XMSS_SHAKE_16_512 = 0x0000000b, XMSS_SHAKE_20_512 = 0x0000000c
}
 

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, Request for Comments: 8391 Release: May 2018. https://datatracker.ietf.org/doc/rfc8391/

Definition at line 23 of file xmss_parameters.h.

Member Enumeration Documentation

◆ xmss_algorithm_t

Enumerator
XMSS_SHA2_10_256 
XMSS_SHA2_16_256 
XMSS_SHA2_20_256 
XMSS_SHA2_10_512 
XMSS_SHA2_16_512 
XMSS_SHA2_20_512 
XMSS_SHAKE_10_256 
XMSS_SHAKE_16_256 
XMSS_SHAKE_20_256 
XMSS_SHAKE_10_512 
XMSS_SHAKE_16_512 
XMSS_SHAKE_20_512 

Definition at line 26 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 48 of file xmss_parameters.cpp.

50  {
51  }
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 53 of file xmss_parameters.cpp.

54  : m_oid(oid)
55  {
56  switch(oid)
57  {
58  case XMSS_SHA2_10_256:
59  m_element_size = 32;
60  m_w = 16;
61  m_len = 67;
62  m_tree_height = 10;
63  m_name = "XMSS-SHA2_10_256";
64  m_hash_name = "SHA-256";
65  m_strength = 256;
66  m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHA2_256;
67  break;
68  case XMSS_SHA2_16_256:
69  m_element_size = 32;
70  m_w = 16;
71  m_len = 67;
72  m_tree_height = 16;
73  m_name = "XMSS-SHA2_16_256";
74  m_hash_name = "SHA-256";
75  m_strength = 256;
76  m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHA2_256;
77  break;
78  case XMSS_SHA2_20_256:
79  m_element_size = 32;
80  m_w = 16;
81  m_len = 67;
82  m_tree_height = 20;
83  m_name = "XMSS-SHA2_20_256";
84  m_hash_name = "SHA-256";
85  m_strength = 256;
86  m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHA2_256;
87  break;
88  case XMSS_SHA2_10_512:
89  m_element_size = 64;
90  m_w = 16;
91  m_len = 131;
92  m_tree_height = 10;
93  m_name = "XMSS-SHA2_10_512";
94  m_hash_name = "SHA-512";
95  m_strength = 512;
96  m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHA2_512;
97  break;
98  case XMSS_SHA2_16_512:
99  m_element_size = 64;
100  m_w = 16;
101  m_len = 131;
102  m_tree_height = 16;
103  m_name = "XMSS-SHA2_16_512";
104  m_hash_name = "SHA-512";
105  m_strength = 512;
106  m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHA2_512;
107  break;
108  case XMSS_SHA2_20_512:
109  m_element_size = 64;
110  m_w = 16;
111  m_len = 131;
112  m_tree_height = 20;
113  m_name = "XMSS-SHA2_20_512";
114  m_hash_name = "SHA-512";
115  m_strength = 512;
116  m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHA2_512;
117  break;
118  case XMSS_SHAKE_10_256:
119  m_element_size = 32;
120  m_w = 16;
121  m_len = 67;
122  m_tree_height = 10;
123  m_name = "XMSS-SHAKE_10_256";
124  m_hash_name = "SHAKE-128(256)";
125  m_strength = 256;
126  m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHAKE_256;
127  break;
128  case XMSS_SHAKE_16_256:
129  m_element_size = 32;
130  m_w = 16;
131  m_len = 67;
132  m_tree_height = 16;
133  m_name = "XMSS-SHAKE_16_256";
134  m_hash_name = "SHAKE-128(256)";
135  m_strength = 256;
136  m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHAKE_256;
137  break;
138  case XMSS_SHAKE_20_256:
139  m_element_size = 32;
140  m_w = 16;
141  m_len = 67;
142  m_tree_height = 20;
143  m_name = "XMSS-SHAKE_20_256";
144  m_hash_name = "SHAKE-128(256)";
145  m_strength = 256;
146  m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHAKE_256;
147  break;
148  case XMSS_SHAKE_10_512:
149  m_element_size = 64;
150  m_w = 16;
151  m_len = 131;
152  m_tree_height = 10;
153  m_name = "XMSS-SHAKE_10_512";
154  m_hash_name = "SHAKE-256(512)";
155  m_strength = 512;
156  m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHAKE_512;
157  break;
158  case XMSS_SHAKE_16_512:
159  m_element_size = 64;
160  m_w = 16;
161  m_len = 131;
162  m_tree_height = 16;
163  m_name = "XMSS-SHAKE_16_512";
164  m_hash_name = "SHAKE-256(512)";
165  m_strength = 512;
166  m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHAKE_512;
167  break;
168  case XMSS_SHAKE_20_512:
169  m_element_size = 64;
170  m_w = 16;
171  m_len = 131;
172  m_tree_height = 20;
173  m_name = "XMSS-SHAKE_20_512";
174  m_hash_name = "SHAKE-256(512)";
175  m_strength = 512;
176  m_wots_oid = XMSS_WOTS_Parameters::ots_algorithm_t::WOTSP_SHAKE_512;
177  break;
178  default:
179  throw Not_Implemented("Algorithm id does not match any known XMSS algorithm id:" + std::to_string(oid));
180  break;
181  }
182  }
std::string to_string(const BER_Object &obj)
Definition: asn1_obj.cpp:213
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 67 of file xmss_parameters.h.

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

67 { 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 95 of file xmss_parameters.h.

96  {
97  return m_strength;
98  }

◆ hash_function_name()

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

Definition at line 55 of file xmss_parameters.h.

56  {
57  return m_hash_name;
58  }

◆ 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 50 of file xmss_parameters.h.

51  {
52  return m_name;
53  }

◆ 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 100 of file xmss_parameters.h.

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

◆ ots_oid()

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

Definition at line 86 of file xmss_parameters.h.

87  {
88  return m_wots_oid;
89  }

◆ tree_height()

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

Definition at line 72 of file xmss_parameters.h.

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

72 { 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 80 of file xmss_parameters.h.

80 { 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 19 of file xmss_parameters.cpp.

References XMSS_SHA2_10_256, XMSS_SHA2_10_512, XMSS_SHA2_16_256, XMSS_SHA2_16_512, XMSS_SHA2_20_256, XMSS_SHA2_20_512, XMSS_SHAKE_10_256, XMSS_SHAKE_10_512, XMSS_SHAKE_16_256, XMSS_SHAKE_16_512, XMSS_SHAKE_20_256, and XMSS_SHAKE_20_512.

20  {
21  if(param_set == "XMSS-SHA2_10_256")
22  { return XMSS_SHA2_10_256; }
23  if(param_set == "XMSS-SHA2_16_256")
24  { return XMSS_SHA2_16_256; }
25  if(param_set == "XMSS-SHA2_20_256")
26  { return XMSS_SHA2_20_256; }
27  if(param_set == "XMSS-SHA2_10_512")
28  { return XMSS_SHA2_10_512; }
29  if(param_set == "XMSS-SHA2_16_512")
30  { return XMSS_SHA2_16_512; }
31  if(param_set == "XMSS-SHA2_20_512")
32  { return XMSS_SHA2_20_512; }
33  if(param_set == "XMSS-SHAKE_10_256")
34  { return XMSS_SHAKE_10_256; }
35  if(param_set == "XMSS-SHAKE_16_256")
36  { return XMSS_SHAKE_16_256; }
37  if(param_set == "XMSS-SHAKE_20_256")
38  { return XMSS_SHAKE_20_256; }
39  if(param_set == "XMSS-SHAKE_10_512")
40  { return XMSS_SHAKE_10_512; }
41  if(param_set == "XMSS-SHAKE_16_512")
42  { return XMSS_SHAKE_16_512; }
43  if(param_set == "XMSS-SHAKE_20_512")
44  { return XMSS_SHAKE_20_512; }
45  throw Lookup_Error("Unknown XMSS algorithm param '" + param_set + "'");
46  }

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