且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Python - requests.exceptions.SSLError - dh 键太小

更新时间:2022-05-06 18:46:31

禁用警告或证书验证无济于事.潜在的问题是服务器使用的弱 DH 密钥可能会在 Logjam Attack 中被滥用.

Disabling warnings or certificate validation will not help. The underlying problem is a weak DH key used by the server which can be misused in the Logjam Attack.

要解决此问题,您需要选择一种不使用 Diffie Hellman 密钥交换的密码,因此不受弱 DH 密钥的影响.并且这个密码必须得到服务器的支持.不知道服务器支持什么,但您可以尝试使用密码 AES128-SHAHIGH:!DH:!aNULL

To work around this you need to chose a cipher which does not make any use of Diffie Hellman Key Exchange and thus is not affected by the weak DH key. And this cipher must be supported by the server. It is unknown what the server supports but you might try with the cipher AES128-SHA or a cipher set of HIGH:!DH:!aNULL

将请求与您自己的密码集一起使用很棘手.请参阅为什么 Python 请求忽略验证参数?示例.

Using requests with your own cipher set is tricky. See Why does Python requests ignore the verify parameter? for an example.