M2Crypto: Loading own cert and key from BIO

Egil Möller <[email protected]>
Newsgroups gmane.comp.python.cryptography
Message-ID <[email protected]>
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
redhog.vcf (text/x-vcard, 199 B)
begin:vcard
fn;quoted-printable:Egil M=C3=B6ller
n;quoted-printable:M=C3=B6ller;Egil
email;internet:[email protected]
tel;cell:+46-(0)709-707207
url:http://redhog.org
version:2.1
end:vcard
signature.asc (application/pgp-signature, 254 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF+RiGq2gNae2l66YRAtYCAJ4v/UajTrfDRvYOvKAoiC5YoIj1HwCeOvFD
Uw+qM4pHEPMBJGXUtC1wiBY=
=DbCN
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.