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