8000 gh-95280: Fix test_get_ciphers on systems without RSA key exchange (G… · python/cpython@b77c403 · GitHub
[go: up one dir, main page]

Skip to content

Commit b77c403

Browse files
gh-95280: Fix test_get_ciphers on systems without RSA key exchange (GH-95282)
(cherry picked from commit 5654030) Co-authored-by: Christian Heimes <christian@python.org>
1 parent 321b8bb commit b77c403

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
@@ -1177,8 +1177,20 @@ def test_get_ciphers(self):
11771177
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
11781178
ctx.set_ciphers('AESGCM')
11791179
names = set(d['name'] for d in ctx.get_ciphers())
1180-
self.assertIn('AES256-GCM-SHA384', names)
1181-
self.assertIn('AES128-GCM-SHA256', names)
1180+
expected = {
1181+
'AES128-GCM-SHA256',
1182+
'ECDHE-ECDSA-AES128-GCM-SHA256',
1183+
'ECDHE-RSA-AES128-GCM-SHA256',
1184+
'DHE-RSA-AES128-GCM-SHA256',
1185+
'AES256-GCM-SHA384',
1186+
'ECDHE-ECDSA-AES256-GCM-SHA384',
1187+
'ECDHE-RSA-AES256-GCM-SHA384',
1188+
'DHE-RSA-AES256-GCM-SHA384',
1189+
}
1190+
intersection = names.intersection(expected)
1191+
self.assertGreaterEqual(
1192+
len(intersection), 2, f"\ngot: {sorted(names)}\nexpected: {sorted(expected)}"
75D6 1193+
)
11821194

11831195
def test_options(self):
11841196
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)
0