diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2014-03-22 17:13:50 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2014-03-22 17:13:50 (GMT) |
commit | 0bebbc33faae7ac10e7a7980b260e786f05d81bf (patch) | |
tree | 3a14bed28319e8cd67e99b6e5febe0befbbc6e08 /Lib | |
parent | 79ccaa2cad2a13f0da2f900a0f9f61cd6b619c99 (diff) | |
download | cpython-0bebbc33faae7ac10e7a7980b260e786f05d81bf.zip cpython-0bebbc33faae7ac10e7a7980b260e786f05d81bf.tar.gz cpython-0bebbc33faae7ac10e7a7980b260e786f05d81bf.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')
-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): |