m2crypto loading cert file from memory buffer

Discussion in 'Python' started by netpork, Dec 4, 2008.

  1. netpork

    netpork Guest

    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.
     
    netpork, Dec 4, 2008
    #1
    1. Advertising

  2. 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/
     
    Heikki Toivonen, Dec 6, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Pedro Martins
    Replies:
    2
    Views:
    2,232
    Roedy Green
    Feb 24, 2006
  2. Replies:
    1
    Views:
    362
    Roger Binns
    May 10, 2005
  3. David Chan via .NET 247
    Replies:
    1
    Views:
    369
    Dominick Baier [DevelopMentor]
    Jun 2, 2005
  4. Replies:
    0
    Views:
    182
  5. Marc Aymerich

    Loading a PKCS#1 public key using M2Crypto

    Marc Aymerich, Jan 16, 2013, in forum: Python
    Replies:
    5
    Views:
    235
    Piet van Oostrum
    Jan 17, 2013
Loading...

Share This Page