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/dh.cpp | |
parent | e2a465b75d8baeac912e3f4d428ebc5e03fd76f1 (diff) |
Update some of the examples for the recent API changes
Diffstat (limited to 'doc/examples/dh.cpp')
-rw-r--r-- | doc/examples/dh.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/doc/examples/dh.cpp b/doc/examples/dh.cpp index c8e13dbb4..1957215bc 100644 --- a/doc/examples/dh.cpp +++ b/doc/examples/dh.cpp @@ -7,22 +7,24 @@ */ #include <botan/botan.h> #include <botan/dh.h> -#include <botan/libstate.h> +#include <botan/rng.h> using namespace Botan; #include <iostream> +#include <memory> int main() { - try { + try + { + std::auto_ptr<RandomNumberGenerator> rng(make_rng()); + // Alice creates a DH key and sends (the public part) to Bob - DH_PrivateKey private_a(DL_Group("modp/ietf/1024"), - global_state().prng_reference()); + DH_PrivateKey private_a(*rng, DL_Group("modp/ietf/1024")); DH_PublicKey public_a = private_a; // Bob gets this // Bob creates a key with a matching group - DH_PrivateKey private_b(public_a.get_domain(), - global_state().prng_reference()); + DH_PrivateKey private_b(*rng, public_a.get_domain()); // Bob sends the key back to Alice DH_PublicKey public_b = private_b; // Alice gets this |