Skip to content

Commit

Permalink
gh-95280: Fix test_get_ciphers on systems without RSA key exchange (G…
Browse files Browse the repository at this point in the history
…H-95282) (GH-95323)

(cherry picked from commit 5654030)

Co-authored-by: Christian Heimes <christian@python.org>
  • Loading branch information
miss-islington and tiran committed Jul 29, 2022
1 parent 7b87765 commit 03dc951
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Lib/test/test_ssl.py
Expand Up @@ -1169,8 +1169,20 @@ def test_get_ciphers(self):
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
ctx.set_ciphers('AESGCM')
names = set(d['name'] for d in ctx.get_ciphers())
self.assertIn('AES256-GCM-SHA384', names)
self.assertIn('AES128-GCM-SHA256', names)
expected = {
'AES128-GCM-SHA256',
'ECDHE-ECDSA-AES128-GCM-SHA256',
'ECDHE-RSA-AES128-GCM-SHA256',
'DHE-RSA-AES128-GCM-SHA256',
'AES256-GCM-SHA384',
'ECDHE-ECDSA-AES256-GCM-SHA384',
'ECDHE-RSA-AES256-GCM-SHA384',
'DHE-RSA-AES256-GCM-SHA384',
}
intersection = names.intersection(expected)
self.assertGreaterEqual(
len(intersection), 2, f"\ngot: {sorted(names)}\nexpected: {sorted(expected)}"
)

def test_options(self):
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
Expand Down
@@ -0,0 +1,2 @@
Fix problem with ``test_ssl`` ``test_get_ciphers`` on systems that require
perfect forward secrecy (PFS) ciphers.

0 comments on commit 03dc951

Please sign in to comment.