I've finally gotten around to writing some examples :-)

They aren't many, but at least it's something. If you write any, feel free to
send them to me and I will add themn.


certgen.py - Certificate generation module
==========================================

Example module with three functions:
  createKeyPair     - Create a public/private key pair
  createCertRequest - Create a certificate request
  createCertificate - Create a certificate given a cert request
In fact, I created the certificates and keys in the 'simple' directory with
these few commands:

from OpenSSL import crypto
from certgen import *   # yes yes, I know, I'm lazy
cakey = createKeyPair(TYPE_RSA, 1024)
careq = createCertRequest(cakey, CN='Certificate Authority')
cacert = createCertificate(careq, (careq, cakey), (0, 60*60*24*365))
open('simple/CA.pkey', 'w').write(crypto.dump_privatekey(crypto.FILETYPE_PEM, cakey))
open('simple/CA.cert', 'w').write(crypto.dump_certificate(crypto.FILETYPE_PEM, cacert))
for (fname, cname) in [('client', 'Simple Client'), ('server', 'Simple Server')]:
    pkey = createKeyPair(TYPE_RSA, 1024)
    req = createCertRequest(pkey, CN=cname)
    cert = createCertificate(req, (cacert, cakey), (0, 60*60*24*365))
    open('simple/'+fname+'.pkey', 'w').write(crypto.dump_privatekey(crypto.FILETYPE_PEM, pkey))
    open('simple/'+fname+'.cert', 'w').write(crypto.dump_certificate(crypto.FILETYPE_PEM, cert))


simple - Simple client/server example
=====================================

Start the server with
    python server.py PORT
and start clients with
    python client.py PORT

The server is a simple echo server, anything a client sends, it sends back.

