summaryrefslogtreecommitdiffstats
path: root/botan/doc/examples/readme.txt
blob: 48686db7161bc5e2a9ed98d47700e5a3186f92d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
This directory contains some simple example applications for the Botan crypto
library. If you want to see something a bit more complicated, check out the
stuff in the checks/ directory. Both it and the files in this directory are in
the public domain, and you may do with them however you please.

The makefile assumes that you built the library with g++; you'll have to change
it if this assumption proves incorrect.

Some of these examples will not build on all configurations of the library,
particularly 'bzip', 'encrypt', 'decrypt', and 'hash_fd', as they require
various extensions.

The examples are fairly small (50-150 lines). And that's with argument
processing, I/O, error checking, etc (which counts for 40% or more of most of
them). This is partially to make them easy to understand, and partially because
I'm lazy. For the most part, the examples cover the stuff a 'regular'
application might need.

Feel free to contribute new examples. You too can gain fame and fortune by
writing example apps for obscure libraries!

The examples are:

* X.509 examples
--------
ca: A (very) simple CA application

x509info: Prints some information about an X.509 certificate

pkcs10: Generates a PKCS #10 certificate request for a 1024 bit RSA key

self_sig: Generates a self-signed X.509v3 certificate with a 1024 bit RSA key
--------

* RSA examples (also uses X.509, PKCS #8, block ciphers, MACs, S2K algorithms)
--------
rsa_kgen: Generate an RSA key, encrypt the private key with a passphrase,
          output the keys to a pair of files
rsa_enc: Take a public key (generated by rsa_kgen) and encrypt a file
         using CAST-128, MAC it with HMAC(SHA-1)
rsa_dec: Decrypt a file encrypted by rsa_enc

* DSA examples (also uses X.509, PKCS #8)
--------
dsa_kgen: Generates a DSA key, encrypts the private key with a passphrase
          and stores it in PKCS #8 format.
dsa_sign: Produce a DSA signature for a file. Uses SHA-1
dsa_ver: Verify a message signed with dsa_sign

* Encryption examples
--------
encrypt: Encrypt a file in CBC mode with a block cipher of your choice. Adds
         a MAC for authentication, and compresses the plaintext with Zlib.

decrypt: Decrypt the result of 'encrypt'

xor_ciph: Shows how to add a new algorithm from application code

* Hash function examples (also shows different methods of using Pipe)
--------
hash: Print digests of files, using any chosen hash function

hash_fd: Same as hash, except that it uses Unix file I/O. Requires the
        pipe_unixfd extension

hasher: Print MD5, SHA-1, and RIPEMD-160 digests of files

hasher2: Same as hasher, just shows an alternate method

stack: A demonstration of some more advanced Pipe functionality. Prints
       MD5 hashes

* Misc examples
--------
base64: Simple base64 encoding/decoding tool

bzip: Bzip2 compression/decompression.