让openSSL在Mac上使用Qt(getting openSSL to work with Qt on mac)

其他开发 IT屋
百度翻译此文   有道翻译此文
问 题

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

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.

I ran the following code:

     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();

and received the output:

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?

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

Thanks

解决方案

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

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

本文地址:IT屋 » getting openSSL to work with Qt on mac

问 题

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



  qt.network.ssl:QSslSocket:无法解析SSL_set_psk_client_callback 
qt.network.ssl:QSslSocket:无法解析TLSv1_1_client_method
qt.network.ssl:QSslSocket:无法解析TLSv1_2_client_method
qt.network.ssl:QSslSocket:无法解析TLSv1_1_server_method
qt.network。 ssl:QSslSocket:无法解析TLSv1_2_server_method
qt.network.ssl:QSslSocket:无法解析SSL_select_next_proto
qt.network.ssl:QSslSocket:无法解析SSL_CTX_set_next_proto_select_cb
qt.network.ssl:QSslSocket:不能解析SSL_get0_next_proto_negotiated
qt.network.ssl:QSslSocket:无法调用未解析的函数SSL_get0_next_proto_negotiated


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



我运行了以下代码:



  qDebug()<< “支持SSL:”<< QSslSocket :: supportsSsl()
<< “\ nLib版本号:”<< QSslSocket :: sslLibraryVersionNumber()
<< “\ nLib Version String:”<< QSslSocket :: sslLibraryVersionString()
<< “\ nLib Build版本号:”<< QSslSocket :: sslLibraryBuildVersionNumber()
<< “\ nLib Build Version String:”<< QSslSocket :: sslLibraryBuildVersionString();


并收到输出:



  qt.network.ssl:QSslSocket:无法解析SSL_set_psk_client_callback 
qt.network.ssl:QSslSocket:无法解析TLSv1_1_client_method
qt.network.ssl:QSslSocket:无法解析TLSv1_2_client_method
qt.network.ssl:QSslSocket:无法解析TLSv1_1_server_method
qt.network.ssl:QSslSocket:无法解析TLSv1_2_server_method
qt.network.ssl:QSslSocket:无法解析SSL_select_next_proto
qt。 network.ssl:QSslSocket:无法解析SSL_CTX_set_next_proto_select_cb
qt.network.ssl:QSslSocket:无法解析SSL_get0_next_proto_negotiated
支持SSL:true
Lib版本号:9470431
Lib Version String:“ OpenSSL 0.9.8zg 2015年7月14日“
Lib Build版本号:268439727
Lib构建版本字符串:”OpenSSL 1.0.1j 2014年10月15日“


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



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



谢谢


解决方案

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



  QT_LOGGING_RULES = qt.network.ssl.warning = false 


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


本文地址:IT屋 » 让openSSL在Mac上使用Qt

官方微信
扫一扫关注IT屋
微信公众号搜索 “ IT屋 ” ,选择关注
与百万开发者在一起