Botan 2.19.5 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_signature.h>
14
15 namespace Botan {
16
17/**
18 * Provides signature verification capabilities for Extended Hash-Based
19 * Signatures (XMSS).
20 **/
21 class XMSS_Verification_Operation final : public virtual PK_Ops::Verification
22 {
23 public:
24 XMSS_Verification_Operation(
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
Botan::PK_Ops::Verification
Definition: pk_ops.h:69
Botan::XMSS_Address
Definition: xmss_address.h:22
Botan::XMSS_Hash
Definition: xmss_hash.h:22
Botan::XMSS_PublicKey
Definition: xmss.h:31
Botan::XMSS_Signature
Definition: xmss_signature.h:21
Botan::XMSS_Verification_Operation
Definition: xmss_verification_operation.h:22
Botan::XMSS_Verification_Operation::XMSS_Verification_Operation
XMSS_Verification_Operation(const XMSS_PublicKey &public_key)
Definition: xmss_verification_operation.cpp:18
Botan::XMSS_Verification_Operation::update
void update(const uint8_t msg[], size_t msg_len) override
Definition: xmss_verification_operation.cpp:114
Botan::XMSS_Verification_Operation::is_valid_signature
bool is_valid_signature(const uint8_t sig[], size_t sig_len) override
Definition: xmss_verification_operation.cpp:119
final
int(* final)(unsigned char *, CTX *)
Definition: commoncrypto_hash.cpp:29
Botan
Definition: alg_id.cpp:13
Botan::secure_vector
std::vector< T, secure_allocator< T > > secure_vector
Definition: secmem.h:65