|
Botan 3.11.0
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 |
| 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. | |
| HSS_Sig_Idx | remaining_operations (HSS_Sig_Idx 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. | |
| 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 123 of file hss.cpp.
References hss_params(), and Botan::LMS_IDENTIFIER_LEN.
Referenced by from_bytes_or_throw().
|
inline |
Definition at line 199 of file hss.h.
References Botan::CT::poison().
|
inline |
Definition at line 201 of file hss.h.
References Botan::CT::unpoison().
|
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 146 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().
| 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 287 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 149 of file hss.h.
Referenced by Botan::HSS_LMS_PublicKeyInternal::create(), hss_derive_root_lms_private_key(), HSS_LMS_PrivateKeyInternal(), sign(), and to_bytes().
| HSS_Sig_Idx Botan::HSS_LMS_PrivateKeyInternal::remaining_operations | ( | HSS_Sig_Idx | idx | ) | const |
Get the idx of the next signature to generate.
Definition at line 216 of file hss.cpp.
References Botan::detail::Strong_Base< T >::get(), Botan::Stateful_Key_Index_Registry::global(), and remaining_operations().
Referenced by remaining_operations().
| 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(). The index will never go backward (highest value wins).
Definition at line 220 of file hss.cpp.
References Botan::detail::Strong_Base< T >::get(), Botan::Stateful_Key_Index_Registry::global(), and Botan::Stateful_Key_Index_Registry::set_index_lower_bound().
| 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 240 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 195 of file hss.cpp.
References Botan::BufferStuffer::append(), BOTAN_ASSERT_NOMSG, Botan::Stateful_Key_Index_Registry::current_index(), Botan::BufferStuffer::full(), Botan::Stateful_Key_Index_Registry::global(), hss_params(), Botan::HSS_LMS_Params::L(), Botan::HSS_LMS_Params::params_at_level(), and Botan::store_be().