简体   繁体   English

在Mac上让OpenSSL与Qt一起使用

[英]getting openSSL to work with Qt on mac

I am making some api calls to google maps some of which need to be encrypted so i'm using https. 我正在对Google地图进行一些api调用,其中一些需要加密,因此我使用的是https。 Whenever I make a request using https I get the errors: 每当我使用https发出请求时,都会收到错误消息:

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. 使用http时也会出现这些错误,但是我仍然会收到所需的数据,而使用https则不会。 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. 我看到这显然是因为我没有安装openSSL,所以我检查并安装了0.9.8版,因此我安装了较新的版本(1.0.2)(请注意,我在Mac上)但仍然存在相同的问题。 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. 如果有人知道如何解决此问题,以便我可以正确使用https,请给出具体说明,因为我经验不足。

Thanks 谢谢

The SSL warnings aren't fatal; SSL警告不是致命的。 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. 另外,我相当确定这些警告消息(或非常类似的消息)会出现在OS X以外的平台上。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM