Botan 2.19.3
Crypto and TLS for C&
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
16
17namespace Botan {
18
19class HMAC_DRBG;
20
22 {
23 public:
24 /**
25 * Note: keeps persistent reference to order
26 */
27 RFC6979_Nonce_Generator(const std::string& hash,
28 const BigInt& order,
29 const BigInt& x);
30
32
33 const BigInt& nonce_for(const BigInt& m);
34 private:
35 const BigInt& m_order;
36 BigInt m_k;
37 size_t m_qlen, m_rlen;
38 std::unique_ptr<HMAC_DRBG> m_hmac_drbg;
39 secure_vector<uint8_t> m_rng_in, m_rng_out;
40 };
41
42/**
43* @param x the secret (EC)DSA key
44* @param q the group order
45* @param h the message hash already reduced mod q
46* @param hash the hash function used to generate h
47*/
48BigInt BOTAN_PUBLIC_API(2,0) generate_rfc6979_nonce(const BigInt& x,
49 const BigInt& q,
50 const BigInt& h,
51 const std::string& hash);
52
53}
54
55#endif
int(* final)(unsigned char *, CTX *)
#define BOTAN_PUBLIC_API(maj, min)
Definition compiler.h:31
#define BOTAN_FUTURE_INTERNAL_HEADER(hdr)
Definition compiler.h:136
std::vector< T, secure_allocator< T > > secure_vector
Definition secmem.h:65
Definition bigint.h:1143
MechanismType hash