Botan 3.6.1
Crypto and TLS for C&
|
The internal HSS-LMS private key. More...
#include <hss.h>
Public Member Functions | |
void | _const_time_poison () const |
void | _const_time_unpoison () const |
HSS_Sig_Idx | get_idx () const |
Get the idx of the next signature to generate. | |
LMS_PrivateKey | hss_derive_root_lms_private_key () const |
Create the HSS root LMS tree's LMS_PrivateKey using the HSS-LMS private key. | |
HSS_LMS_PrivateKeyInternal (const HSS_LMS_Params &hss_params, RandomNumberGenerator &rng) | |
Create an internal HSS-LMS private key. | |
const HSS_LMS_Params & | hss_params () const |
Returns the used HSS-LMS parameters. | |
void | set_idx (HSS_Sig_Idx idx) |
Set the idx of the next signature to generate. | |
std::vector< uint8_t > | sign (std::span< const uint8_t > msg) |
Create a HSS-LMS signature. | |
size_t | signature_size () const |
Returns the size in bytes of a signature created by this key. | |
secure_vector< uint8_t > | to_bytes () const |
Returns the key in its encoded format. | |
Static Public Member Functions | |
static std::shared_ptr< HSS_LMS_PrivateKeyInternal > | from_bytes_or_throw (std::span< const uint8_t > key_bytes) |
Parse a private HSS-LMS key. | |
The internal HSS-LMS private key.
Note that the format is not specified in the RFC 8554, and is Botan specific.
Botan::HSS_LMS_PrivateKeyInternal::HSS_LMS_PrivateKeyInternal | ( | const HSS_LMS_Params & | hss_params, |
RandomNumberGenerator & | rng ) |
Create an internal HSS-LMS private key.
hss_params | The HSS-LMS parameters for the key. |
rng | The rng to use. |
Definition at line 114 of file hss.cpp.
References Botan::LMS_IDENTIFIER_LEN, Botan::HSS_LMS_Params::params_at_level(), and Botan::RandomNumberGenerator::random_vec().
Referenced by from_bytes_or_throw().
|
inline |
Definition at line 197 of file hss.h.
|
inline |
Definition at line 199 of file hss.h.
|
static |
Parse a private HSS-LMS key.
key_bytes | The private key bytes to parse. |
Decoding_Error | If parsing the private key fails. |
Definition at line 120 of file hss.cpp.
References Botan::BufferSlicer::copy(), Botan::LMOTS_Params::create_or_throw(), Botan::LMS_Params::create_or_throw(), Botan::BufferSlicer::empty(), HSS_LMS_PrivateKeyInternal(), Botan::LMS_IDENTIFIER_LEN, Botan::load_be(), Botan::BufferSlicer::remaining(), and Botan::BufferSlicer::take().
Referenced by Botan::HSS_LMS_PrivateKey::HSS_LMS_PrivateKey().
|
inline |
Get the idx of the next signature to generate.
Definition at line 158 of file hss.h.
Referenced by to_bytes().
LMS_PrivateKey Botan::HSS_LMS_PrivateKeyInternal::hss_derive_root_lms_private_key | ( | ) | const |
Create the HSS root LMS tree's LMS_PrivateKey using the HSS-LMS private key.
We use the same generation as the reference implementation (https://github.com/cisco/hash-sigs) with SECRET_METHOD==2.
Definition at line 268 of file hss.cpp.
References hss_params(), and Botan::HSS_LMS_Params::params_at_level().
Referenced by Botan::HSS_LMS_PublicKeyInternal::create(), and sign().
|
inline |
Returns the used HSS-LMS parameters.
Definition at line 148 of file hss.h.
Referenced by Botan::HSS_LMS_PublicKeyInternal::create(), hss_derive_root_lms_private_key(), sign(), and to_bytes().
void Botan::HSS_LMS_PrivateKeyInternal::set_idx | ( | HSS_Sig_Idx | idx | ) |
Set the idx of the next signature to generate.
Note that creating two signatures with the same index is insecure. The index must be lower than hss_params().max_sig_count().
Definition at line 187 of file hss.cpp.
std::vector< uint8_t > Botan::HSS_LMS_PrivateKeyInternal::sign | ( | std::span< const uint8_t > | msg | ) |
Create a HSS-LMS signature.
See RFC 8554 6.2 - Algorithm 8.
For each signature creation the hypertree is computed once again, so no data is stored between multiple signatures. However, storing data between multiple signatures could be an optimization if applications create multiple signatures in one go.
msg | The message to sign. |
Definition at line 221 of file hss.cpp.
References Botan::BufferStuffer::append(), BOTAN_ASSERT_NOMSG, Botan::copy_mem(), Botan::BufferStuffer::full(), Botan::detail::Strong_Base< T >::get(), hss_derive_root_lms_private_key(), hss_params(), Botan::HSS_LMS_Params::L(), Botan::HSS_LMS_Params::LMS_LMOTS_Params_Pair::lmots_params(), Botan::HSS_LMS_Params::LMS_LMOTS_Params_Pair::lms_params(), Botan::BufferStuffer::next(), Botan::HSS_LMS_Params::params_at_level(), Botan::HSS_Signature::size(), Botan::LMS_PublicKey::size(), Botan::LMS_Signature::size(), and Botan::store_be().
|
inline |
secure_vector< uint8_t > Botan::HSS_LMS_PrivateKeyInternal::to_bytes | ( | ) | const |
Returns the key in its encoded format.
Definition at line 168 of file hss.cpp.
References Botan::BufferStuffer::append(), BOTAN_ASSERT_NOMSG, Botan::BufferStuffer::full(), get_idx(), hss_params(), Botan::HSS_LMS_Params::L(), Botan::HSS_LMS_Params::params_at_level(), and Botan::store_be().