diff options
author | lloyd <[email protected]> | 2008-10-26 03:07:18 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-10-26 03:07:18 +0000 |
commit | a8ee54d459a42d98fdfe1e9ff4f0c011c2f41e10 (patch) | |
tree | 576d871ed243508e5458456d12ea99d240e8339c /doc/examples/dsa_sign.cpp | |
parent | b1344477a80c7410da9ce05dd3343c04d24f8095 (diff) |
Move rng.{cpp,h} from core to rng/ topdir
Add a new class AutoSeeded_RNG that is a RandomNumberGenerator that wraps
up the logic formerly in RandomNumberGenerator::make_rng. make_rng in
fact now just returns a new AutoSeeded_RNG object.
AutoSeeded_RNG is a bit more convenient because
- No need to use auto_ptr
- No need to dereference (same syntax everywhere - it's an underestimated
advantage imo)
Also move the code from timer/timer_base to timer/
Diffstat (limited to 'doc/examples/dsa_sign.cpp')
-rw-r--r-- | doc/examples/dsa_sign.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/doc/examples/dsa_sign.cpp b/doc/examples/dsa_sign.cpp index b45bd9d70..1ef81d424 100644 --- a/doc/examples/dsa_sign.cpp +++ b/doc/examples/dsa_sign.cpp @@ -48,11 +48,10 @@ int main(int argc, char* argv[]) return 1; } - std::auto_ptr<RandomNumberGenerator> rng( - RandomNumberGenerator::make_rng()); + AutoSeeded_RNG rng; std::auto_ptr<PKCS8_PrivateKey> key( - PKCS8::load_key(argv[1], *rng, passphrase) + PKCS8::load_key(argv[1], rng, passphrase) ); DSA_PrivateKey* dsakey = dynamic_cast<DSA_PrivateKey*>(key.get()); @@ -71,7 +70,7 @@ int main(int argc, char* argv[]) signer.update(buf, got); Pipe pipe(new Base64_Encoder); - pipe.process_msg(signer.signature(*rng)); + pipe.process_msg(signer.signature(rng)); sigfile << pipe.read_all_as_string() << std::endl; } catch(std::exception& e) |