SSL连接dh key too small

SSL连接dh key too small

问题

在进行SSL连接时,出现dh key too small,至于这种情况,是由 OpenSSL 的更改引起的,但问题实际上出在服务器端。服务器在密钥交换中使用弱 DH 密钥,并且由于Logjam 攻击,最新版本的 OpenSSL 强制执行非弱 DH 密钥。
在这里插入图片描述

解决办法

方法1

修改openssl配置文件,在linux下路径为/etc/ssl/openssl.cnf
[system_default_sect]
MinProtocol = TLSv1.2
CipherString = DEFAULT@SECLEVEL=2

修改为

[system_default_sect]
MinProtocol = TLSv1.2
CipherString = DEFAULT@SECLEVEL=1

当然修改这种配置文件,是不建议的

方法2

通过openssl api进行修改
SSL_CTX_set_security_level(ctx, 1);

方法3

在Qt环境下,qt开放了一个后门接口如下
qt_ForceTlsSecurityLevel();
在进行ssl连接前,调用一下即可,通过看源码,原理同上:
if (q_SSL_CTX_get_security_level(sslContext->ctx) > 1 && *forceSecurityLevel())
q_SSL_CTX_set_security_level(sslContext->ctx, 1);

方法4

在Qt环境下
void QSslConfiguration::setBackendConfigurationOption(const QByteArray &name, const QVariant &value)
Sets the option name in the backend-specific configuration to value.

Options supported by the OpenSSL (>= 1.0.2) backend are available in the supported configuration file commands documentation. The expected type for the value parameter is a QByteArray for all options. The examples show how to use some of the options.

Note: The backend-specific configuration will be applied after the general configuration. Using the backend-specific configuration to set a general configuration option again will overwrite the general configuration option.

This function was introduced in Qt 5.11.

setBackendConfigurationOption(“CipherString”, “DEFAULT@SECLEVEL=1”);

Qt交流群

Qt交流大会 853086607

QQ:3246214072
在这里插入图片描述

结尾

不定期上传新作品,解答群中作品相关问题。相关外,能解答则解答。欢迎大家一起探索Qt世界!

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

雨田哥

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值