Botan 3.11.0
Crypto and TLS for C&
Botan::LMOTS_Signature Class Referencefinal

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 181 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 195 of file lm_ots.h.

195{ return m_algorithm_type; }

Referenced by 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 200 of file lm_ots.h.

200{ 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 241 of file lm_ots.cpp.

241 {
242 const size_t total_remaining_bytes = slicer.remaining();
243 // Alg. 6a. 1. (last 4 bytes) / Alg. 4b. 1.
244 if(total_remaining_bytes < sizeof(LMOTS_Algorithm_Type)) {
245 throw Decoding_Error("Too few signature bytes while parsing LMOTS signature.");
246 }
247 // Alg. 6a. 2.b. / Alg. 4b. 2.a.
249
250 // Alg. 6a. 2.d. / Alg. 4b. 2.c.
251 const LMOTS_Params params = LMOTS_Params::create_or_throw(algorithm_type);
252
253 if(total_remaining_bytes < size(params)) {
254 throw Decoding_Error("Too few signature bytes while parsing LMOTS signature.");
255 }
256
257 // Alg. 4b. 2.d.
258 auto C = slicer.copy_as_vector(params.n());
259 // Alg. 4b. 2.e.
260 auto m_y_buffer = slicer.copy_as_vector(params.p() * params.n());
261
262 return LMOTS_Signature(algorithm_type, std::move(C), std::move(m_y_buffer));
263}
static LMOTS_Params create_or_throw(LMOTS_Algorithm_Type type)
Create the LM-OTS parameters from a known algorithm type.
Definition lm_ots.cpp:106
static size_t size(const LMOTS_Params &params)
The expected size of the signature.
Definition lm_ots.h:210
LMOTS_Algorithm_Type algorithm_type() const
Returns the LM-OTS algorithm type.
Definition lm_ots.h:195
std::span< const uint8_t > C() const
The n-byte randomizer of the signature.
Definition lm_ots.h:200
LMOTS_Algorithm_Type
Enum of available LM-OTS algorithm types.
Definition lm_ots.h:68
constexpr auto load_be(ParamTs &&... params)
Definition loadstor.h:504

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

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

The expected size of the signature.

Definition at line 210 of file lm_ots.h.

210{ 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 205 of file lm_ots.h.

205{ 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: