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);
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.
HSS_LMS_Params(std::vector< LMS_LMOTS_Params_Pair > lm_lmots_params)
Construct the HSS-LMS parameters from a vector LMS and LM-OTS 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.
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.
Signed_Pub_Key(LMS_Signature sig, LMS_PublicKey pub)
Constructor for a new sig-pubkey-pair.
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.
constexpr void unpoison(const T *p, size_t n)
constexpr void poison(const T *p, size_t n)
Strong< uint64_t, struct HSS_Sig_Idx_, EnableArithmeticWithPlainNumber > HSS_Sig_Idx
The index of a node within a specific LMS tree layer.
constexpr RT checked_cast_to(AT i)
Strong< std::vector< uint8_t >, struct LMS_Identifier_ > LMS_Identifier
The identifier of an LMS tree (I in RFC 8554)
Strong< secure_vector< uint8_t >, struct LMS_SEED_ > LMS_Seed
Seed of the LMS tree, used to generate the LM-OTS private keys.
Strong< uint32_t, struct HSS_Level_, EnableArithmeticWithPlainNumber > HSS_Level
The HSS layer in the HSS multi tree starting at 0 from the root.
Strong< uint32_t, struct LMS_Tree_Node_Idx_, EnableArithmeticWithPlainNumber > LMS_Tree_Node_Idx
The index of a node within a specific LMS tree layer.
std::vector< T, secure_allocator< T > > secure_vector