aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples/ca.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-06-27 19:29:19 +0000
committerlloyd <[email protected]>2008-06-27 19:29:19 +0000
commitcbcebfaad9ab6dc22186e93d259c6beed7fcff88 (patch)
tree73540a68f94fc397289c034f0babb0c645cecacc /doc/examples/ca.cpp
parente2a465b75d8baeac912e3f4d428ebc5e03fd76f1 (diff)
Update some of the examples for the recent API changes
Diffstat (limited to 'doc/examples/ca.cpp')
-rw-r--r--doc/examples/ca.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/doc/examples/ca.cpp b/doc/examples/ca.cpp
index 5e465d245..0bcb9a38e 100644
--- a/doc/examples/ca.cpp
+++ b/doc/examples/ca.cpp
@@ -14,6 +14,7 @@
*/
#include <botan/botan.h>
+#include <botan/rng.h>
#include <botan/x509_ca.h>
#include <botan/util.h>
using namespace Botan;
@@ -37,10 +38,12 @@ int main(int argc, char* argv[])
const std::string arg_ca_key = argv[3];
const std::string arg_req_file = argv[4];
+ std::auto_ptr<RandomNumberGenerator> rng(make_rng());
+
X509_Certificate ca_cert(arg_ca_cert);
std::auto_ptr<PKCS8_PrivateKey> privkey(
- PKCS8::load_key(arg_ca_key, arg_passphrase)
+ PKCS8::load_key(arg_ca_key, *rng, arg_passphrase)
);
X509_CA ca(ca_cert, *privkey);
@@ -55,7 +58,7 @@ int main(int argc, char* argv[])
X509_Time start_time(system_time());
X509_Time end_time(system_time() + 365 * 60 * 60 * 24);
- X509_Certificate new_cert = ca.sign_request(req, start_time, end_time);
+ X509_Certificate new_cert = ca.sign_request(req, *rng, start_time, end_time);
// send the new cert back to the requestor
std::cout << new_cert.PEM_encode();