This is the text of the first answer I’ve posted on Stack Overflow. You can see it in context , but I’ve posted it here with all the links:
My blog post (the http://passingcuriosity.com/2009/aes-encryption-in-python-with-m2crypto/ link in John Boker’s answer) does AES – a symmetric encryption algorithm – using the M2Crypto. M2Crypto is a Python wrapper around OpenSSL. If the public key encryption algorithm you need to use is supported by M2Crypto, then you could very well use it to do your public key cryptography. The API is pretty much a straight translation of OpenSSL’s into Python, so the somewhat sketchy documentation shouldn’t be too much of a problem.
I found the M2Crypto test suite to be a useful example of using its API. In particular, the RSA, PGP, and EVP tests will help you figure out how to set up and use the library. Do be aware that they are unit-tests, so it can be a little tricky to figure out exactly what code is necessary and what is an artefact of being a test.