Botan  2.4.0
Crypto and TLS for C++11
xmss_wots_addressed_publickey.h
Go to the documentation of this file.
1 /**
2  * XMSS WOTS Addressed Public Key
3  * (C) 2016,2017 Matthias Gierlings
4  *
5  * Botan is released under the Simplified BSD License (see license.txt)
6  **/
7 
8 
9 #ifndef BOTAN_XMSS_WOTS_ADDRESSED_PUBLICKEY_H_
10 #define BOTAN_XMSS_WOTS_ADDRESSED_PUBLICKEY_H_
11 
12 #include <botan/xmss_address.h>
13 #include <botan/xmss_wots_publickey.h>
14 
15 namespace Botan {
16 
17 /**
18  * Wrapper class to pair a XMSS_WOTS_PublicKey with an XMSS Address. Since
19  * the PK_Ops::Verification interface does not allow an extra address
20  * parameter to be passed to the sign(RandomNumberGenerator&), the address
21  * needs to be stored together with the key and passed to the
22  * XMSS_WOTS_Verification_Operation() on creation.
23  **/
25  {
26  public:
28  : m_pub_key(public_key), m_adrs() {}
29 
31  const XMSS_Address& adrs)
32  : m_pub_key(public_key), m_adrs(adrs) {}
33 
35  : m_pub_key(std::move(public_key)), m_adrs() {}
36 
38  XMSS_Address&& adrs)
39  : m_pub_key(std::move(public_key)), m_adrs(std::move(adrs)) {}
40 
41  const XMSS_WOTS_PublicKey& public_key() const { return m_pub_key; }
43 
44  const XMSS_Address& address() const { return m_adrs; }
45  XMSS_Address& address() { return m_adrs; }
46 
47  std::string algo_name() const override
48  {
49  return m_pub_key.algo_name();
50  }
51 
53  {
55  }
56 
57  bool check_key(RandomNumberGenerator& rng, bool strong) const override
58  {
59  return m_pub_key.check_key(rng, strong);
60  }
61 
62  std::unique_ptr<PK_Ops::Verification>
63  create_verification_op(const std::string& params,
64  const std::string& provider) const override
65  {
66  return m_pub_key.create_verification_op(params, provider);
67  }
68 
69  OID get_oid() const override
70  {
71  return m_pub_key.get_oid();
72  }
73 
74  size_t estimated_strength() const override
75  {
77  }
78 
79  size_t key_length() const override
80  {
82  }
83 
84  std::vector<uint8_t> public_key_bits() const override
85  {
86  return m_pub_key.public_key_bits();
87  }
88 
89  protected:
92  };
93 
94 }
95 
96 #endif
std::vector< uint8_t > public_key_bits() const override
XMSS_WOTS_Addressed_PublicKey(const XMSS_WOTS_PublicKey &public_key)
Definition: bigint.h:635
std::unique_ptr< PK_Ops::Verification > create_verification_op(const std::string &params, const std::string &provider) const override
XMSS_WOTS_Addressed_PublicKey(XMSS_WOTS_PublicKey &&public_key, XMSS_Address &&adrs)
size_t estimated_strength() const override
bool check_key(RandomNumberGenerator &, bool) const override
virtual OID get_oid() const
Definition: pk_keys.cpp:51
std::vector< uint8_t > public_key_bits() const override
bool check_key(RandomNumberGenerator &rng, bool strong) const override
XMSS_WOTS_Addressed_PublicKey(const XMSS_WOTS_PublicKey &public_key, const XMSS_Address &adrs)
Definition: alg_id.cpp:13
XMSS_WOTS_Addressed_PublicKey(XMSS_WOTS_PublicKey &&public_key)
AlgorithmIdentifier algorithm_identifier() const override
virtual std::unique_ptr< PK_Ops::Verification > create_verification_op(const std::string &params, const std::string &provider) const
Definition: pk_keys.cpp:108
AlgorithmIdentifier algorithm_identifier() const override
const XMSS_WOTS_PublicKey & public_key() const
std::string algo_name() const override