8 #ifndef BOTAN_XMSS_WOTS_PUBLICKEY_H__
9 #define BOTAN_XMSS_WOTS_PUBLICKEY_H__
14 #include <botan/alg_id.h>
15 #include <botan/asn1_oid.h>
16 #include <botan/assert.h>
17 #include <botan/exceptn.h>
18 #include <botan/pk_keys.h>
19 #include <botan/types.h>
20 #include <botan/xmss_wots_parameters.h>
21 #include <botan/xmss_address.h>
22 #include <botan/xmss_hash.h>
41 const wots_keysig_t& auth_path)
42 : m_ots_sig(ots_sig), m_auth_path(auth_path)
46 wots_keysig_t&& auth_path)
47 : m_ots_sig(
std::move(ots_sig)),
48 m_auth_path(
std::move(auth_path))
72 wots_keysig_t m_ots_sig;
73 wots_keysig_t m_auth_path;
86 m_hash(m_wots_params.hash_function_name()) {}
100 m_hash(m_wots_params.hash_function_name()),
101 m_public_seed(rng.random_vec(m_wots_params.element_size())) {}
112 : m_wots_params(oid),
113 m_hash(m_wots_params.hash_function_name()),
114 m_public_seed(public_seed) {}
129 : m_wots_params(oid),
130 m_hash(m_wots_params.hash_function_name()),
132 m_public_seed(
std::move(public_seed))
147 const wots_keysig_t& key)
148 : m_wots_params(oid),
149 m_hash(m_wots_params.hash_function_name()),
151 m_public_seed(public_seed)
167 const wots_keysig_t& sig,
170 : m_wots_params(oid),
171 m_hash(m_wots_params.hash_function_name()),
172 m_key(pub_key_from_signature(msg,
176 m_public_seed(public_seed)
193 operator const wots_keysig_t& ()
const {
return m_key; }
199 operator wots_keysig_t& () {
return m_key; }
207 m_public_seed = public_seed;
212 m_public_seed = std::move(public_seed);
226 m_key = std::move(key_data);
231 return m_wots_params;
236 return m_wots_params.name();
241 throw Not_Implemented(
"No AlgorithmIdentifier available for XMSS-WOTS.");
249 virtual std::unique_ptr<PK_Ops::Verification>
250 create_verification_op(
const std::string&,
251 const std::string& provider)
const override;
255 return m_wots_params.estimated_strength();
260 return m_wots_params.estimated_strength();
275 return !(*
this == key);
320 wots_keysig_t pub_key_from_signature(
322 const wots_keysig_t& sig,
virtual bool check_key(RandomNumberGenerator &, bool) const override
TreeSignature(wots_keysig_t &&ots_sig, wots_keysig_t &&auth_path)
virtual AlgorithmIdentifier algorithm_identifier() const override
void set_public_seed(secure_vector< uint8_t > &&public_seed)
wots_keysig_t & authentication_path()
void set_public_seed(const secure_vector< uint8_t > &public_seed)
TreeSignature(const wots_keysig_t &ots_sig, const wots_keysig_t &auth_path)
secure_vector< uint8_t > & public_seed()
secure_vector< uint8_t > m_public_seed
XMSS_WOTS_PublicKey(XMSS_WOTS_Parameters::ots_algorithm_t oid, secure_vector< uint8_t > public_seed)
XMSS_WOTS_PublicKey(XMSS_WOTS_Parameters::ots_algorithm_t oid, const secure_vector< uint8_t > &msg, const wots_keysig_t &sig, XMSS_Address &adrs, const secure_vector< uint8_t > &public_seed)
XMSS_WOTS_PublicKey(XMSS_WOTS_Parameters::ots_algorithm_t oid, RandomNumberGenerator &rng)
const secure_vector< uint8_t > & public_seed() const
std::vector< T, secure_allocator< T >> secure_vector
const wots_keysig_t & ots_signature() const
virtual size_t key_length() const override
secure_vector< uint8_t > & operator[](size_t i)
virtual std::vector< uint8_t > public_key_bits() const override
virtual std::string algo_name() const override
XMSS_WOTS_PublicKey(XMSS_WOTS_Parameters::ots_algorithm_t oid)
const secure_vector< uint8_t > & operator[](size_t i) const
bool operator!=(const XMSS_WOTS_PublicKey &key)
std::vector< secure_vector< uint8_t > > wots_keysig_t
void set_key_data(const wots_keysig_t &key_data)
const XMSS_WOTS_Parameters & wots_parameters() const
bool operator==(const XMSS_WOTS_PublicKey &key)
void set_key_data(wots_keysig_t &&key_data)
wots_keysig_t & ots_signature()
std::unique_ptr< HashFunction > m_hash
wots_keysig_t & key_data()
XMSS_WOTS_PublicKey(XMSS_WOTS_Parameters::ots_algorithm_t oid, secure_vector< uint8_t > &&public_seed, wots_keysig_t &&key)
const TPM_PrivateKey & m_key
virtual size_t estimated_strength() const override
const wots_keysig_t & key_data() const
XMSS_WOTS_PublicKey(XMSS_WOTS_Parameters::ots_algorithm_t oid, const secure_vector< uint8_t > &public_seed, const wots_keysig_t &key)
XMSS_WOTS_Parameters m_wots_params
const wots_keysig_t & authentication_path() const