Botan 2.1.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

rfc6979.h
Go to the documentation of this file.
1 /*
2 * RFC 6979 Deterministic Nonce Generator
3 * (C) 2014,2015 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7
8 #ifndef BOTAN_RFC6979_GENERATOR_H__
9 #define BOTAN_RFC6979_GENERATOR_H__
10
11 #include <botan/bigint.h>
12 #include <string>
13 #include <memory>
14
15 namespace Botan {
16
17 class HMAC_DRBG;
18
19 class BOTAN_DLL RFC6979_Nonce_Generator
20 {
21 public:
22 /**
23 * Note: keeps persistent reference to order
24 */
25 RFC6979_Nonce_Generator(const std::string& hash,
26 const BigInt& order,
27 const BigInt& x);
28
29 ~RFC6979_Nonce_Generator();
30
31 const BigInt& nonce_for(const BigInt& m);
32 private:
33 const BigInt& m_order;
34 BigInt m_k;
35 size_t m_qlen, m_rlen;
36 std::unique_ptr<HMAC_DRBG> m_hmac_drbg;
37 secure_vector<uint8_t> m_rng_in, m_rng_out;
38 };
39
40 /**
41 * @param x the secret (EC)DSA key
42 * @param q the group order
43 * @param h the message hash already reduced mod q
44 * @param hash the hash function used to generate h
45 */
46 BigInt BOTAN_DLL generate_rfc6979_nonce(const BigInt& x,
47 const BigInt& q,
48 const BigInt& h,
49 const std::string& hash);
50
51 }
52
53 #endif
Botan::BigInt
Definition: bigint.h:23
Botan::RFC6979_Nonce_Generator
Definition: rfc6979.h:19
Botan::secure_vector
std::vector< T, secure_allocator< T >> secure_vector
Definition: secmem.h:121
Botan
Definition: alg_id.cpp:13
m_order
const BigInt & m_order
Definition: ecdh.cpp:50
Botan::generate_rfc6979_nonce
BigInt generate_rfc6979_nonce(const BigInt &x, const BigInt &q, const BigInt &h, const std::string &hash)
Definition: rfc6979.cpp:49
hash
MechanismType hash
Definition: p11_mechanism.cpp:63