tags:

views:

87

answers:

2

I'm trying to generate a CSR in Python without using OpenSSL. If someone could point in the right direction, I'd be very grateful.

A: 

Like any language, Python just implements algorithms. I know next to nothing about cryptography, but if I had to implement this in Python, I would look for a specification on how to implement CSR.

Via Google and Wikipedia I found this RFC. Your task would be to implement this in Python.

Personally I'd probably first try to use a the command line tool (perhaps via a call to the system() function if it needed to be from Python).

Sean Woods
+1  A: 

m2crypto could be a solution (see CreateX509Request in the contrib example), although it relies OpenSSL.

You could also use python-nss, which uses Mozilla's NSS library. nss.nss.CertificateRequest was added quite recently. The API documentation available at the moment on the website isn't up to date, but here are some pointers for newer versions:

It's also in CVS:

:pserver:[email protected]:/cvsroot/mozilla/security/python/nss 
Bruno