diff options
author | lloyd <[email protected]> | 2008-06-27 19:29:19 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-06-27 19:29:19 +0000 |
commit | cbcebfaad9ab6dc22186e93d259c6beed7fcff88 (patch) | |
tree | 73540a68f94fc397289c034f0babb0c645cecacc /doc/examples/self_sig.cpp | |
parent | e2a465b75d8baeac912e3f4d428ebc5e03fd76f1 (diff) |
Update some of the examples for the recent API changes
Diffstat (limited to 'doc/examples/self_sig.cpp')
-rw-r--r-- | doc/examples/self_sig.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/doc/examples/self_sig.cpp b/doc/examples/self_sig.cpp index c2118be40..91aa4b2ea 100644 --- a/doc/examples/self_sig.cpp +++ b/doc/examples/self_sig.cpp @@ -13,11 +13,11 @@ This file is in the public domain #include <botan/x509self.h> #include <botan/rsa.h> #include <botan/dsa.h> -#include <botan/libstate.h> using namespace Botan; #include <iostream> #include <fstream> +#include <memory> int main(int argc, char* argv[]) { @@ -42,10 +42,11 @@ int main(int argc, char* argv[]) try { - RSA_PrivateKey key(1024, global_state().prng_reference()); + std::auto_ptr<RandomNumberGenerator> rng(make_rng()); + RSA_PrivateKey key(*rng, 1024); std::ofstream priv_key("private.pem"); - priv_key << PKCS8::PEM_encode(key, argv[1]); + priv_key << PKCS8::PEM_encode(key, *rng, argv[1]); X509_Cert_Options opts; @@ -60,7 +61,7 @@ int main(int argc, char* argv[]) if(do_CA) opts.CA_key(); - X509_Certificate cert = X509::create_self_signed_cert(opts, key); + X509_Certificate cert = X509::create_self_signed_cert(opts, key, *rng); std::ofstream cert_file("cert.pem"); cert_file << cert.PEM_encode(); |