Botan  2.1.0
Crypto and TLS for C++11
xmss_verification_operation.h
Go to the documentation of this file.
1 /*
2  * XMSS Verification Operation
3  * (C) 2016 Matthias Gierlings
4  *
5  * Botan is released under the Simplified BSD License (see license.txt)
6  **/
7 
8 #ifndef BOTAN_XMSS_VERIFICATION_OPERATION_H__
9 #define BOTAN_XMSS_VERIFICATION_OPERATION_H__
10 
11 #include <array>
12 #include <cstddef>
13 #include <iterator>
14 #include <string>
15 #include <botan/assert.h>
16 #include <botan/types.h>
17 #include <botan/xmss_publickey.h>
18 #include <botan/xmss_common_ops.h>
19 #include <botan/pk_ops.h>
20 #include <botan/internal/xmss_signature.h>
21 
22 namespace Botan {
23 
24 /**
25  * Provides signature verification capabilities for Extended Hash-Based
26  * Signatures (XMSS).
27  **/
29  : public virtual PK_Ops::Verification,
30  public XMSS_Common_Ops
31  {
32  public:
34  const XMSS_PublicKey& public_key);
35 
36  virtual ~XMSS_Verification_Operation() = default;
37 
38  virtual bool is_valid_signature(const uint8_t sig[],
39  size_t sig_len) override;
40 
41  void update(const uint8_t msg[], size_t msg_len) override;
42 
43  private:
44  /**
45  * Algorithm 13: "XMSS_rootFromSig"
46  * Computes a root node using an XMSS signature, a message and a seed.
47  *
48  * @param msg A message.
49  * @param sig The XMSS signature for msg.
50  * @param adrs A XMSS tree address.
51  * @param seed A seed.
52  *
53  * @return An n-byte string holding the value of the root of a tree
54  * defined by the input parameters.
55  **/
56  secure_vector<uint8_t> root_from_signature(
57  const XMSS_Signature& sig,
58  const secure_vector<uint8_t>& msg,
59  XMSS_Address& ards,
60  const secure_vector<uint8_t>& seed);
61 
62  /**
63  * Algorithm 14: "XMSS_verify"
64  * Verifies a XMSS signature using the corresponding XMSS public key.
65  *
66  * @param sig A XMSS signature.
67  * @param msg The message signed with sig.
68  * @paeam pub_key
69  *
70  * @return true if signature sig is valid for msg, false otherwise.
71  **/
72  bool verify(const XMSS_Signature& sig,
73  const secure_vector<uint8_t>& msg,
74  const XMSS_PublicKey& pub_key);
75 
76  XMSS_PublicKey m_pub_key;
77  secure_vector<uint8_t> m_msg_buf;
78  };
79 
80 }
81 
82 #endif
virtual ~XMSS_Verification_Operation()=default
virtual bool is_valid_signature(const uint8_t sig[], size_t sig_len) override
void update(const uint8_t msg[], size_t msg_len) override
std::vector< T, secure_allocator< T >> secure_vector
Definition: secmem.h:121
Definition: alg_id.cpp:13
XMSS_Verification_Operation(const XMSS_PublicKey &public_key)