[PYTHON-CRYPTO] M2Crypto: Loading own cert and key from BIO

Latitia Haskins latitia.haskins at GMAIL.COM
Thu Mar 15 18:52:36 CET 2007


Hi Egil,

I'm not sure about the version that you listed (typo maybe?). If I am
understanding your question correctly, you want to look at the
load_cert_chain() method in the Context class. It takes the filename where
the certificate is stored.

Latitia

On 3/15/07, Egil Möller <redhog at redhog.org> wrote:
>
> Hi!
> In modern M2Crypto:s (0.1.16) you can load certificates (including CA
> cert) to use to verify the peer's cert into a context from e.g. a
> database with:
>
> def loadCert(ctx, certDataAsString):
>         store = ctx.get_cert_store()
>         bio = M2Crypto.BIO.MemoryBuffer()
>         bio.write(certDataAsString)
>         store.add_x509(M2Crypto.X509.load_cert_bio(bio))
>
> But how do you load your own cert and key from a string, that is, a call
> analogous to ctx.load_cert(filename)?
>
> I am developing a peer-to-peer protocol, and would like to store
> everything at a node in its database, even the certificate and key for
> the node.
>
> Thanks in advance,
> Egil Möller
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-crypto/attachments/20070315/41f94c6a/attachment.html>


More information about the python-crypto mailing list