Botan  2.6.0
Crypto and TLS for C++11
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 
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 
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 */
47  const BigInt& q,
48  const BigInt& h,
49  const std::string& hash);
50 
51 }
52 
53 #endif
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:27
Definition: bigint.h:719
BigInt generate_rfc6979_nonce(const BigInt &x, const BigInt &q, const BigInt &h, const std::string &hash)
Definition: rfc6979.cpp:49
Definition: alg_id.cpp:13
std::vector< T, secure_allocator< T > > secure_vector
Definition: secmem.h:88
MechanismType hash