让openSSL在Mac上使用Qt [英] getting openSSL to work with Qt on mac

查看:858
本文介绍了让openSSL在Mac上使用Qt的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在对谷歌地图进行一些api调用,其中一些需要加密,所以我使用的是https。每当我使用https发出请求时,我都会收到错误:

I am making some api calls to google maps some of which need to be encrypted so i'm using https. Whenever I make a request using https I get the errors:

qt.network.ssl: QSslSocket: cannot resolve SSL_set_psk_client_callback
qt.network.ssl: QSslSocket: cannot resolve TLSv1_1_client_method
qt.network.ssl: QSslSocket: cannot resolve TLSv1_2_client_method
qt.network.ssl: QSslSocket: cannot resolve TLSv1_1_server_method
qt.network.ssl: QSslSocket: cannot resolve TLSv1_2_server_method
qt.network.ssl: QSslSocket: cannot resolve SSL_select_next_proto
qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_set_next_proto_select_cb
qt.network.ssl: QSslSocket: cannot resolve SSL_get0_next_proto_negotiated
qt.network.ssl: QSslSocket: cannot call unresolved function SSL_get0_next_proto_negotiated

我得到这些错误也在使用http时,但我仍然会收到我想要的数据,而使用https我不会。
我看到这显然是因为我没有安装openSSL,所以我检查了我的版本0.9.8,所以我安装了一个更新版本(1.0.2)(注意我在Mac上)但仍然有同样的问题。我已经看到了很多类似的问题,但要么没有解决方案,要么有一个不适合我,或者我不明白实际做什么。

I get these errors also when using http but I will still recieve the data I want whereas with https I don't. I see that this is apparently because I do not have openSSL installed, so I checked and I had version 0.9.8, so I installed a newer version (1.0.2) (Note i'm on mac) but still have the same problem. I have seen a lot of similar questions but there either wasn't a solution, or if there was one it didn't work for me or I didn't understand what to actually do.

我运行了以下代码:

     qDebug() << "Support SSL:  " << QSslSocket::supportsSsl()
                << "\nLib Version Number: " << QSslSocket::sslLibraryVersionNumber()
                << "\nLib Version String: " << QSslSocket::sslLibraryVersionString()
                << "\nLib Build Version Number: " << QSslSocket::sslLibraryBuildVersionNumber()
                << "\nLib Build Version String: " << QSslSocket::sslLibraryBuildVersionString();

并收到输出:

qt.network.ssl: QSslSocket: cannot resolve SSL_set_psk_client_callback
qt.network.ssl: QSslSocket: cannot resolve TLSv1_1_client_method
qt.network.ssl: QSslSocket: cannot resolve TLSv1_2_client_method
qt.network.ssl: QSslSocket: cannot resolve TLSv1_1_server_method
qt.network.ssl: QSslSocket: cannot resolve TLSv1_2_server_method
qt.network.ssl: QSslSocket: cannot resolve SSL_select_next_proto
qt.network.ssl: QSslSocket: cannot resolve SSL_CTX_set_next_proto_select_cb
qt.network.ssl: QSslSocket: cannot resolve SSL_get0_next_proto_negotiated
Support SSL:   true 
Lib Version Number:  9470431 
Lib Version String:  "OpenSSL 0.9.8zg 14 July 2015" 
Lib Build Version Number:  268439727 
Lib Build Version String:  "OpenSSL 1.0.1j 15 Oct 2014"

列出的版本不是指我最近安装的版本问题是它没有使用新版本?

the versions listed don't refer to the one I recently installed so could the problem be its not using the new version?

如果有人知道如何解决这个问题,那么我可以毫无错误地使用https,请提供具体说明,因为我不是很有经验。

If anyone knows how to fix this so I can use https without errors please give specific instructions because i'm not very experienced.

谢谢

推荐答案

SSL警告不是致命的;安全连接应该继续工作。根据此已关闭的错误报告,您可以通过设置以下环境变量来抑制这些消息:

The SSL warnings aren't fatal; secure connections should continue to work. According to this closed bug report you can suppress these messages by setting the following environment variable:

QT_LOGGING_RULES=qt.network.ssl.warning=false

此外,我非常确定这些警告消息(或非常类似的消息)出现在OS X以外的平台上。

Also, I'm fairly certain these warning messages (or very similar messages) appear on platforms other than OS X.

这篇关于让openSSL在Mac上使用Qt的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆