This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author christian.heimes
Recipients christian.heimes
Date 2013-12-16.19:14:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1387221248.69.0.21130005011.issue20000@psf.upfronthosting.co.za>
In-reply-to
Content
Example:

$ openssl s_server -cert Lib/test/ssl_cert.pem -key Lib/test/ssl_key.pem

$ ./python
>>> import ssl
>>> ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv3)
>>> ctx.verify_mode = ssl.CERT_REQUIRED
>>> ctx.check_hostname = True
>>> ctx.load_verify_locations("Lib/test/ssl_cert.pem")
>>> s = ssl.create_connection(("localhost", 4433))
>>> with ctx.wrap_socket(s, server_hostname="localhost") as ssock:
...     peer = ssock.getpeercert()
... 
>>> peer
{'notAfter': 'Oct  5 23:01:56 2020 GMT', 'version': 3, 'serialNumber': 'D7C7381919AFC24E', 'subjectAltName': (('DNS', 'localhost'),), 'issuer': ((('countryName', 'XY'),), (('localityName', 'Castle Anthrax'),), (('organizationName', 'Python Software Foundation'),), (('commonName', 'localhost'),)), 'subject': ((('countryName', 'XY'),), (('localityName', 'Castle Anthrax'),), (('organizationName', 'Python Software Foundation'),), (('commonName', 'localhost'),)), 'notBefore': 'Oct  8 23:01:56 2010 GMT'}
>>> ctx.get_ca_certs()
[]
History
Date User Action Args
2013-12-16 19:14:08christian.heimessetrecipients: + christian.heimes
2013-12-16 19:14:08christian.heimessetmessageid: <1387221248.69.0.21130005011.issue20000@psf.upfronthosting.co.za>
2013-12-16 19:14:08christian.heimeslinkissue20000 messages
2013-12-16 19:14:07christian.heimescreate