Botan  2.7.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/types.h>
16 #include <botan/xmss_publickey.h>
17 #include <botan/xmss_common_ops.h>
18 #include <botan/pk_ops.h>
19 #include <botan/internal/xmss_signature.h>
20 
21 namespace Botan {
22 
23 /**
24  * Provides signature verification capabilities for Extended Hash-Based
25  * Signatures (XMSS).
26  **/
27  class XMSS_Verification_Operation final : public virtual PK_Ops::Verification,
28  public XMSS_Common_Ops
29  {
30  public:
32  const XMSS_PublicKey& public_key);
33 
34  bool is_valid_signature(const uint8_t sig[], size_t sig_len) override;
35 
36  void update(const uint8_t msg[], size_t msg_len) override;
37 
38  private:
39  /**
40  * Algorithm 13: "XMSS_rootFromSig"
41  * Computes a root node using an XMSS signature, a message and a seed.
42  *
43  * @param msg A message.
44  * @param sig The XMSS signature for msg.
45  * @param ards A XMSS tree address.
46  * @param seed A seed.
47  *
48  * @return An n-byte string holding the value of the root of a tree
49  * defined by the input parameters.
50  **/
51  secure_vector<uint8_t> root_from_signature(
52  const XMSS_Signature& sig,
53  const secure_vector<uint8_t>& msg,
54  XMSS_Address& ards,
55  const secure_vector<uint8_t>& seed);
56 
57  /**
58  * Algorithm 14: "XMSS_verify"
59  * Verifies a XMSS signature using the corresponding XMSS public key.
60  *
61  * @param sig A XMSS signature.
62  * @param msg The message signed with sig.
63  * @param pub_key the public key
64  *
65  * @return true if signature sig is valid for msg, false otherwise.
66  **/
67  bool verify(const XMSS_Signature& sig,
68  const secure_vector<uint8_t>& msg,
69  const XMSS_PublicKey& pub_key);
70 
71  XMSS_PublicKey m_pub_key;
72  secure_vector<uint8_t> m_msg_buf;
73  };
74 
75 }
76 
77 #endif
bool is_valid_signature(const uint8_t sig[], size_t sig_len) override
void update(const uint8_t msg[], size_t msg_len) override
Definition: alg_id.cpp:13
XMSS_Verification_Operation(const XMSS_PublicKey &public_key)
std::vector< T, secure_allocator< T > > secure_vector
Definition: secmem.h:88