Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

xmss_signature_operation.h
Go to the documentation of this file.
1 /*
2 * XMSS Signature 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_SIGNATURE_OPERATION_H__
9 #define BOTAN_XMSS_SIGNATURE_OPERATION_H__
10
11 #include <cstddef>
12 #include <string>
13 #include <botan/secmem.h>
14 #include <botan/types.h>
15 #include <botan/assert.h>
16 #include <botan/xmss_parameters.h>
17 #include <botan/xmss_privatekey.h>
18 #include <botan/xmss_address.h>
19 #include <botan/xmss_common_ops.h>
20 #include <botan/pk_ops.h>
21 #include <botan/internal/xmss_signature.h>
22 #include <botan/xmss_wots_publickey.h>
23
24 namespace Botan {
25
26 /**
27 * Signature generation operation for Extended Hash-Based Signatures (XMSS) as
28 * defined in:
29 *
30 * [1] XMSS: Extended Hash-Based Signatures,
31 * draft-itrf-cfrg-xmss-hash-based-signatures-06
32 * Release: July 2016.
33 * https://datatracker.ietf.org/doc/
34 * draft-irtf-cfrg-xmss-hash-based-signatures/?include_text=1
35 **/
36 class XMSS_Signature_Operation : public virtual PK_Ops::Signature,
37 public XMSS_Common_Ops
38 {
39 public:
40 XMSS_Signature_Operation(const XMSS_PrivateKey& private_key);
41 virtual ~XMSS_Signature_Operation() = default;
42
43 /**
44 * Creates an XMSS signature for the message provided through call to
45 * update().
46 *
47 * @return serialized XMSS signature.
48 **/
49 secure_vector<uint8_t> sign(RandomNumberGenerator&) override;
50
51 void update(const uint8_t msg[], size_t msg_len) override;
52
53 private:
54 /**
55 * Algorithm 11: "treeSig"
56 * Generate a WOTS+ signature on a message with corresponding auth path.
57 *
58 * @param msg A message.
59 * @param xmss_priv_key A XMSS private key.
60 * @param adrs A XMSS Address.
61 **/
62 XMSS_WOTS_PublicKey::TreeSignature generate_tree_signature(
63 const secure_vector<uint8_t>& msg,
64 XMSS_PrivateKey& xmss_priv_key,
65 XMSS_Address& adrs);
66
67 /**
68 * Algorithm 12: "XMSS_sign"
69 * Generate an XMSS signature and update the XMSS secret key
70 *
71 * @param msg A message to sign of arbitrary length.
72 * @param [out] xmss_priv_key A XMSS private key. The private key will be
73 * updated during the signing process.
74 *
75 * @return The signature of msg signed using xmss_priv_key.
76 **/
77 XMSS_Signature sign(
78 const secure_vector<uint8_t>& msg,
79 XMSS_PrivateKey& xmss_priv_key);
80
81 wots_keysig_t build_auth_path(XMSS_PrivateKey& priv_key,
82 XMSS_Address& adrs);
83
84 void initialize();
85
86 XMSS_PrivateKey m_priv_key;
87 secure_vector<uint8_t> m_randomness;
88 size_t m_leaf_idx;
89 bool m_is_initialized;
90 };
91
92 }
93
94 #endif
95
Botan::XMSS_Common_Ops
Definition: xmss_common_ops.h:25
Botan::RandomNumberGenerator
Definition: rng.h:25
Botan::XMSS_Signature_Operation::XMSS_Signature_Operation
XMSS_Signature_Operation(const XMSS_PrivateKey &private_key)
Definition: xmss_signature_operation.cpp:21
Botan::XMSS_Signature_Operation
Definition: xmss_signature_operation.h:36
Botan::XMSS_Address
Definition: xmss_address.h:23
Botan::XMSS_Signature_Operation::~XMSS_Signature_Operation
virtual ~XMSS_Signature_Operation()=default
Botan::PK_Ops::Signature
Definition: pk_ops.h:86
Botan::secure_vector
std::vector< T, secure_allocator< T >> secure_vector
Definition: secmem.h:121
Botan::XMSS_PrivateKey
Definition: xmss_privatekey.h:40
Botan::XMSS_WOTS_PublicKey::TreeSignature
Definition: xmss_wots_publickey.h:35
Botan
Definition: alg_id.cpp:13
Botan::wots_keysig_t
std::vector< secure_vector< uint8_t > > wots_keysig_t
Definition: xmss_common_ops.h:20
Botan::XMSS_Signature_Operation::sign
secure_vector< uint8_t > sign(RandomNumberGenerator &) override
Definition: xmss_signature_operation.cpp:79
Botan::XMSS_Signature_Operation::update
void update(const uint8_t msg[], size_t msg_len) override
Definition: xmss_signature_operation.cpp:71
Botan::XMSS_Signature
Definition: xmss_signature.h:21