Botan 3.6.1
Crypto and TLS for C&
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

AlgorithmIdentifier algorithm_identifier () const override
 
std::string hash_function () const override
 
std::vector< uint8_t > sign (RandomNumberGenerator &) override
 
size_t signature_length () const override
 
void update (std::span< const uint8_t > input) 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 22 of file xmss_signature_operation.cpp.

22 :
23 m_priv_key(private_key),
24 m_hash(private_key.xmss_parameters()),
25 m_randomness(0),
26 m_leaf_idx(0),
27 m_is_initialized(false) {}

Member Function Documentation

◆ algorithm_identifier()

AlgorithmIdentifier Botan::XMSS_Signature_Operation::algorithm_identifier ( ) const
overridevirtual

Return an algorithm identifier associated with this signature scheme.

Default implementation throws an exception

Reimplemented from Botan::PK_Ops::Signature.

Definition at line 101 of file xmss_signature_operation.cpp.

101 {
102 return AlgorithmIdentifier(OID::from_string("XMSS"), AlgorithmIdentifier::USE_EMPTY_PARAM);
103}
static OID from_string(std::string_view str)
Definition asn1_oid.cpp:86

References Botan::OID::from_string(), and Botan::AlgorithmIdentifier::USE_EMPTY_PARAM.

◆ hash_function()

std::string Botan::XMSS_Signature_Operation::hash_function ( ) const
inlineoverridevirtual

Return the hash function being used by this signer

Implements Botan::PK_Ops::Signature.

Definition at line 46 of file xmss_signature_operation.h.

46{ return m_hash.hash_function(); }
std::string hash_function() const
Definition xmss_hash.h:34

References Botan::XMSS_Hash::hash_function().

◆ sign()

std::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 74 of file xmss_signature_operation.cpp.

74 {
75 initialize();
76 auto sig = sign(m_hash.h_msg_final(), m_priv_key).bytes();
77 m_is_initialized = false;
78 return sig;
79}
secure_vector< uint8_t > h_msg_final()
Definition xmss_hash.cpp:49
std::vector< uint8_t > sign(RandomNumberGenerator &) override

References Botan::XMSS_Hash::h_msg_final(), and sign().

Referenced by sign().

◆ signature_length()

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

Return an upper bound on the length of the output signature

Implements Botan::PK_Ops::Signature.

Definition at line 50 of file xmss_signature_operation.cpp.

50 {
51 const auto& params = m_priv_key.xmss_parameters();
52 return sizeof(uint64_t) + // size of leaf index
53 params.element_size() + params.len() * params.element_size() + params.tree_height() * params.element_size();
54}
size_t element_size() const
const XMSS_Parameters & xmss_parameters() const
Definition xmss.h:120

References Botan::XMSS_Parameters::element_size(), and Botan::XMSS_PublicKey::xmss_parameters().

◆ update()

void Botan::XMSS_Signature_Operation::update ( std::span< const uint8_t > input)
overridevirtual

Add more data to the message currently being signed

Parameters
inputthe input to be hashed/signed

Implements Botan::PK_Ops::Signature.

Definition at line 69 of file xmss_signature_operation.cpp.

69 {
70 initialize();
71 m_hash.h_msg_update(input);
72}
void h_msg_update(std::span< const uint8_t > data)
Definition xmss_hash.cpp:45

References Botan::XMSS_Hash::h_msg_update().


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