aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples/dsa_sign.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-06-28 12:35:52 +0000
committerlloyd <[email protected]>2008-06-28 12:35:52 +0000
commit022f07c82e3c83f4ec6829b03c7013ced1710c41 (patch)
tree2fa10481cc34a8c2e3b9ed952372ce4d439abc88 /doc/examples/dsa_sign.cpp
parent7e48e57fe153f002f3fcc9731261ce3f3fe86839 (diff)
Fix the DSA examples. Reindent.
Diffstat (limited to 'doc/examples/dsa_sign.cpp')
-rw-r--r--doc/examples/dsa_sign.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/doc/examples/dsa_sign.cpp b/doc/examples/dsa_sign.cpp
index 67800497e..b45bd9d70 100644
--- a/doc/examples/dsa_sign.cpp
+++ b/doc/examples/dsa_sign.cpp
@@ -48,7 +48,8 @@ int main(int argc, char* argv[])
return 1;
}
- std::auto_ptr<RandomNumberGenerator> rng(make_rng());
+ std::auto_ptr<RandomNumberGenerator> rng(
+ RandomNumberGenerator::make_rng());
std::auto_ptr<PKCS8_PrivateKey> key(
PKCS8::load_key(argv[1], *rng, passphrase)
@@ -62,13 +63,15 @@ int main(int argc, char* argv[])
return 1;
}
- Pipe pipe(new PK_Signer_Filter(get_pk_signer(*dsakey, "EMSA1(SHA-1)")),
- new Base64_Encoder);
+ PK_Signer signer(*dsakey, "EMSA1(SHA-1)");
- pipe.start_msg();
- message >> pipe;
- pipe.end_msg();
+ DataSource_Stream in(message);
+ byte buf[4096] = { 0 };
+ while(u32bit got = in.read(buf, sizeof(buf)))
+ signer.update(buf, got);
+ Pipe pipe(new Base64_Encoder);
+ pipe.process_msg(signer.signature(*rng));
sigfile << pipe.read_all_as_string() << std::endl;
}
catch(std::exception& e)