aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples
diff options
context:
space:
mode:
Diffstat (limited to 'doc/examples')
-rw-r--r--doc/examples/asn1.cpp14
-rw-r--r--doc/examples/base.cpp44
-rw-r--r--doc/examples/base64.cpp12
-rw-r--r--doc/examples/bench.cpp6
-rw-r--r--doc/examples/benchmark.cpp6
-rw-r--r--doc/examples/bzip.cpp18
-rw-r--r--doc/examples/ca.cpp10
-rw-r--r--doc/examples/checksum.cpp6
-rw-r--r--doc/examples/cms_dec.cpp6
-rw-r--r--doc/examples/cms_enc.cpp6
-rw-r--r--doc/examples/cpuid.cpp6
-rw-r--r--doc/examples/cryptobox.cpp5
-rw-r--r--doc/examples/decrypt.cpp17
-rw-r--r--doc/examples/dh.cpp9
-rw-r--r--doc/examples/dsa_kgen.cpp28
-rw-r--r--doc/examples/dsa_sign.cpp10
-rw-r--r--doc/examples/dsa_ver.cpp18
-rw-r--r--doc/examples/eax_test.cpp6
-rw-r--r--doc/examples/ecdsa.cpp6
-rw-r--r--doc/examples/encrypt.cpp13
-rw-r--r--doc/examples/encrypt2.cpp6
-rw-r--r--doc/examples/factor.cpp6
-rw-r--r--doc/examples/fpe.cpp6
-rw-r--r--doc/examples/gen_certs.cpp6
-rw-r--r--doc/examples/gtk/gtk_ui.h14
-rw-r--r--doc/examples/hash.cpp12
-rw-r--r--doc/examples/hash_fd.cpp23
-rw-r--r--doc/examples/hash_quickly.cpp6
-rw-r--r--doc/examples/hasher.cpp11
-rw-r--r--doc/examples/hasher2.cpp19
-rw-r--r--doc/examples/make_prime.cpp6
-rw-r--r--doc/examples/package.cpp6
-rw-r--r--doc/examples/passhash.cpp6
-rw-r--r--doc/examples/pkcs10.cpp11
-rw-r--r--doc/examples/pqg_gen.cpp6
-rw-r--r--doc/examples/read_ssh.cpp6
-rw-r--r--doc/examples/ressol.cpp6
-rw-r--r--doc/examples/rng_test.cpp6
-rw-r--r--doc/examples/row_encryptor.cpp10
-rw-r--r--doc/examples/rsa_dec.cpp10
-rw-r--r--doc/examples/rsa_enc.cpp12
-rw-r--r--doc/examples/rsa_kgen.cpp11
-rw-r--r--doc/examples/rsa_manykey.cpp6
-rw-r--r--doc/examples/self_sig.cpp19
-rw-r--r--doc/examples/sig_gen.cpp6
-rw-r--r--doc/examples/stack.cpp14
-rw-r--r--doc/examples/test_es.cpp6
-rw-r--r--doc/examples/tss.cpp6
-rw-r--r--doc/examples/x509info.cpp12
-rw-r--r--doc/examples/xor_ciph.cpp12
50 files changed, 327 insertions, 205 deletions
diff --git a/doc/examples/asn1.cpp b/doc/examples/asn1.cpp
index 95757ec19..b0a6aa104 100644
--- a/doc/examples/asn1.cpp
+++ b/doc/examples/asn1.cpp
@@ -1,4 +1,10 @@
/*
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+/*
A simple ASN.1 parser, similiar to 'dumpasn1' or 'openssl asn1parse', though
without some of the bells and whistles of those. Primarily used for testing
the BER decoder. The output format is modeled loosely on 'asn1parse -i'
@@ -14,12 +20,8 @@
- Nov 25: Much improved BIT STRING output
Can deal with non-constructed taggings
Can produce UTF-8 output
-
- This file is in the public domain.
*/
-/*******************************************************************/
-
// Set this if your terminal understands UTF-8; otherwise output is in Latin-1
#define UTF8_TERMINAL 1
@@ -30,8 +32,6 @@
*/
#define INITIAL_LEVEL 0
-/*******************************************************************/
-
#include <botan/botan.h>
#include <botan/bigint.h>
#include <botan/der_enc.h>
@@ -56,7 +56,7 @@ int main(int argc, char* argv[])
printf("Usage: %s <file>\n", argv[0]);
return 1;
}
-
+
Botan::LibraryInitializer init;
try {
diff --git a/doc/examples/base.cpp b/doc/examples/base.cpp
deleted file mode 100644
index eca0ccf24..000000000
--- a/doc/examples/base.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- A simple template for Botan applications, showing startup, etc
-*/
-#include <botan/botan.h>
-using namespace Botan;
-
-/* This is how you can do compile-time version checking */
-
-#if BOTAN_VERSION_CODE < BOTAN_VERSION_CODE_FOR(1,6,3)
- #error Your Botan installation is too old; upgrade to 1.6.3 or later
-#endif
-
-#include <iostream>
-
-int main(int argc, char* argv[])
- {
- Botan::LibraryInitializer init;
-
- try
- {
- /* Put it inside the try block so exceptions at startup/shutdown will
- get caught.
-
- It will be initialized with default options
- */
-
- if(argc > 2)
- {
- std::cout << "Usage: " << argv[0] << "[initializer args]\n";
- return 2;
- }
-
- std::string args = (argc == 2) ? argv[1] : "";
-
- LibraryInitializer init(args);
- // your operations here
- }
- catch(std::exception& e)
- {
- std::cout << e.what() << std::endl;
- return 1;
- }
- return 0;
- }
diff --git a/doc/examples/base64.cpp b/doc/examples/base64.cpp
index d35aaf593..dbe8d19e3 100644
--- a/doc/examples/base64.cpp
+++ b/doc/examples/base64.cpp
@@ -1,12 +1,10 @@
/*
-An Botan example application which emulates a poorly written version of
-"uuencode -m"
-
-Written by Jack Lloyd ([email protected]), in maybe an hour scattered
-over 2000/2001
-
-This file is in the public domain
+* Encode/decode base64 strings
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
*/
+
#include <fstream>
#include <iostream>
#include <string>
diff --git a/doc/examples/bench.cpp b/doc/examples/bench.cpp
index 6a15df7c0..87a537493 100644
--- a/doc/examples/bench.cpp
+++ b/doc/examples/bench.cpp
@@ -1,3 +1,9 @@
+/*
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
#include <botan/benchmark.h>
#include <botan/init.h>
#include <botan/auto_rng.h>
diff --git a/doc/examples/benchmark.cpp b/doc/examples/benchmark.cpp
index fa91726e5..006450314 100644
--- a/doc/examples/benchmark.cpp
+++ b/doc/examples/benchmark.cpp
@@ -1,3 +1,9 @@
+/*
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
#include <botan/botan.h>
#include <botan/benchmark.h>
diff --git a/doc/examples/bzip.cpp b/doc/examples/bzip.cpp
index 02252fb94..c3509c4da 100644
--- a/doc/examples/bzip.cpp
+++ b/doc/examples/bzip.cpp
@@ -1,10 +1,10 @@
/*
-An Botan example application which emulates a poorly written version of bzip2
-
-Written by Jack Lloyd ([email protected]), Jun 9, 2001
-
-This file is in the public domain
+* Bzip2 Compression/Decompression
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
*/
+
#include <string>
#include <cstring>
#include <vector>
@@ -12,6 +12,14 @@ This file is in the public domain
#include <iostream>
#include <botan/botan.h>
+/*
+* If Bzip2 isn't included, we know nothing works at compile time, but
+* we wait to fail at runtime. Otherwise I would get 2-3 mails a month
+* about how this was failing to compile (even with an informative
+* #error message explaining the situation) because bzip2 wasn't
+* included in the build.
+*/
+
#if defined(BOTAN_HAS_COMPRESSOR_BZIP2)
#include <botan/bzip2.h>
#endif
diff --git a/doc/examples/ca.cpp b/doc/examples/ca.cpp
index f5eccdde9..8dd3e981f 100644
--- a/doc/examples/ca.cpp
+++ b/doc/examples/ca.cpp
@@ -1,4 +1,10 @@
/*
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+/*
Implement the functionality of a simple CA: read in a CA certificate,
the associated private key, and a PKCS #10 certificate request. Sign the
request and print out the new certificate.
@@ -7,10 +13,6 @@
cacert.pem: The CA's certificate (perhaps created by self_sig)
caprivate.pem: The CA's private key
req.pem: The user's PKCS #10 certificate request
-
- Written by Jack Lloyd, May 19, 2003
-
- This file is in the public domain.
*/
#include <botan/botan.h>
diff --git a/doc/examples/checksum.cpp b/doc/examples/checksum.cpp
index 232be057c..dba7a7d70 100644
--- a/doc/examples/checksum.cpp
+++ b/doc/examples/checksum.cpp
@@ -1,3 +1,9 @@
+/*
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
#include <botan/botan.h>
#include <botan/filters.h>
diff --git a/doc/examples/cms_dec.cpp b/doc/examples/cms_dec.cpp
index de4d732f0..6a9d99137 100644
--- a/doc/examples/cms_dec.cpp
+++ b/doc/examples/cms_dec.cpp
@@ -1,3 +1,9 @@
+/*
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
#include <botan/botan.h>
#include <botan/pkcs8.h>
#include <botan/cms_dec.h>
diff --git a/doc/examples/cms_enc.cpp b/doc/examples/cms_enc.cpp
index de16bbaae..2cf813987 100644
--- a/doc/examples/cms_enc.cpp
+++ b/doc/examples/cms_enc.cpp
@@ -1,3 +1,9 @@
+/*
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
#include <botan/botan.h>
#include <botan/cms_enc.h>
using namespace Botan;
diff --git a/doc/examples/cpuid.cpp b/doc/examples/cpuid.cpp
index 76438783f..ba499051f 100644
--- a/doc/examples/cpuid.cpp
+++ b/doc/examples/cpuid.cpp
@@ -1,3 +1,9 @@
+/*
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
#include <iostream>
#include <botan/cpuid.h>
diff --git a/doc/examples/cryptobox.cpp b/doc/examples/cryptobox.cpp
index 0a769b0cd..f45f00ca1 100644
--- a/doc/examples/cryptobox.cpp
+++ b/doc/examples/cryptobox.cpp
@@ -1,6 +1,9 @@
/*
-* Cryptobox example
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
*/
+
#include <botan/botan.h>
#include <botan/cryptobox.h>
#include <fstream>
diff --git a/doc/examples/decrypt.cpp b/doc/examples/decrypt.cpp
index 68d5f890b..ebab5d804 100644
--- a/doc/examples/decrypt.cpp
+++ b/doc/examples/decrypt.cpp
@@ -1,14 +1,17 @@
/*
-Decrypt files encrypted with the 'encrypt' example application.
-
-I'm being lazy and writing the output to stdout rather than stripping off the
-".enc" suffix and writing it there. So all diagnostics go to stderr so there is
-no confusion.
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
-Written by Jack Lloyd ([email protected]) on August 5, 2002
+/*
+Decrypt files encrypted with the 'encrypt' example application.
-This file is in the public domain
+I'm being lazy and writing the output to stdout rather than stripping
+off the ".enc" suffix and writing it there. So all diagnostics go to
+stderr so there is no confusion.
*/
+
#include <fstream>
#include <iostream>
#include <string>
diff --git a/doc/examples/dh.cpp b/doc/examples/dh.cpp
index 7855aeae5..4c6961234 100644
--- a/doc/examples/dh.cpp
+++ b/doc/examples/dh.cpp
@@ -1,10 +1,9 @@
/*
- A simple DH example
-
- Written by Jack Lloyd ([email protected]), on December 24, 2003
-
- This file is in the public domain
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
*/
+
#include <botan/botan.h>
#include <botan/dh.h>
#include <botan/rng.h>
diff --git a/doc/examples/dsa_kgen.cpp b/doc/examples/dsa_kgen.cpp
index 4669cf705..e949ae54a 100644
--- a/doc/examples/dsa_kgen.cpp
+++ b/doc/examples/dsa_kgen.cpp
@@ -1,19 +1,23 @@
/*
-Generate a 1024 bit DSA key and put it into a file. The public key format is
-that specified by X.509, while the private key format is PKCS #8.
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
-The domain parameters are the ones specified as the Java default DSA
-parameters. There is nothing special about these, it's just the only 1024-bit
-DSA parameter set that's included in Botan at the time of this writing. The
-application always reads/writes all of the domain parameters to/from the file,
-so a new set could be used without any problems. We could generate a new set
-for each key, or read a set of DSA params from a file and use those, but they
-mostly seem like needless complications.
-Written by Jack Lloyd ([email protected]), August 5, 2002
- Updated to use X.509 and PKCS #8 formats, October 21, 2002
+/**
+Generate a 1024 bit DSA key and put it into a file. The public key
+format is that specified by X.509, while the private key format is
+PKCS #8.
-This file is in the public domain
+The domain parameters are the ones specified as the Java default DSA
+parameters. There is nothing special about these, it's just the only
+1024-bit DSA parameter set that's included in Botan at the time of
+this writing. The application always reads/writes all of the domain
+parameters to/from the file, so a new set could be used without any
+problems. We could generate a new set for each key, or read a set of
+DSA params from a file and use those, but they mostly seem like
+needless complications.
*/
#include <iostream>
diff --git a/doc/examples/dsa_sign.cpp b/doc/examples/dsa_sign.cpp
index caf050313..abc22d0de 100644
--- a/doc/examples/dsa_sign.cpp
+++ b/doc/examples/dsa_sign.cpp
@@ -1,10 +1,8 @@
/*
-Decrypt an encrypted DSA private key. Then use that key to sign a message.
-
-Written by Jack Lloyd ([email protected]), August 5, 2002
- Updated to use X.509 and PKCS #8 format keys, October 21, 2002
-
-This file is in the public domain
+* DSA signature generation example
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
*/
#include <iostream>
diff --git a/doc/examples/dsa_ver.cpp b/doc/examples/dsa_ver.cpp
index 3b7ea0255..4a2f62ce4 100644
--- a/doc/examples/dsa_ver.cpp
+++ b/doc/examples/dsa_ver.cpp
@@ -1,14 +1,16 @@
/*
-Grab an DSA public key from the file given as an argument, grab a signature
-from another file, and verify the message (which, suprise, is also in a file).
-
-The signature format isn't particularly standard, but it's not bad. It's simply
-the IEEE 1363 signature format, encoded into base64 with a trailing newline
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
-Written by Jack Lloyd ([email protected]), August 5, 2002
- Updated to use X.509 format keys, October 21, 2002
+/*
+Grab an DSA public key from the file given as an argument, grab a
+signature from another file, and verify the message (which, suprise,
+is also in a file).
-This file is in the public domain
+The signature format isn't particularly standard: take the IEEE 1363
+signature format, encoded into base64 with a trailing newline.
*/
#include <iostream>
diff --git a/doc/examples/eax_test.cpp b/doc/examples/eax_test.cpp
index 283e33501..3f7dbcbc8 100644
--- a/doc/examples/eax_test.cpp
+++ b/doc/examples/eax_test.cpp
@@ -1,3 +1,9 @@
+/*
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
#include <fstream>
#include <iostream>
#include <sstream>
diff --git a/doc/examples/ecdsa.cpp b/doc/examples/ecdsa.cpp
index 065203a94..f55005544 100644
--- a/doc/examples/ecdsa.cpp
+++ b/doc/examples/ecdsa.cpp
@@ -1,3 +1,9 @@
+/*
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
#include <botan/botan.h>
#include <botan/ecdsa.h>
#include <botan/pubkey.h>
diff --git a/doc/examples/encrypt.cpp b/doc/examples/encrypt.cpp
index 348ee8d39..f903c2f24 100644
--- a/doc/examples/encrypt.cpp
+++ b/doc/examples/encrypt.cpp
@@ -1,4 +1,10 @@
/*
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+/*
Encrypt a file using a block cipher in CBC mode. Compresses the plaintext
with Zlib, MACs with HMAC(SHA-1). Stores the block cipher used in the file,
so you don't have to specify it when decrypting.
@@ -10,13 +16,8 @@ was compressed. Bonus points for supporting multiple compression schemes.
Another flaw is that is stores the entire ciphertext in memory, so if the file
you're encrypting is 1 Gb... you better have a lot of RAM.
-
-Based on the base64 example, of all things
-
-Written by Jack Lloyd ([email protected]) on August 5, 2002
-
-This file is in the public domain
*/
+
#include <fstream>
#include <iostream>
#include <string>
diff --git a/doc/examples/encrypt2.cpp b/doc/examples/encrypt2.cpp
index 4af0cf019..dac2f8314 100644
--- a/doc/examples/encrypt2.cpp
+++ b/doc/examples/encrypt2.cpp
@@ -1,3 +1,9 @@
+/*
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
#include <botan/botan.h>
#include <botan/pbkdf2.h>
#include <botan/hmac.h>
diff --git a/doc/examples/factor.cpp b/doc/examples/factor.cpp
index ff3c23c5d..7700d9b2d 100644
--- a/doc/examples/factor.cpp
+++ b/doc/examples/factor.cpp
@@ -1,4 +1,10 @@
/*
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+/*
Factor integers using a combination of trial division by small primes,
and Pollard's Rho algorithm
*/
diff --git a/doc/examples/fpe.cpp b/doc/examples/fpe.cpp
index 7108b3ece..73773994b 100644
--- a/doc/examples/fpe.cpp
+++ b/doc/examples/fpe.cpp
@@ -1,4 +1,10 @@
/*
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+/*
* Encrypt credit cards numbers with valid checksums into other credit
* card numbers with valid checksums using format preserving encryption.
*/
diff --git a/doc/examples/gen_certs.cpp b/doc/examples/gen_certs.cpp
index 8490a167e..0d04d6d1c 100644
--- a/doc/examples/gen_certs.cpp
+++ b/doc/examples/gen_certs.cpp
@@ -1,4 +1,10 @@
/*
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+/*
* Generate a root CA plus httpd, dovecot, and postfix certs/keys
*
*/
diff --git a/doc/examples/gtk/gtk_ui.h b/doc/examples/gtk/gtk_ui.h
index 9ced83a81..065a4f76b 100644
--- a/doc/examples/gtk/gtk_ui.h
+++ b/doc/examples/gtk/gtk_ui.h
@@ -1,6 +1,8 @@
-/*************************************************
-* GTK+ User Interface Header File *
-*************************************************/
+/*
+* (C) 2006 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
#ifndef BOTAN_EXT_GTK_UI__
#define BOTAN_EXT_GTK_UI__
@@ -8,9 +10,9 @@
#include <botan/ui.h>
#include <gtk/gtk.h>
-/*************************************************
-* GTK+ Passphrase Callback Object *
-*************************************************/
+/*
+* GTK+ Passphrase Callback Object
+*/
class GTK_UI : public Botan::User_Interface
{
public:
diff --git a/doc/examples/hash.cpp b/doc/examples/hash.cpp
index a97cd6082..feaa2e9b3 100644
--- a/doc/examples/hash.cpp
+++ b/doc/examples/hash.cpp
@@ -1,13 +1,7 @@
/*
-Prints the message digest of files, using an arbitrary hash function
-chosen by the user. This is less flexible that I might like, for example:
- ./hash sha1 some_file [or md5 or sha-1 or ripemd160 or ...]
-will not work, cause the name lookup is case-sensitive. Oh well...
-
-Written by Jack Lloyd ([email protected]), on August 4, 2002
- - December 16, 2003: "Fixed" to accept "sha1" or "md5" as a hash name
-
-This file is in the public domain
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
*/
#include <iostream>
diff --git a/doc/examples/hash_fd.cpp b/doc/examples/hash_fd.cpp
index 82ca2c3b4..32acdbec3 100644
--- a/doc/examples/hash_fd.cpp
+++ b/doc/examples/hash_fd.cpp
@@ -1,18 +1,17 @@
/*
-Written by Jack Lloyd ([email protected]), on Prickle-Prickle,
-the 10th of Bureaucracy, 3167.
-
-This file is in the public domain
-
-This is just like the normal hash application, but uses the Unix I/O system
-calls instead of C++ iostreams. Previously, this version was much faster and
-smaller, but GCC 3.1's libstdc++ seems to have been improved enough that the
-difference is now fairly minimal.
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
-Nicely enough, doing the change required changing only about 3 lines of code.
+/*
+This is just like the normal hash application, but uses the Unix I/O
+system calls instead of C++ iostreams. Previously, this version was
+much faster and smaller, but GCC 3.1's libstdc++ seems to have been
+improved enough that the difference is now fairly minimal.
-Note that this requires you to be on a machine running some sort of Unix. Well,
-I guess any POSIX.1 compliant OS (in theory).
+Nicely enough, doing the change required changing only about 3 lines
+of code.
*/
#include <iostream>
diff --git a/doc/examples/hash_quickly.cpp b/doc/examples/hash_quickly.cpp
index c8c8ca5fb..a5236b381 100644
--- a/doc/examples/hash_quickly.cpp
+++ b/doc/examples/hash_quickly.cpp
@@ -1,3 +1,9 @@
+/*
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
#include <botan/botan.h>
#include <botan/benchmark.h>
#include <botan/filters.h>
diff --git a/doc/examples/hasher.cpp b/doc/examples/hasher.cpp
index 5ba982fc0..f3f2ab874 100644
--- a/doc/examples/hasher.cpp
+++ b/doc/examples/hasher.cpp
@@ -1,12 +1,9 @@
/*
-A Botan example application which emulates a
-poorly written version of "gpg --print-md"
-
-Written by Jack Lloyd ([email protected]), quite a while ago (as of June
-2001)
-
-This file is in the public domain
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
*/
+
#include <fstream>
#include <iostream>
#include <string>
diff --git a/doc/examples/hasher2.cpp b/doc/examples/hasher2.cpp
index 12d3c853d..abbe11622 100644
--- a/doc/examples/hasher2.cpp
+++ b/doc/examples/hasher2.cpp
@@ -1,15 +1,18 @@
/*
-Identical to hasher.cpp, but uses Pipe in a different way.
-
-Note this tends to be much less efficient than hasher.cpp, because it does
-three passes over the file. For a small file, it doesn't really matter. But for
-a large file, or for something you can't re-read easily (socket, stdin, ...)
-this is a bad idea.
+* (C) 2001 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
-Written by Jack Lloyd ([email protected]), Feb 8 2001
+/*
+Identical to hasher.cpp, but uses Pipe in a different way.
-This file is in the public domain
+Note this tends to be much less efficient than hasher.cpp, because it
+does three passes over the file. For a small file, it doesn't really
+matter. But for a large file, or for something you can't re-read
+easily (socket, stdin, ...) this is a bad idea.
*/
+
#include <fstream>
#include <iostream>
#include <string>
diff --git a/doc/examples/make_prime.cpp b/doc/examples/make_prime.cpp
index eaff1867f..acaaac698 100644
--- a/doc/examples/make_prime.cpp
+++ b/doc/examples/make_prime.cpp
@@ -1,3 +1,9 @@
+/*
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
#include <botan/numthry.h>
#include <botan/auto_rng.h>
#include <botan/botan.h>
diff --git a/doc/examples/package.cpp b/doc/examples/package.cpp
index 866dd7e96..14d215f73 100644
--- a/doc/examples/package.cpp
+++ b/doc/examples/package.cpp
@@ -1,3 +1,9 @@
+/*
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
#include <botan/botan.h>
#include <botan/serpent.h>
diff --git a/doc/examples/passhash.cpp b/doc/examples/passhash.cpp
index 7f5bbc2bb..24f7ff674 100644
--- a/doc/examples/passhash.cpp
+++ b/doc/examples/passhash.cpp
@@ -1,3 +1,9 @@
+/*
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
#include <botan/botan.h>
#include <botan/pbkdf2.h>
#include <botan/hmac.h>
diff --git a/doc/examples/pkcs10.cpp b/doc/examples/pkcs10.cpp
index d9fa9accb..3f5ec8e05 100644
--- a/doc/examples/pkcs10.cpp
+++ b/doc/examples/pkcs10.cpp
@@ -1,12 +1,9 @@
/*
-Generate a 1024 bit RSA key, and then create a PKCS #10 certificate request for
-that key. The private key will be stored as an encrypted PKCS #8 object, and
-stored in another file.
-
-Written by Jack Lloyd ([email protected]), April 7, 2003
-
-This file is in the public domain
+* (C) 2003 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
*/
+
#include <botan/init.h>
#include <botan/auto_rng.h>
#include <botan/x509self.h>
diff --git a/doc/examples/pqg_gen.cpp b/doc/examples/pqg_gen.cpp
index e4b959883..4104e8ecb 100644
--- a/doc/examples/pqg_gen.cpp
+++ b/doc/examples/pqg_gen.cpp
@@ -1,3 +1,9 @@
+/*
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
#include <iostream>
#include <fstream>
#include <string>
diff --git a/doc/examples/read_ssh.cpp b/doc/examples/read_ssh.cpp
index a88306caa..52c758ceb 100644
--- a/doc/examples/read_ssh.cpp
+++ b/doc/examples/read_ssh.cpp
@@ -1,4 +1,10 @@
/*
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+/*
* Example of reading SSH2 format public keys (see RFC 4716)
*/
diff --git a/doc/examples/ressol.cpp b/doc/examples/ressol.cpp
index 43bb68d37..286377fc6 100644
--- a/doc/examples/ressol.cpp
+++ b/doc/examples/ressol.cpp
@@ -1,3 +1,9 @@
+/*
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
#include <botan/numthry.h>
#include <botan/auto_rng.h>
#include <botan/botan.h>
diff --git a/doc/examples/rng_test.cpp b/doc/examples/rng_test.cpp
index 8d4253a6e..05f2c28a4 100644
--- a/doc/examples/rng_test.cpp
+++ b/doc/examples/rng_test.cpp
@@ -1,3 +1,9 @@
+/*
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
#include <botan/botan.h>
#include <botan/x931_rng.h>
#include <botan/filters.h>
diff --git a/doc/examples/row_encryptor.cpp b/doc/examples/row_encryptor.cpp
index 162e962e0..17f44ce7b 100644
--- a/doc/examples/row_encryptor.cpp
+++ b/doc/examples/row_encryptor.cpp
@@ -1,3 +1,9 @@
+/*
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
#include <string>
#include <memory>
#include <sstream>
@@ -99,8 +105,8 @@ std::string Row_Encryptor::decrypt(const std::string& input,
return dec_pipe.read_all_as_string(Pipe::LAST_MESSAGE);
}
-/*************************
- Test code follows:
+/*
+* Test code follows:
*/
int main()
diff --git a/doc/examples/rsa_dec.cpp b/doc/examples/rsa_dec.cpp
index 25ce33f47..1e789d748 100644
--- a/doc/examples/rsa_dec.cpp
+++ b/doc/examples/rsa_dec.cpp
@@ -1,11 +1,13 @@
/*
+* (C) 2002 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+/*
Decrypt an encrypted RSA private key. Then use that key to decrypt a
message. This program can decrypt messages generated by rsa_enc, and uses the
same key format as that generated by rsa_kgen.
-
-Written by Jack Lloyd ([email protected]), June 3-5, 2002
-
-This file is in the public domain
*/
#include <iostream>
diff --git a/doc/examples/rsa_enc.cpp b/doc/examples/rsa_enc.cpp
index f9b8c5561..904b1e379 100644
--- a/doc/examples/rsa_enc.cpp
+++ b/doc/examples/rsa_enc.cpp
@@ -1,4 +1,10 @@
/*
+* (C) 2002 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+/*
Grab an RSA public key from the file given as an argument, grab a message
from another file, and encrypt the message.
@@ -18,12 +24,6 @@
the _plaintext_
3) Following lines are base64 encoded ciphertext (CAST-128 as described),
each broken after ~72 characters.
-
-Written by Jack Lloyd ([email protected]), June 3, 2002
- Updated to use KDF2, September 8, 2002
- Updated to read X.509 keys, October 21, 2002
-
-This file is in the public domain
*/
#include <iostream>
diff --git a/doc/examples/rsa_kgen.cpp b/doc/examples/rsa_kgen.cpp
index b7e90ef8a..1108b46db 100644
--- a/doc/examples/rsa_kgen.cpp
+++ b/doc/examples/rsa_kgen.cpp
@@ -1,12 +1,13 @@
/*
+* (C) 2002 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+/*
Generate an RSA key of a specified bitlength, and put it into a pair of key
files. One is the public key in X.509 format (PEM encoded), the private key is
in PKCS #8 format (also PEM encoded).
-
-Written by Jack Lloyd ([email protected]), June 2-3, 2002
- Updated to use X.509 and PKCS #8 on October 21, 2002
-
-This file is in the public domain
*/
#include <iostream>
diff --git a/doc/examples/rsa_manykey.cpp b/doc/examples/rsa_manykey.cpp
index 4122bc8ef..e6a511753 100644
--- a/doc/examples/rsa_manykey.cpp
+++ b/doc/examples/rsa_manykey.cpp
@@ -1,4 +1,10 @@
/*
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+/*
Generate a whole sequence of keys (for benchmarking)
*/
diff --git a/doc/examples/self_sig.cpp b/doc/examples/self_sig.cpp
index 93161f7d2..6710cfb51 100644
--- a/doc/examples/self_sig.cpp
+++ b/doc/examples/self_sig.cpp
@@ -1,14 +1,17 @@
/*
-Generate a 1024 bit RSA key, and then create a self-signed X.509v3 certificate
-with that key. If the do_CA variable is set to true, then it will be marked for
-CA use, otherwise it will get extensions appropriate for use with a client
-certificate. The private key is stored as an encrypted PKCS #8 object in
-another file.
-
-Written by Jack Lloyd ([email protected]), April 7, 2003
+* (C) 2003 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
-This file is in the public domain
+/*
+Generate a 1024 bit RSA key, and then create a self-signed X.509v3
+certificate with that key. If the do_CA variable is set to true, then
+it will be marked for CA use, otherwise it will get extensions
+appropriate for use with a client certificate. The private key is
+stored as an encrypted PKCS #8 object in another file.
*/
+
#include <botan/botan.h>
#include <botan/x509self.h>
#include <botan/rsa.h>
diff --git a/doc/examples/sig_gen.cpp b/doc/examples/sig_gen.cpp
index 6dd749097..fca069862 100644
--- a/doc/examples/sig_gen.cpp
+++ b/doc/examples/sig_gen.cpp
@@ -1,3 +1,9 @@
+/*
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
#include <iostream>
#include <fstream>
#include <string>
diff --git a/doc/examples/stack.cpp b/doc/examples/stack.cpp
index 1522b05f5..f569004fc 100644
--- a/doc/examples/stack.cpp
+++ b/doc/examples/stack.cpp
@@ -1,11 +1,13 @@
/*
-An Botan example application showing how to use the pop and prepend functions
-of Pipe. Based on the md5 example. It's output should always be identical to
-such.
-
-Written by Jack Lloyd ([email protected]), Feb 3, 2002
+* (C) 2002 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
-This file is in the public domain
+/*
+An Botan example application showing how to use the pop and prepend
+functions of Pipe. Based on the md5 example. It's output should always
+be identical to such.
*/
#include <iostream>
diff --git a/doc/examples/test_es.cpp b/doc/examples/test_es.cpp
index b5510ab75..ef5d02281 100644
--- a/doc/examples/test_es.cpp
+++ b/doc/examples/test_es.cpp
@@ -1,3 +1,9 @@
+/*
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
#include <botan/botan.h>
#include <stdio.h>
diff --git a/doc/examples/tss.cpp b/doc/examples/tss.cpp
index 1881ffe24..03d7699bf 100644
--- a/doc/examples/tss.cpp
+++ b/doc/examples/tss.cpp
@@ -1,3 +1,9 @@
+/*
+* (C) 2009 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
#include <botan/botan.h>
#include <botan/tss.h>
#include <iostream>
diff --git a/doc/examples/x509info.cpp b/doc/examples/x509info.cpp
index 0e34f2fab..8f4d83c45 100644
--- a/doc/examples/x509info.cpp
+++ b/doc/examples/x509info.cpp
@@ -1,12 +1,10 @@
/*
- Read an X.509 certificate, and print various things about it
-
- Written by Jack Lloyd, March 23 2003
- - October 31, 2003: Prints the public key
- - November 1, 2003: Removed the -d flag; it can tell automatically now
-
- This file is in the public domain
+* Read an X.509 certificate, and print various things about it
+* (C) 2003 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
*/
+
#include <botan/botan.h>
#include <botan/x509cert.h>
#include <botan/oids.h>
diff --git a/doc/examples/xor_ciph.cpp b/doc/examples/xor_ciph.cpp
index 6a914b150..3174e103e 100644
--- a/doc/examples/xor_ciph.cpp
+++ b/doc/examples/xor_ciph.cpp
@@ -1,11 +1,11 @@
/*
- An implementation of the highly secure (not) XOR cipher. AKA, how to write
- and use your own cipher object. DO NOT make up your own ciphers. Please.
-
- Written by Jack Lloyd ([email protected]) on Feb 17, 2004
- Update November 21 2008 for new algorithm factory in 1.8
+* (C) 2004,2008 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
- This file is in the public domain
+/*
+ Adding a simple XOR cipher to the internal tables
*/
#include <botan/stream_cipher.h>