12#include <botan/asn1_obj.h>
14#include <botan/internal/ct_utils.h>
15#include <botan/internal/int_utils.h>
16#include <botan/internal/lms.h>
62 m_lms_params(std::move(p_lms_params)), m_lmots_params(std::move(p_lmots_params)) {}
72 explicit HSS_LMS_Params(std::vector<LMS_LMOTS_Params_Pair> lm_lmots_params);
103 HSS_Level L()
const {
return checked_cast_to<HSS_Level>(m_lms_lmots_params.size()); }
116 std::vector<LMS_LMOTS_Params_Pair> m_lms_lmots_params;
143 static std::shared_ptr<HSS_LMS_PrivateKeyInternal>
from_bytes_or_throw(std::span<const uint8_t> key_bytes);
180 std::vector<uint8_t>
sign(std::span<const uint8_t> msg);
234 const size_t m_sig_size;
262 static std::shared_ptr<HSS_LMS_PublicKeyInternal>
from_bytes_or_throw(std::span<const uint8_t> key_bytes);
265 m_L(L), m_top_lms_pub_key(std::move(top_lms_pub_key)) {}
270 std::vector<uint8_t>
to_bytes()
const;
358 static HSS_Signature from_bytes_or_throw(std::span<const uint8_t> sig_bytes);
391 m_signed_pub_keys(std::move(signed_pub_keys)), m_sig(std::move(sig)) {}
393 std::vector<Signed_Pub_Key> m_signed_pub_keys;
Represents a pair of LMS and LMOTS parameters associated with one LMS tree layer.
const LMS_Params & lms_params() const
The LMS parameters.
const LMOTS_Params & lmots_params() const
The LMOTS parameters.
LMS_LMOTS_Params_Pair(LMS_Params p_lms_params, LMOTS_Params p_lmots_params)
Construct a new params pair.
const LMS_LMOTS_Params_Pair & params_at_level(HSS_Level level) const
Returns the LMS an LM-OTS parameters at the specified level of the HSS tree.
HSS_Level L() const
Returns the number of layers the HSS tree has.
HSS_Sig_Idx max_sig_count() const
The maximal number of signatures allowed for these HSS parameters.
The internal HSS-LMS private key.
HSS_Sig_Idx get_idx() const
Get the idx of the next signature to generate.
void set_idx(HSS_Sig_Idx idx)
Set the idx of the next signature to generate.
void _const_time_poison() const
std::vector< uint8_t > sign(std::span< const uint8_t > msg)
Create a HSS-LMS signature.
static std::shared_ptr< HSS_LMS_PrivateKeyInternal > from_bytes_or_throw(std::span< const uint8_t > key_bytes)
Parse a private HSS-LMS key.
const HSS_LMS_Params & hss_params() const
Returns the used HSS-LMS parameters.
LMS_PrivateKey hss_derive_root_lms_private_key() const
Create the HSS root LMS tree's LMS_PrivateKey using the HSS-LMS private key.
secure_vector< uint8_t > to_bytes() const
Returns the key in its encoded format.
size_t signature_size() const
Returns the size in bytes of a signature created by this key.
void _const_time_unpoison() const
HSS_LMS_PrivateKeyInternal(const HSS_LMS_Params &hss_params, RandomNumberGenerator &rng)
Create an internal HSS-LMS private key.
The internal HSS-LMS public key.
static std::shared_ptr< HSS_LMS_PublicKeyInternal > from_bytes_or_throw(std::span< const uint8_t > key_bytes)
Parse a public HSS-LMS key.
bool verify_signature(std::span< const uint8_t > msg, const HSS_Signature &sig) const
Verify a HSS-LMS signature.
std::vector< uint8_t > to_bytes() const
Returns the key in its encoded format.
std::string algo_name() const
The algorithm name for HSS-LMS.
size_t size() const
Returns the size in bytes the key would have in its encoded format.
OID object_identifier() const
The object identifier for HSS-LMS.
void _const_time_unpoison() const
static HSS_LMS_PublicKeyInternal create(const HSS_LMS_PrivateKeyInternal &hss_sk)
Create the public HSS-LMS key from its private key.
HSS_LMS_PublicKeyInternal(HSS_Level L, LMS_PublicKey top_lms_pub_key)
AlgorithmIdentifier algorithm_identifier() const
The algorithm identifier for HSS-LMS.
const LMS_PublicKey & lms_pub_key() const
Returns the public LMS key of the top LMS tree.
A LMS public key signed by the HSS layer above it.
const LMS_Signature & signature() const
The signature of the public key.
const LMS_PublicKey & public_key() const
The signed public key.
const LMS_Signature & bottom_sig() const
Returns the LMS signature by the bottom layer of the signed message.
HSS_Level Nspk() const
Returns the number of signed public keys (Nspk = L-1).
const Signed_Pub_Key & signed_pub_key(HSS_Level layer) const
Returns the signed LMS key signed by a specific layer.
Representation of an LMS Private key.
Container for LMS Signature data.
int(* final)(unsigned char *, CTX *)
constexpr void unpoison(const T *p, size_t n)
constexpr void poison(const T *p, size_t n)
std::vector< T, secure_allocator< T > > secure_vector