Botan 3.6.1
Crypto and TLS for C&
Botan::LMOTS_Signature Class Reference

Representation of a LM-OTS signature. More...

#include <lm_ots.h>

Public Member Functions

LMOTS_Algorithm_Type algorithm_type () const
 Returns the LM-OTS algorithm type.
 
std::span< const uint8_t > C () const
 The n-byte randomizer of the signature.
 
StrongSpan< const LMOTS_Nodey (uint16_t chain_idx) const
 Returns the part of the signature for chain_idx.
 

Static Public Member Functions

static LMOTS_Signature from_bytes_or_throw (BufferSlicer &slicer)
 Parse a LM-OTS signature.
 
static size_t size (const LMOTS_Params &params)
 The expected size of the signature.
 

Detailed Description

Representation of a LM-OTS signature.

Definition at line 178 of file lm_ots.h.

Member Function Documentation

◆ algorithm_type()

LMOTS_Algorithm_Type Botan::LMOTS_Signature::algorithm_type ( ) const
inline

Returns the LM-OTS algorithm type.

Definition at line 192 of file lm_ots.h.

192{ return m_algorithm_type; }

Referenced by from_bytes_or_throw(), Botan::LMS_Signature::from_bytes_or_throw(), Botan::lmots_compute_pubkey_from_sig(), and Botan::LMS_PublicKey::verify_signature().

◆ C()

std::span< const uint8_t > Botan::LMOTS_Signature::C ( ) const
inline

The n-byte randomizer of the signature.

Definition at line 197 of file lm_ots.h.

197{ return m_C; }

Referenced by from_bytes_or_throw(), and Botan::lmots_compute_pubkey_from_sig().

◆ from_bytes_or_throw()

LMOTS_Signature Botan::LMOTS_Signature::from_bytes_or_throw ( BufferSlicer & slicer)
static

Parse a LM-OTS signature.

Parameters
slicerThe private key bytes to parse.
Returns
The LM-OTS signature.
Exceptions
Decoding_ErrorIf parsing the signature fails.

Definition at line 235 of file lm_ots.cpp.

235 {
236 size_t total_remaining_bytes = slicer.remaining();
237 // Alg. 6a. 1. (last 4 bytes) / Alg. 4b. 1.
238 if(total_remaining_bytes < sizeof(LMOTS_Algorithm_Type)) {
239 throw Decoding_Error("Too few signature bytes while parsing LMOTS signature.");
240 }
241 // Alg. 6a. 2.b. / Alg. 4b. 2.a.
243
244 // Alg. 6a. 2.d. / Alg. 4b. 2.c.
245 LMOTS_Params params = LMOTS_Params::create_or_throw(algorithm_type);
246
247 if(total_remaining_bytes < size(params)) {
248 throw Decoding_Error("Too few signature bytes while parsing LMOTS signature.");
249 }
250
251 // Alg. 4b. 2.d.
252 auto C = slicer.copy_as_vector(params.n());
253 // Alg. 4b. 2.e.
254 auto m_y_buffer = slicer.copy_as_vector(params.p() * params.n());
255
256 return LMOTS_Signature(algorithm_type, std::move(C), std::move(m_y_buffer));
257}
static LMOTS_Params create_or_throw(LMOTS_Algorithm_Type type)
Create the LM-OTS parameters from a known algorithm type.
Definition lm_ots.cpp:100
static size_t size(const LMOTS_Params &params)
The expected size of the signature.
Definition lm_ots.h:207
LMOTS_Algorithm_Type algorithm_type() const
Returns the LM-OTS algorithm type.
Definition lm_ots.h:192
std::span< const uint8_t > C() const
The n-byte randomizer of the signature.
Definition lm_ots.h:197
LMOTS_Algorithm_Type
Enum of available LM-OTS algorithm types.
Definition lm_ots.h:65
constexpr auto load_be(ParamTs &&... params)
Definition loadstor.h:530

References algorithm_type(), C(), Botan::BufferSlicer::copy_as_vector(), Botan::LMOTS_Params::create_or_throw(), Botan::load_be(), Botan::LMOTS_Params::n(), Botan::LMOTS_Params::p(), Botan::BufferSlicer::remaining(), size(), and Botan::BufferSlicer::take().

Referenced by Botan::LMS_Signature::from_bytes_or_throw().

◆ size()

static size_t Botan::LMOTS_Signature::size ( const LMOTS_Params & params)
inlinestatic

The expected size of the signature.

Definition at line 207 of file lm_ots.h.

207{ return 4 + params.n() * (params.p() + 1); }

References Botan::LMOTS_Params::n(), and Botan::LMOTS_Params::p().

Referenced by from_bytes_or_throw(), Botan::LMOTS_Private_Key::sign(), Botan::LMS_PrivateKey::sign_and_get_pk(), and Botan::LMS_Signature::size().

◆ y()

StrongSpan< const LMOTS_Node > Botan::LMOTS_Signature::y ( uint16_t chain_idx) const
inline

Returns the part of the signature for chain_idx.

Definition at line 202 of file lm_ots.h.

202{ return m_y.at(chain_idx); }

Referenced by Botan::lmots_compute_pubkey_from_sig().


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