summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ssl.py
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2016-09-05 22:04:45 (GMT)
committerChristian Heimes <christian@python.org>2016-09-05 22:04:45 (GMT)
commit25bfcd5d9eb324128e52d35c508621e017791f2b (patch)
tree9f5053f612cae587a2d91c1346f5c2aac7a66b71 /Lib/test/test_ssl.py
parentdffa3949c7431e819c64a890bce41fe769e47da1 (diff)
downloadcpython-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/test/test_ssl.py')
-rw-r--r--Lib/test/test_ssl.py9
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)