verifying ssl certificates

Paul Rubin phr-n2002a at nightsong.com
Tue Apr 2 22:05:22 EST 2002


"Christopher N. Deckard" <cnd at ecn.purdue.edu> writes:
> In other words:
> 
> import socket
> 
> cert = open('my_cert')
> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> s.connect(('host', 'port'))
> ss = ssl(s, cert, None)
> 
> That last line being the key.  Does that do the certificate
> validation?

I'm not familiar with how the socket module does ssl, but if ssl() is
supposed to do an SSL session negotiation, then yes, it should check
the cert.



More information about the Python-list mailing list