[PYTHON-CRYPTO] M2Crypto & pkcs12 question

Ng Pheng Siong ngps at POST1.COM
Mon May 17 18:18:01 CEST 2004


On Sat, May 15, 2004 at 03:24:02PM +0300, Ruslan wrote:
> Is it possible programmatically using M2Crypto to convert pkcs12
> certificate into pem one, like we can do with openssl command line?

Possible - yes. Functionality available now - I think not.

Just to be sure, do you mean "openssl pkcs12 ..."?

> If it's not possible now, can you point where to start to implement this
> by adding/modifying M2Crypto source?

Suppose you want to implement "openssl pkcs12 some-specific-operation".

Look in <openssl>/apps/pkcs12.c for the parts that implement
some-specific-operation. Note the structures and functions used. See
<openssl>/include/pkcs12.h for the definitions of said structures and
functions.

Now create a file <m2crypto>/SWIG/_pkcs12.i.  Add whatever glue code is
necessary so that Python and C code can pass pointers to the identified
structures back and forth, Python can invoke the C functions, the C
functions can raise Python exceptions and perhaps callback into Python.

Next create a file <m2crypto>/M2Crypto/PKCS12.py. Add Python wrapper
classes to the pointers to structures; the glue functions that work on said
structures become methods of these Python OO wrapper classes. Add utility
functions at the module level for programmer convenience.

Create unit tests in Python.

Write doc strings! Please. ;-)

HTH. TIA for your patches. ;-)

--
Ng Pheng Siong <ngps at netmemetic.com>

http://firewall.rulemaker.net -+- Firewall Change Management & Version Control
http://sandbox.rulemaker.net/ngps -+- ZServerSSL/Zope Windows Installers




More information about the python-crypto mailing list