-
-
Save NCommander/04e34b3fcc4af347bcfedbc053b08c06 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mcasadevall@dawntreader:~/src$ cat ssl_test.py | |
import socket | |
import ssl | |
hostname = 'räksmörgås.josefsson.org' | |
context = ssl.create_default_context() | |
with socket.create_connection((hostname, 443)) as sock: | |
with context.wrap_socket(sock, server_hostname=hostname) as ssock: | |
print(ssock.version()) | |
mcasadevall@dawntreader:~/src$ python3 ssl_test.py | |
Traceback (most recent call last): | |
File "ssl_test.py", line 8, in <module> | |
with context.wrap_socket(sock, server_hostname=hostname) as ssock: | |
File "/usr/lib/python3.6/ssl.py", line 407, in wrap_socket | |
_context=self, _session=session) | |
File "/usr/lib/python3.6/ssl.py", line 814, in __init__ | |
self.do_handshake() | |
File "/usr/lib/python3.6/ssl.py", line 1068, in do_handshake | |
self._sslobj.do_handshake() | |
File "/usr/lib/python3.6/ssl.py", line 694, in do_handshake | |
match_hostname(self.getpeercert(), self.server_hostname) | |
File "/usr/lib/python3.6/ssl.py", line 331, in match_hostname | |
% (hostname, dnsnames[0])) | |
ssl.CertificateError: hostname 'räksmörgås.josefsson.org' doesn't match 'xn--rksmrgs-5wao1o.josefsson.org' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment