Botan 3.11.0
Crypto and TLS for C&
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_hash.h>
14#include <botan/internal/xmss_signature.h>
15
16namespace Botan {
17
18/**
19 * Provides signature verification capabilities for Extended Hash-Based
20 * Signatures (XMSS).
21 **/
23 public:
24 explicit XMSS_Verification_Operation(const XMSS_PublicKey& public_key);
25
26 bool is_valid_signature(std::span<const uint8_t> sign) override;
27
28 void update(std::span<const uint8_t> input) override;
29
30 std::string hash_function() const override { return m_hash.hash_function(); }
31
32 private:
33 /**
34 * Algorithm 13: "XMSS_rootFromSig"
35 * Computes a root node using an XMSS signature, a message and a seed.
36 *
37 * @param msg A message.
38 * @param sig The XMSS signature for msg.
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(const XMSS_Signature& sig,
45 const secure_vector<uint8_t>& msg,
46 const secure_vector<uint8_t>& seed);
47
48 /**
49 * Algorithm 14: "XMSS_verify"
50 * Verifies a XMSS signature using the corresponding XMSS public key.
51 *
52 * @param sig A XMSS signature.
53 * @param msg The message signed with sig.
54 * @param pub_key the public key
55 *
56 * @return true if signature sig is valid for msg, false otherwise.
57 **/
58 bool verify(const XMSS_Signature& sig, const secure_vector<uint8_t>& msg, const XMSS_PublicKey& pub_key);
59
60 const XMSS_PublicKey m_pub_key;
61 XMSS_Hash m_hash;
62 secure_vector<uint8_t> m_msg_buf;
63};
64
65} // namespace Botan
66
67#endif
bool is_valid_signature(std::span< const uint8_t > sign) override
XMSS_Verification_Operation(const XMSS_PublicKey &public_key)
void update(std::span< const uint8_t > input) override
std::vector< T, secure_allocator< T > > secure_vector
Definition secmem.h:68