aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples/rsa_kgen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'doc/examples/rsa_kgen.cpp')
-rw-r--r--doc/examples/rsa_kgen.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/doc/examples/rsa_kgen.cpp b/doc/examples/rsa_kgen.cpp
index 13d602d66..7230e7a4a 100644
--- a/doc/examples/rsa_kgen.cpp
+++ b/doc/examples/rsa_kgen.cpp
@@ -13,10 +13,10 @@ This file is in the public domain
#include <fstream>
#include <string>
#include <cstdlib>
+#include <memory>
#include <botan/botan.h>
#include <botan/rsa.h>
-#include <botan/libstate.h>
using namespace Botan;
int main(int argc, char* argv[])
@@ -45,13 +45,14 @@ int main(int argc, char* argv[])
try
{
- RSA_PrivateKey key(bits, global_state().prng_reference());
+ std::auto_ptr<RandomNumberGenerator> rng(make_rng());
+ RSA_PrivateKey key(*rng, bits);
pub << X509::PEM_encode(key);
if(argc == 2)
priv << PKCS8::PEM_encode(key);
else
- priv << PKCS8::PEM_encode(key, argv[2]);
+ priv << PKCS8::PEM_encode(key, *rng, argv[2]);
}
catch(std::exception& e)
{