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