Customizing SSL ciphers #2030
-
Hi, I'm trying to connect to a server that I have no control over, which seems to default to an insecure DH cipher, resulting in: With Requests I'm able to set lower/insecure ciphers if necessary using: requests.packages.urllib3.util.ssl_.DEFAULT_CIPHERS += ':RC4-SHA' Can I do something similar with httpx? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
You can pass a custom You probably need something like this?... import certifi
import ssl
import httpx
def custom_ssl_context()
context = ssl.create_default_context()
context.load_verify_locations(certifi.where())
context.set_ciphers(...)
return context
ssl_context = custom_ssl_context()
client = httpx.Client(ssl_context=ssl_context) |
Beta Was this translation helpful? Give feedback.
-
Thanks Tom. I'm guessing you meant to use the 'verify' parameter, instead of ssl_context that you've used in your code sample. I've got it working now by setting the ciphers to 'DEFAULT:!DH' as the Diffie Hellman ciphers were the insecure ones causing the issue. |
Beta Was this translation helpful? Give feedback.
You can pass a custom
ssl_context
to the client instance.You probably need something like this?...