Qt5.9.12.7 Https访问TLS initialization failed错误

1.错误产生原因:

对于高于(且包含)Qt5.12.4的QT版本,在https请求时,会使用OpenSSL加密.
在Qt官网给出的release note里写的


 We wanted to update now as the earlier version of OpenSSL runs out of support 
 at the end of the year . Unfortunately OpenSSL 1.1 is binary incompatible with 1.0,
 so users need to switch to the new one and repackage their applications.
 One important functionality enabled by OpenSSL 1.1 is TLS 1.3 bringing significant
 cryptography and speed improvements.

大意就是 Qt自带的老版本OpenSSL1.0.x在今年(2019)就要结束LTS支持了,那么从本版本开始(5.12.4)Qt将启用1.1.x,新版本带来的TLS1.3很牛逼blabla,
但我就搞不懂了,你升级就升级,把dll的名字改了干嘛啊?以前经典的libeay32.dllssleay32.dll变成了libcrypto-1_1.dll** 和libssl-1_1.dll.

去OpenSSL官网看了下,也是这么说的

 he latest stable version is the 1.1.1 series. This is also our Long Term Support 
 (LTS) version,  supported until 11th September 2023. Our previous LTS version 
 (1.0.2 series) will continue to be supported until 31st December 2019 
 (security fixes only during the last year of support)
 The latest stable version is the 1.1.1 series.  This is also our Long Term Support
 (LTS) version, supported until 11th September 2023.  Our previous LTS version 
 (1.0.2 series) will continue to be supported until 31st December 2019 
 (security fixes only during the last year of support)

2. 解决方法:

2.1.找到Qt里的OpenSSL版本号:

qDebug()<<QSslSocket::sslLibraryBuildVersionString();
//输出如下:OpenSSL 1.1.1d  26 Feb 2019

2.2下载安装OpenSSL1.1.1的二进制文件

http://slproweb.com/products/Win32OpenSSL.html
注意根据自己需要的是32位还是64位选择对应的包。我下载的是Win32OpenSSL_Light-1_1_1d.exe
安装好之后将libcrypto-1_1.dlllibssl-1_1.dll两个文件拷贝到D:\Qt\Qt5.12.7\Tools\mingw730_32\bin文件夹下即可

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值