Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

m2crypto loading cert file from memory buffer

116 views
Skip to first unread message

netpork

unread,
Dec 4, 2008, 9:56:57 AM12/4/08
to
started using m2crypto recently, it works pretty well by now, i just
have one question:

ctx = SSL.Context('sslv3')
ctx.load_cert_chain('client.pem')

anyone knows a way of loading cert file from memory buffer and not
from a file?
i just do not want to have my cert file in the directory of my app
that anyone can get.

Heikki Toivonen

unread,
Dec 6, 2008, 12:05:00 AM12/6/08
to
netpork wrote:
> ctx = SSL.Context('sslv3')
> ctx.load_cert_chain('client.pem')
>
> anyone knows a way of loading cert file from memory buffer and not
> from a file?

Yeah, see for example how I did it for Chandler:
http://svn.osafoundation.org/chandler/trunk/chandler/parcels/osaf/framework/certstore/ssl.py
(the loadCertificatesToContext function). You just need an SSL.Context,
get_cert_store() from it, and call the store's add_x509() for each cert.

> i just do not want to have my cert file in the directory of my app
> that anyone can get.

Typically certificates are public, for example all of your peers will
get the certificate anyway, so I don't see this as a problem. Your
private key is what you want to protect. Just make sure it is not
concatenated to your certificate file and there would probably be no
problem leaving the cert file publicly available.

--
Heikki Toivonen - http://heikkitoivonen.net/blog/

0 new messages