If you are playing around with certificates and other encryption tools such as Openssl or GNUTLS you may want to have a look at cryptlib. This is a really nice lib done by Peter Gutmann with a lot of bindings and particularly binding to python.
As I am working on SCEP implementation lately I hope this will be of some help to get to understand that damn protocol!
I am also running a build to RPM (and hopefully some deb later) for the library.
You can find it on OpenSUSE Build Service at home:sbarebreau:openca.