Slide 10
Slide 10 text
ssl module 101, Python Pizza Hamburg 2019, @ChristianHeimes, CC BY-SA 4.0
10
Connecting to a server (2)
>>> ssock.sendall(b"GET / HTTP/1.1\r\nHost:hamburg.python.pizza\r\n\r\n")
45
>>> ssock.recv(17)
b'HTTP/1.1 200 OK\r\n'
>>> ssock.sendall(b"GET / HTTP/1.1\r\nHost:hamburg.python.pizza\r\n\r\n")
45
>>> ssock.recv(17)
b'HTTP/1.1 200 OK\r\n'
>>> ssock.cipher()
('TLS_AES_256_GCM_SHA384', 'TLSv1.3', 256)
('ECDHE-RSA-AES128-GCM-SHA256', 'TLSv1.2', 128)
>>> ssock.cipher()
('TLS_AES_256_GCM_SHA384', 'TLSv1.3', 256)
('ECDHE-RSA-AES128-GCM-SHA256', 'TLSv1.2', 128)
>>> pprint(ssock.getpeercert())
{'issuer': ((('countryName', 'US'),), (('organizationName', "Let's Encrypt"),),
(('commonName', "Let's Encrypt Authority X3"),)),
'notAfter': 'Jan 23 15:13:59 2020 GMT',
'notBefore': 'Oct 25 15:13:59 2019 GMT',
'serialNumber': '04475BA2081686AAEE9701B751A5F6597107',
'subject': ((('commonName', '*.naples.python.pizza'),),),
'subjectAltName': (('DNS', '*.naples.python.pizza'), ('DNS', '*.python.pizza'), ('DNS', 'python.pizza')),
'version': 3}
>>> pprint(ssock.getpeercert())
{'issuer': ((('countryName', 'US'),), (('organizationName', "Let's Encrypt"),),
(('commonName', "Let's Encrypt Authority X3"),)),
'notAfter': 'Jan 23 15:13:59 2020 GMT',
'notBefore': 'Oct 25 15:13:59 2019 GMT',
'serialNumber': '04475BA2081686AAEE9701B751A5F6597107',
'subject': ((('commonName', '*.naples.python.pizza'),),),
'subjectAltName': (('DNS', '*.naples.python.pizza'), ('DNS', '*.python.pizza'), ('DNS', 'python.pizza')),
'version': 3}