Re: [Python-Dev] PEP 476: Enabling certificate validation by default!

2014年9月03日 12:10:15 -0700

On 03.09.2014 19:29, Ethan Furman wrote:
> Excellent. Last question (I hope): it is possible to (easily) create an
> SSLContext that will verify against a self-signed certificate?
Yes:
 context = ssl.create_default_context(cafile="/path/to/selfsigned.pem")
That works iff the certificate is valid, not expired and its CN or SAN
matches the hostname of the service. When the hostname doesn't match
then you have to set
 context.check_hostname = False
Christian
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to