diff options
author | Christian Heimes <christian@python.org> | 2016-09-05 22:04:45 (GMT) |
---|---|---|
committer | Christian Heimes <christian@python.org> | 2016-09-05 22:04:45 (GMT) |
commit | 25bfcd5d9eb324128e52d35c508621e017791f2b (patch) | |
tree | 9f5053f612cae587a2d91c1346f5c2aac7a66b71 /Lib | |
parent | dffa3949c7431e819c64a890bce41fe769e47da1 (diff) | |
download | cpython-25bfcd5d9eb324128e52d35c508621e017791f2b.zip cpython-25bfcd5d9eb324128e52d35c508621e017791f2b.tar.gz cpython-25bfcd5d9eb324128e52d35c508621e017791f2b.tar.bz2 |
Issue #27866: Add SSLContext.get_ciphers() method to get a list of all enabled ciphers.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_ssl.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index f6afa26..f19cf43 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -834,6 +834,15 @@ class ContextTests(unittest.TestCase): with self.assertRaisesRegex(ssl.SSLError, "No cipher can be selected"): ctx.set_ciphers("^$:,;?*'dorothyx") + @unittest.skipIf(ssl.OPENSSL_VERSION_INFO < (1, 0, 2, 0, 0), 'OpenSSL too old') + def test_get_ciphers(self): + ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx.set_ciphers('ECDHE+AESGCM:!ECDSA') + names = set(d['name'] for d in ctx.get_ciphers()) + self.assertEqual(names, + {'ECDHE-RSA-AES256-GCM-SHA384', + 'ECDHE-RSA-AES128-GCM-SHA256'}) + @skip_if_broken_ubuntu_ssl def test_options(self): ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) |