QT“SSL not supported“ 解决方案

文章声明:下述所有文字均手写,并真实尝试,无任何AI代写,老子玩的就是真实,如果有用,点个赞给小子呗

适用场景:本文适用于使用qt soket相关网络模块需要向https发送请求的问题

问题描述:

 

2025-02-24 19:19:14:	0x0000a528 Debug:	SSL not supported!	

或者访问https失败显示tls相关问题的

问题原因:

        由于PC没有安装openssl等相关认证的库,导致qt ssl初始化失败

解决方案

步骤三:

先在你的代码块中加上下述代码,debug打印你qt版本对应的openssl

   if (QSslSocket::supportsSsl()) {
       qDebug() << "SSL not supported!";
       qDebug() << "SSL version:" << QSslSocket::sslLibraryVersionString();
       qDebug() << "SSL library:" << QSslSocket::sslLibraryBuildVersionString();
   } else {
       qDebug() << "SSL supported!";
   }

 如果不支持会有下面打印

 2025-02-24 19:19:14:	0x0000a528 Debug:	SSL not supported!	(244, ..\..\src\sureprint\sureprint.cpp, void __thiscall SurePrint::downloadPdf(const class QUrl))
 2025-02-24 19:19:14:	0x0000a528 Debug:	SSL version: "OpenSSL 1.1.0h  27 Mar 2018"	(245, ..\..\src\sureprint\sureprint.cpp, void __thiscall SurePrint::downloadPdf(const class QUrl))
 2025-02-24 19:19:14:	0x0000a528 Debug:	SSL library: ""	(246, ..\..\src\sureprint\sureprint.cpp, void __thiscall SurePrint::downloadPdf(const class QUrl))

凡是显示1.x.x都可以使用openssl相关的包,大版本不变即可

步骤二:

安装openssl 参考:Ahua-Tan/openssl1.1

32位包网址:https://github.com/Ahua-Tan/openssl1.1/releases/download/openssl-1.1.0_h/Win32OpenSSL-1_1_0h.exe

64位包网址: https://github.com/Ahua-Tan/openssl1.1/releases/download/openssl-1.1.0_h/Win64OpenSSL-1_1_0h.exe

在安装界面最后把bin安装在软件安装目录中

步骤三:将下面两个dll放到对应编译器的bin文件夹下如下图

64位的库就放64位对应的bin里面

最后完成,在尝试可正常了,如有问题可留言,老子天天当牛马,最少8小时在线!!!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

Ahua-软华神

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

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

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

打赏作者

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

抵扣说明:

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

余额充值