aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples/dsa_sign.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'doc/examples/dsa_sign.cpp')
-rw-r--r--doc/examples/dsa_sign.cpp14
1 files changed, 3 insertions, 11 deletions
diff --git a/doc/examples/dsa_sign.cpp b/doc/examples/dsa_sign.cpp
index 5f02c0dc1..3511eacfa 100644
--- a/doc/examples/dsa_sign.cpp
+++ b/doc/examples/dsa_sign.cpp
@@ -1,10 +1,3 @@
-/*
-* DSA signature generation example
-* (C) 2009 Jack Lloyd
-*
-* Distributed under the terms of the Botan license
-*/
-
#include <iostream>
#include <iomanip>
#include <fstream>
@@ -14,6 +7,7 @@
#include <botan/botan.h>
#include <botan/pubkey.h>
#include <botan/dsa.h>
+#include <botan/base64.h>
using namespace Botan;
const std::string SUFFIX = ".sig";
@@ -66,12 +60,10 @@ int main(int argc, char* argv[])
DataSource_Stream in(message);
byte buf[4096] = { 0 };
- while(u32bit got = in.read(buf, sizeof(buf)))
+ while(size_t 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;
+ sigfile << base64_encode(signer.signature(rng)) << "\n";
}
catch(std::exception& e)
{