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