mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #27866: Add SSLContext.get_ciphers() method to get a list of all enabled ciphers.
This commit is contained in:
parent
dffa3949c7
commit
25bfcd5d9e
5 changed files with 211 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue