libcurl gnutls_handshake() 失败:已收到 TLS 警告警报

发布于 2024-11-03 04:59:17 字数 448 浏览 0 评论 0原文

我本质上是在尝试执行以下操作:

http://curl.haxx.se/libcurl/ c/https.html

我用 mod_ssl 设置了 apache 服务器和服务器证书。我添加了以下行:

curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);

并尝试了:

curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);

但我不断收到错误: gnutls_handshake() 失败:已收到 TLS 警告警报。

有谁知道谁来解决这个问题或解决这个问题?

I am essentially trying to do the following:

http://curl.haxx.se/libcurl/c/https.html

I have my apache server set up with mod_ssl and a server cert. I added the line:

curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);

and also tried:

curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);

but I keep getting the error: gnutls_handshake() failed: A TLS warning alert has been received.

Does anyone know who to fix this or get around it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

烙印 2024-11-10 04:59:17

意识到这个问题相当老了,并且一个答案已经被接受,这里有一个替代答案,它对我来说非常有效,并且可能对从搜索来到这里的人有用:

  • libcurl-gnutls 替换为 libcurl-openssl 替代方案。

我注意到证书错误仅是使用 libcurl 的程序生成的,而不是浏览器生成的,因此我认为这里有关于 GNUTLS 的问题,而不是证书的问题。

这是对我有用的(Ubuntu 12.04 LTS):

$ sudo apt-get remove libcurl4-gnutls-dev
$ sudo apt-get install libcurl4-openssl-dev 

在我替换库后,所有依赖 libcurl 的程序立即开始正常工作(为了以防万一,我还重新编译了程序)。

注意:仅当您收到 GNUTLS 警告而不是浏览器等警告时,此解决方案才会对您有所帮助。也就是说,我假设证书链实际上设置正确。

Realizing that the question is fairly old and one answer was already accepted, here is an alternative answer that worked perfectly for me and may be useful for folks coming here from search:

  • Replace libcurl-gnutls with libcurl-openssl alternative.

I noticed that the certificate error was only generated with programs using libcurl and not with browsers so I assumed that something about GNUTLS was at fault here and not the certificates.

Here is what worked for me (Ubuntu 12.04 LTS):

$ sudo apt-get remove libcurl4-gnutls-dev
$ sudo apt-get install libcurl4-openssl-dev 

All programs that were relying on libcurl started working fine immediately after I replaced the libraries (I also recompiled the programs just in case).

Note: this solution will only help you if you get a warning with GNUTLS but not with, say, browsers. That is, I am assuming the certificate chain is actually set up correctly.

回忆躺在深渊里 2024-11-10 04:59:17

我尝试了上述解决方案,但这对我不起作用。在 python 中,我尝试了以下选项,该选项有效地强制使用 SSLv3 并禁用 TLS。

c.setopt(pycurl.SSLVERSION, pycurl.SSLVERSION_SSLv3)

在 PHP 中,应该可以通过将 CURLOPT_SSLVERSION 选项设置为 3 来完成。

I attempted the above solution and that did not work for me. In python, I tried the following option which effectively forces SSLv3 and disables TLS.

c.setopt(pycurl.SSLVERSION, pycurl.SSLVERSION_SSLv3)

in PHP it should be able to be accomplished by setting the CURLOPT_SSLVERSION option to 3.

沧笙踏歌 2024-11-10 04:59:17

您收到的“通常”警告意味着没有知名组织(证书颁发机构)愿意保证其真实性。这就是“通常”警告的含义,也是 TLS 警告告诉您的内容。

尝试将 CURLOPT_SSL_VERIFYHOST 设置为 0 或安装正确的证书。

That "usual" warning you get means there is no well-known organization (certificate authority) willing to vouch for its authenticity. That is what the "usual" warning means and that is what the TLS warning is telling you.

Try to set CURLOPT_SSL_VERIFYHOST to 0 or install a proper certificate.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文