Skip to content

Commit 131fc72

Browse files
[3.11] gh-95280: Fix test_get_ciphers on systems without RSA key exchange (GH-95282) (GH-95310)
Co-authored-by: Christian Heimes <[email protected]>
1 parent f083adf commit 131fc72

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

Lib/test/test_ssl.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,8 +1178,20 @@ def test_get_ciphers(self):
11781178
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
11791179
ctx.set_ciphers('AESGCM')
11801180
names = set(d['name'] for d in ctx.get_ciphers())
1181-
self.assertIn('AES256-GCM-SHA384', names)
1182-
self.assertIn('AES128-GCM-SHA256', names)
1181+
expected = {
1182+
'AES128-GCM-SHA256',
1183+
'ECDHE-ECDSA-AES128-GCM-SHA256',
1184+
'ECDHE-RSA-AES128-GCM-SHA256',
1185+
'DHE-RSA-AES128-GCM-SHA256',
1186+
'AES256-GCM-SHA384',
1187+
'ECDHE-ECDSA-AES256-GCM-SHA384',
1188+
'ECDHE-RSA-AES256-GCM-SHA384',
1189+
'DHE-RSA-AES256-GCM-SHA384',
1190+
}
1191+
intersection = names.intersection(expected)
1192+
self.assertGreaterEqual(
1193+
len(intersection), 2, f"\ngot: {sorted(names)}\nexpected: {sorted(expected)}"
1194+
)
11831195

11841196
def test_options(self):
11851197
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix problem with ``test_ssl`` ``test_get_ciphers`` on systems that require
2+
perfect forward secrecy (PFS) ciphers.

0 commit comments

Comments
 (0)