Botan  2.1.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 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  virtual std::string algo_name() const override
48  {
49  return m_pub_key.algo_name();
50  }
51 
52  virtual AlgorithmIdentifier algorithm_identifier() const override
53  {
55  }
56 
57  virtual bool check_key(RandomNumberGenerator& rng,
58  bool strong) const override
59  {
60  return m_pub_key.check_key(rng, strong);
61  }
62 
63  virtual std::unique_ptr<PK_Ops::Verification>
64  create_verification_op(const std::string& params,
65  const std::string& provider) const override
66  {
67  return m_pub_key.create_verification_op(params, provider);
68  }
69 
70  virtual OID get_oid() const override
71  {
72  return m_pub_key.get_oid();
73  }
74 
75  virtual size_t estimated_strength() const override
76  {
78  }
79 
80  virtual size_t key_length() const override
81  {
83  }
84 
85  virtual std::vector<uint8_t> public_key_bits() const override
86  {
87  return m_pub_key.public_key_bits();
88  }
89 
90  protected:
93  };
94 
95 }
96 
97 #endif
virtual size_t estimated_strength() const override
const XMSS_WOTS_PublicKey & public_key() const
virtual bool check_key(RandomNumberGenerator &, bool) const override
virtual std::unique_ptr< PK_Ops::Verification > create_verification_op(const std::string &params, const std::string &provider) const override
virtual std::vector< uint8_t > public_key_bits() const override
virtual AlgorithmIdentifier algorithm_identifier() const override
XMSS_WOTS_Addressed_PublicKey(const XMSS_WOTS_PublicKey &public_key)
Definition: bigint.h:619
XMSS_WOTS_Addressed_PublicKey(XMSS_WOTS_PublicKey &&public_key, XMSS_Address &&adrs)
virtual bool check_key(RandomNumberGenerator &rng, bool strong) const override
virtual OID get_oid() const
Definition: pk_keys.cpp:30
virtual std::vector< uint8_t > public_key_bits() const override
virtual AlgorithmIdentifier algorithm_identifier() const override
virtual std::string algo_name() const override
virtual std::string algo_name() 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)
virtual std::unique_ptr< PK_Ops::Verification > create_verification_op(const std::string &, const std::string &provider) const override
virtual size_t estimated_strength() const override