8 #ifndef BOTAN_XMSS_WOTS_H_
9 #define BOTAN_XMSS_WOTS_H_
11 #include <botan/asn1_obj.h>
12 #include <botan/exceptn.h>
13 #include <botan/pk_keys.h>
14 #include <botan/rng.h>
15 #include <botan/secmem.h>
16 #include <botan/xmss_hash.h>
65 const std::string&
name()
const
95 size_t len()
const {
return m_len; }
97 size_t len_1()
const {
return m_len_1; }
99 size_t len_2()
const {
return m_len_2; }
101 size_t lg_w()
const {
return m_lg_w; }
109 return m_oid == p.m_oid;
113 static const std::map<std::string, ots_algorithm_t> m_oid_name_lut;
116 std::string m_hash_name;
117 size_t m_element_size;
143 const wots_keysig_t& auth_path)
144 : m_ots_sig(ots_sig), m_auth_path(auth_path)
148 wots_keysig_t&& auth_path)
149 : m_ots_sig(
std::move(ots_sig)),
150 m_auth_path(
std::move(auth_path))
174 wots_keysig_t m_ots_sig;
175 wots_keysig_t m_auth_path;
249 const wots_keysig_t& key)
269 const wots_keysig_t& sig,
274 m_key(pub_key_from_signature(msg,
295 operator const wots_keysig_t& ()
const {
return m_key; }
301 operator wots_keysig_t& () {
return m_key; }
343 throw Not_Implemented(
"No AlgorithmIdentifier available for XMSS-WOTS.");
373 return !(*
this == key);
424 chain(x, start_idx, steps, adrs, public_seed,
m_hash);
445 wots_keysig_t pub_key_from_signature(
447 const wots_keysig_t& sig,
534 m_private_seed(private_seed)
622 wots_keysig_t&& in_key_data,
638 wots_keysig_t&& in_key_data,
688 return m_private_seed;
716 throw Not_Implemented(
"No AlgorithmIdentifier available for XMSS-WOTS.");
744 return generate(private_seed,
m_hash);
747 secure_vector<uint8_t> m_private_seed;
static ots_algorithm_t xmss_wots_id_from_string(const std::string ¶m_set)
TreeSignature(wots_keysig_t &&ots_sig, wots_keysig_t &&auth_path)
XMSS_WOTS_PrivateKey(XMSS_WOTS_Parameters::ots_algorithm_t oid, RandomNumberGenerator &rng)
XMSS_WOTS_PrivateKey(XMSS_WOTS_Parameters::ots_algorithm_t oid, const secure_vector< uint8_t > &public_seed, const secure_vector< uint8_t > &private_seed)
const std::string & name() const
void set_public_seed(secure_vector< uint8_t > &&public_seed)
const secure_vector< uint8_t > & private_seed() const
wots_keysig_t & authentication_path()
void set_public_seed(const secure_vector< uint8_t > &public_seed)
wots_keysig_t sign(const secure_vector< uint8_t > &msg, XMSS_Address &adrs)
wots_keysig_t operator[](const XMSS_Address &adrs)
int(* final)(unsigned char *, CTX *)
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_PrivateKey(XMSS_WOTS_Parameters::ots_algorithm_t oid, const secure_vector< uint8_t > &public_seed)
wots_keysig_t at(size_t i, XMSS_Hash &hash)
void generate_public_key(XMSS_WOTS_PublicKey &pub_key, wots_keysig_t &&in_key_data, XMSS_Address &adrs)
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)
AlgorithmIdentifier pkcs8_algorithm_identifier() const override
XMSS_WOTS_PublicKey(XMSS_WOTS_Parameters::ots_algorithm_t oid, RandomNumberGenerator &rng)
size_t estimated_strength() const override
size_t element_size() const
const secure_vector< uint8_t > & public_seed() const
bool check_key(RandomNumberGenerator &, bool) const override
void chain(secure_vector< uint8_t > &x, size_t start_idx, size_t steps, XMSS_Address &adrs, const secure_vector< uint8_t > &public_seed, XMSS_Hash &hash)
secure_vector< uint8_t > base_w(const secure_vector< uint8_t > &msg, size_t out_size) const
std::vector< T, secure_allocator< T >> secure_vector
XMSS_WOTS_PrivateKey(XMSS_WOTS_Parameters::ots_algorithm_t oid, const secure_vector< uint8_t > &public_seed, RandomNumberGenerator &rng)
const wots_keysig_t & ots_signature() const
std::vector< uint8_t > public_key_bits() const override
secure_vector< uint8_t > & operator[](size_t i)
wots_keysig_t generate_private_key(const secure_vector< uint8_t > &priv_seed)
size_t wots_parameter() const
XMSS_WOTS_PrivateKey(XMSS_WOTS_Parameters::ots_algorithm_t oid)
void set_private_seed(secure_vector< uint8_t > &&private_seed)
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)
XMSS_WOTS_PublicKey generate_public_key(XMSS_Address &adrs)
std::vector< secure_vector< uint8_t > > wots_keysig_t
size_t estimated_strength() const
wots_keysig_t operator[](size_t i)
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)
void append_checksum(secure_vector< uint8_t > &data)
XMSS_WOTS_Parameters(const std::string &algo_name)
void chain(secure_vector< uint8_t > &x, size_t start_idx, size_t steps, XMSS_Address &adrs, const secure_vector< uint8_t > &public_seed)
AlgorithmIdentifier algorithm_identifier() const override
bool operator==(const XMSS_WOTS_Parameters &p) const
secure_vector< uint8_t > private_key_bits() const override
void set_private_seed(const secure_vector< uint8_t > &private_seed)
wots_keysig_t & ots_signature()
wots_keysig_t & key_data()
size_t key_length() const override
ots_algorithm_t oid() const
XMSS_WOTS_PublicKey(XMSS_WOTS_Parameters::ots_algorithm_t oid, secure_vector< uint8_t > &&public_seed, wots_keysig_t &&key)
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 std::string & hash_function_name() const
const wots_keysig_t & authentication_path() const
std::string algo_name() const override