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

Egil Möller redhog at REDHOG.ORG
Thu Mar 15 10:57:22 CET 2007


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 --------------
A non-text attachment was scrubbed...
Name: redhog.vcf
Type: text/x-vcard
Size: 198 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-crypto/attachments/20070315/08d1e1e1/attachment.vcf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-crypto/attachments/20070315/08d1e1e1/attachment.pgp>


More information about the python-crypto mailing list