MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_dh_params

Method test_dh_params

Lib/test/test_ssl.py:4098–4122  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

4096 sni_name=hostname)
4097
4098 def test_dh_params(self):
4099 # Check we can get a connection with ephemeral finite-field
4100 # Diffie-Hellman (if supported).
4101 client_context, server_context, hostname = testing_context()
4102 dhe_aliases = {"ADH", "EDH", "DHE"}
4103 if not (supports_kx_alias(client_context, dhe_aliases)
4104 and supports_kx_alias(server_context, dhe_aliases)):
4105 self.skipTest("libssl doesn't support ephemeral DH")
4106 # test scenario needs TLS <= 1.2
4107 client_context.maximum_version = ssl.TLSVersion.TLSv1_2
4108 try:
4109 server_context.load_dh_params(DHFILE)
4110 except RuntimeError:
4111 if Py_DEBUG_WIN32:
4112 self.skipTest("not supported on Win32 debug build")
4113 raise
4114 server_context.set_ciphers("kEDH")
4115 server_context.maximum_version = ssl.TLSVersion.TLSv1_2
4116 stats = server_params_test(client_context, server_context,
4117 chatty=True, connectionchatty=True,
4118 sni_name=hostname)
4119 cipher = stats["cipher"][0]
4120 parts = cipher.split("-")
4121 if not dhe_aliases.intersection(parts):
4122 self.fail("Non-DH key exchange: " + cipher[0])
4123
4124 def test_ecdh_curve(self):
4125 # server secp384r1, client auto

Callers

nothing calls this directly

Calls 9

testing_contextFunction · 0.85
supports_kx_aliasFunction · 0.85
server_params_testFunction · 0.85
skipTestMethod · 0.80
load_dh_paramsMethod · 0.45
set_ciphersMethod · 0.45
splitMethod · 0.45
intersectionMethod · 0.45
failMethod · 0.45

Tested by

no test coverage detected