SSL follow up
Heikki Toivonen
heikki at osafoundation.org
Wed Oct 25 15:07:53 EDT 2006
Yogesh Chawla - PD wrote:
> I have 2 questions. 1) How do we get the Server cert
> in python. John wrote: "Nor does there seem to be a
> way to get at the certificate itself from within
> Python." Perhaps pycurl will allow us to do this. Is
> there another method to get the server cert?
Here's an example with M2Crypto:
from M2Crypto import SSL
ctx = SSL.Context()
conn = SSL.Connection(ctx)
conn.connect(('www.verisign.com', 443))
cert = conn.get_peer_cert()
> 2) I like the idea of calling openssl in a subprocess.
> Do you have any of those openssl commands handy? If
> not, I can look through the documentation tommorrow.
I would be surprised if M2Crypto did not provide what you want. If it
doesn't, I'd be happy to add the functionality.
--
Heikki Toivonen
More information about the Python-list
mailing list