diff options
author | lloyd <[email protected]> | 2008-05-24 18:25:00 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-05-24 18:25:00 +0000 |
commit | b7563677f13adb8dfa5813ef91ed79364b2d984d (patch) | |
tree | cf7fabb3eb43bc49333be726c15ecac1a7f9a1a7 /checks/x509.cpp | |
parent | a6a9110d02925e111cff2dc1143a09a3b7680f0b (diff) |
Previously random_integer and friends used the global PRNG object to get
random bits. Now they take a reference to a RandomNumberGenerator object.
This was applied several times out, so now the constructors to private
key objects also take a RandomNumberGenerator& argument. This is also true
for a number of randomized algorithms (Miller-Rabin, for instance).
You can get a reference to the global PRNG with
global_state().prng_reference()
This is a provisional thing: and warning: it is not thread safe! If this
is a problem instead keep per-thread PRNGs and pass them were needed.
Diffstat (limited to 'checks/x509.cpp')
-rw-r--r-- | checks/x509.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/checks/x509.cpp b/checks/x509.cpp index 6e6dad60c..459f3b62f 100644 --- a/checks/x509.cpp +++ b/checks/x509.cpp @@ -6,6 +6,8 @@ #include <botan/pkcs10.h> #include <botan/rsa.h> #include <botan/dsa.h> + +#include <botan/libstate.h> using namespace Botan; #include <iostream> @@ -71,7 +73,7 @@ void do_x509_tests() /* Create the CA's key and self-signed cert */ std::cout << '.' << std::flush; - RSA_PrivateKey ca_key(1024); + RSA_PrivateKey ca_key(1024, global_state().prng_reference()); std::cout << '.' << std::flush; X509_Certificate ca_cert = X509::create_self_signed_cert(ca_opts(), ca_key); @@ -79,13 +81,15 @@ void do_x509_tests() /* Create user #1's key and cert request */ std::cout << '.' << std::flush; - DSA_PrivateKey user1_key(DL_Group("dsa/jce/1024")); + DSA_PrivateKey user1_key(DL_Group("dsa/jce/1024"), + global_state().prng_reference()); + std::cout << '.' << std::flush; PKCS10_Request user1_req = X509::create_cert_req(req_opts1(), user1_key); /* Create user #2's key and cert request */ std::cout << '.' << std::flush; - RSA_PrivateKey user2_key(768); + RSA_PrivateKey user2_key(1024, global_state().prng_reference()); std::cout << '.' << std::flush; PKCS10_Request user2_req = X509::create_cert_req(req_opts2(), user2_key); |