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

Skip to content

Commit bea2e58

Browse files
tiranmiss-islington
authored andcommitted
pythongh-95280: Fix test_get_ciphers on systems without RSA key exchange (pythonGH-95282)
(cherry picked from commit 5654030) Co-authored-by: Christian Heimes <christian@python.org>
1 parent cd0a59f commit bea2e58

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
@@ -1165,8 +1165,20 @@ def test_get_ciphers(self):
11651165
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
11661166
ctx.set_ciphers('AESGCM')
11671167
names = set(d['name'] for d in ctx.get_ciphers())
1168-
self.assertIn('AES256-GCM-SHA384', names)
1169-
self.assertIn('AES128-GCM-SHA256', names)
1168+
expected = {
1169+
'AES128-GCM-SHA256',
1170+
'ECDHE-ECDSA-AES128-GCM-SHA256',
1171+
'ECDHE-RSA-AES128-GCM-SHA256',
1172+
'DHE-RSA-AES128-GCM-SHA256',
1173+
'AES256-GCM-SHA384',
1174+
'ECDHE-ECDSA-AES256-GCM-SHA384',
1175+
'ECDHE-RSA-AES256-GCM-SHA384',
1176+
'DHE-RSA-AES256-GCM-SHA384',
1177+
}
1178+
intersection = names.intersection(expected)
1179+
self.assertGreaterEqual(
1180+
len(intersection), 2, f"\ngot: {sorted(names)}\nexpected: {sorted(expected)}"
1181+
)
11701182

11711183
def test_options(self):
11721184
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