mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
Issue #10022: The dictionary returned by the getpeercert()
method
of SSL sockets now has additional items such as `issuer` and `notBefore`.
This commit is contained in:
parent
859c4ef0a0
commit
fb0469112f
4 changed files with 68 additions and 64 deletions
|
@ -109,7 +109,7 @@ class BasicSocketTests(unittest.TestCase):
|
|||
# note that this uses an 'unofficial' function in _ssl.c,
|
||||
# provided solely for this test, to exercise the certificate
|
||||
# parsing code
|
||||
p = ssl._ssl._test_decode_cert(CERTFILE, False)
|
||||
p = ssl._ssl._test_decode_cert(CERTFILE)
|
||||
if support.verbose:
|
||||
sys.stdout.write("\n" + pprint.pformat(p) + "\n")
|
||||
|
||||
|
@ -1059,6 +1059,11 @@ else:
|
|||
self.fail(
|
||||
"Missing or invalid 'organizationName' field in certificate subject; "
|
||||
"should be 'Python Software Foundation'.")
|
||||
self.assertIn('notBefore', cert)
|
||||
self.assertIn('notAfter', cert)
|
||||
before = ssl.cert_time_to_seconds(cert['notBefore'])
|
||||
after = ssl.cert_time_to_seconds(cert['notAfter'])
|
||||
self.assertLess(before, after)
|
||||
s.close()
|
||||
finally:
|
||||
server.stop()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue