diff options
| author | Antoine Pitrou <solipsis@pitrou.net> | 2014-03-22 17:14:57 (GMT) |
|---|---|---|
| committer | Antoine Pitrou <solipsis@pitrou.net> | 2014-03-22 17:14:57 (GMT) |
| commit | 39b7fce82d0ac9075235caa628a2b08e0503685b (patch) | |
| tree | e01e9995656544d16e0ace1766259d1eb2335a36 /Lib/test | |
| parent | 92497a42b7fac82363182e030d458704779a787e (diff) | |
| parent | 0bebbc33faae7ac10e7a7980b260e786f05d81bf (diff) | |
| download | cpython-39b7fce82d0ac9075235caa628a2b08e0503685b.zip cpython-39b7fce82d0ac9075235caa628a2b08e0503685b.tar.gz cpython-39b7fce82d0ac9075235caa628a2b08e0503685b.tar.bz2 | |
Issue #21015: SSL contexts will now automatically select an elliptic curve for ECDH key exchange on OpenSSL 1.0.2 and later, and otherwise default to "prime256v1".
(should also fix a buildbot failure introduced by #20995)
Diffstat (limited to 'Lib/test')
| -rw-r--r-- | Lib/test/test_ssl.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 1a2a9f0..891720e 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -2567,6 +2567,18 @@ else: s.connect((HOST, server.port)) self.assertIn("no shared cipher", str(server.conn_errors[0])) + @unittest.skipUnless(ssl.HAS_ECDH, "test requires ECDH-enabled OpenSSL") + def test_default_ecdh_curve(self): + # Issue #21015: elliptic curve-based Diffie Hellman key exchange + # should be enabled by default on SSL contexts. + context = ssl.SSLContext(ssl.PROTOCOL_SSLv23) + context.load_cert_chain(CERTFILE) + context.set_ciphers("ECDH") + with ThreadedEchoServer(context=context) as server: + with context.wrap_socket(socket.socket()) as s: + s.connect((HOST, server.port)) + self.assertIn("ECDH", s.cipher()[0]) + @unittest.skipUnless("tls-unique" in ssl.CHANNEL_BINDING_TYPES, "'tls-unique' channel binding not available") def test_tls_unique_channel_binding(self): |
