Botan 2.19.5 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
15 BOTAN_FUTURE_INTERNAL_HEADER(rfc6979.h)
16
17namespace Botan {
18
19 class HMAC_DRBG;
20
21 class BOTAN_PUBLIC_API(2,0) RFC6979_Nonce_Generator final
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
31 ~RFC6979_Nonce_Generator();
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*/
48 BigInt 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
Botan::BigInt
Definition: bigint.h:25
Botan::RFC6979_Nonce_Generator
Definition: rfc6979.h:22
final
int(* final)(unsigned char *, CTX *)
Definition: commoncrypto_hash.cpp:29
BOTAN_PUBLIC_API
#define BOTAN_PUBLIC_API(maj, min)
Definition: compiler.h:31
BOTAN_FUTURE_INTERNAL_HEADER
#define BOTAN_FUTURE_INTERNAL_HEADER(hdr)
Definition: compiler.h:136
Botan
Definition: alg_id.cpp:13
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
Botan::secure_vector
std::vector< T, secure_allocator< T > > secure_vector
Definition: secmem.h:65
std
Definition: bigint.h:1155
hash
MechanismType hash
Definition: p11_mechanism.cpp:64