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