Botan 3.5.0
Crypto and TLS for C&
Botan::XMSS_Signature_Operation Class Referencefinal

#include <xmss_signature_operation.h>

Inheritance diagram for Botan::XMSS_Signature_Operation:

Public Member Functions

AlgorithmIdentifier algorithm_identifier () const override
std::string hash_function () const override
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.

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

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);
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

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()

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

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

serialized XMSS signature.

Implements Botan::PK_Ops::Signature.

Definition at line 74 of file xmss_signature_operation.cpp.

74 {
75 initialize();
76 secure_vector<uint8_t> signature(sign(m_hash.h_msg_final(), m_priv_key).bytes());
77 m_is_initialized = false;
78 return signature;
secure_vector< uint8_t > h_msg_final()
Definition xmss_hash.cpp:49
secure_vector< uint8_t > sign(RandomNumberGenerator &) override
std::vector< T, secure_allocator< T > > secure_vector
Definition secmem.h:61

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

Referenced by sign().

◆ signature_length()

size_t Botan::XMSS_Signature_Operation::signature_length ( ) const

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();
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 ( const uint8_t msg[],
size_t msg_len )

Add more data to the message currently being signed

msgthe message
msg_lenthe length of msg in bytes

Implements Botan::PK_Ops::Signature.

Definition at line 69 of file xmss_signature_operation.cpp.

69 {
70 initialize();
71 m_hash.h_msg_update({msg, msg_len});
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: