Botan  2.18.1
Crypto and TLS for C++11
Public Member Functions | List of all members
Botan::XMSS_Signature_Operation Class Referencefinal

#include <xmss_signature_operation.h>

Inheritance diagram for Botan::XMSS_Signature_Operation:
Botan::PK_Ops::Signature

Public Member Functions

secure_vector< uint8_t > sign (RandomNumberGenerator &) override
 
size_t signature_length () const override
 
void update (const uint8_t msg[], size_t msg_len) override
 
 XMSS_Signature_Operation (const XMSS_PrivateKey &private_key)
 

Detailed Description

Signature generation operation for Extended Hash-Based Signatures (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 28 of file xmss_signature_operation.h.

Constructor & Destructor Documentation

◆ XMSS_Signature_Operation()

Botan::XMSS_Signature_Operation::XMSS_Signature_Operation ( const XMSS_PrivateKey private_key)

Definition at line 21 of file xmss_signature_operation.cpp.

22  :
23  m_priv_key(private_key),
24  m_xmss_params(private_key.xmss_oid()),
25  m_hash(private_key.xmss_hash_function()),
26  m_randomness(0),
27  m_leaf_idx(0),
28  m_is_initialized(false)
29  {}

Member Function Documentation

◆ sign()

secure_vector< uint8_t > Botan::XMSS_Signature_Operation::sign ( RandomNumberGenerator )
overridevirtual

Creates an XMSS signature for the message provided through call to update().

Returns
serialized XMSS signature.

Implements Botan::PK_Ops::Signature.

Definition at line 87 of file xmss_signature_operation.cpp.

References Botan::XMSS_Hash::h_msg_final().

88  {
89  initialize();
90  secure_vector<uint8_t> signature(sign(m_hash.h_msg_final(),
91  m_priv_key).bytes());
92  m_is_initialized = false;
93  return signature;
94  }
secure_vector< uint8_t > h_msg_final()
Definition: xmss_hash.cpp:64
secure_vector< uint8_t > sign(RandomNumberGenerator &) override

◆ signature_length()

size_t Botan::XMSS_Signature_Operation::signature_length ( ) const
overridevirtual

Implements Botan::PK_Ops::Signature.

Definition at line 56 of file xmss_signature_operation.cpp.

References Botan::XMSS_Parameters::element_size(), Botan::XMSS_Parameters::len(), and Botan::XMSS_Parameters::tree_height().

57  {
58  return sizeof(uint64_t) + // size of leaf index
59  m_xmss_params.element_size() +
60  m_xmss_params.len() * m_xmss_params.element_size() +
61  m_xmss_params.tree_height() * m_xmss_params.element_size();
62  }
size_t tree_height() const
size_t element_size() const

◆ update()

void Botan::XMSS_Signature_Operation::update ( const uint8_t  msg[],
size_t  msg_len 
)
overridevirtual

Implements Botan::PK_Ops::Signature.

Definition at line 80 of file xmss_signature_operation.cpp.

References Botan::XMSS_Hash::h_msg_update().

81  {
82  initialize();
83  m_hash.h_msg_update(msg, msg_len);
84  }
void h_msg_update(const uint8_t data[], size_t size)
Definition: xmss_hash.cpp:59

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