Botan 3.4.0
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 <memory>
13#include <string>
14
15namespace Botan {
16
17class HMAC_DRBG;
18
20 public:
21 /**
22 * Note: keeps persistent reference to order
23 */
24 RFC6979_Nonce_Generator(std::string_view hash, const BigInt& order, const BigInt& x);
25
27
28 const BigInt& nonce_for(const BigInt& m);
29
30 private:
31 const BigInt& m_order;
32 BigInt m_k;
33 size_t m_qlen, m_rlen;
34 std::unique_ptr<HMAC_DRBG> m_hmac_drbg;
35 secure_vector<uint8_t> m_rng_in, m_rng_out;
36};
37
38/**
39* @param x the secret (EC)DSA key
40* @param q the group order
41* @param h the message hash already reduced mod q
42* @param hash the hash function used to generate h
43*/
45BigInt generate_rfc6979_nonce(const BigInt& x, const BigInt& q, const BigInt& h, std::string_view hash);
46
47} // namespace Botan
48
49#endif
int(* final)(unsigned char *, CTX *)
#define BOTAN_TEST_API
Definition compiler.h:51
BigInt generate_rfc6979_nonce(const BigInt &x, const BigInt &q, const BigInt &h, std::string_view hash)
Definition rfc6979.cpp:43
std::vector< T, secure_allocator< T > > secure_vector
Definition secmem.h:61