Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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 **/
28 class XMSS_Verification_Operation
29 : public virtual PK_Ops::Verification,
30 public XMSS_Common_Ops
31 {
32 public:
33 XMSS_Verification_Operation(
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
Botan::XMSS_Common_Ops
Definition: xmss_common_ops.h:25
Botan::XMSS_Verification_Operation
Definition: xmss_verification_operation.h:28
Botan::XMSS_Verification_Operation::~XMSS_Verification_Operation
virtual ~XMSS_Verification_Operation()=default
Botan::XMSS_PublicKey
Definition: xmss_publickey.h:43
Botan::XMSS_Address
Definition: xmss_address.h:23
Botan::XMSS_Verification_Operation::is_valid_signature
virtual bool is_valid_signature(const uint8_t sig[], size_t sig_len) override
Definition: xmss_verification_operation.cpp:109
Botan::XMSS_Verification_Operation::update
void update(const uint8_t msg[], size_t msg_len) override
Definition: xmss_verification_operation.cpp:104
Botan::secure_vector
std::vector< T, secure_allocator< T >> secure_vector
Definition: secmem.h:121
Botan
Definition: alg_id.cpp:13
Botan::XMSS_Verification_Operation::XMSS_Verification_Operation
XMSS_Verification_Operation(const XMSS_PublicKey &public_key)
Definition: xmss_verification_operation.cpp:15
Botan::XMSS_Signature
Definition: xmss_signature.h:21
Botan::PK_Ops::Verification
Definition: pk_ops.h:64