Libcurl gnutls_handshake () error: TLS warning received

I try to do the following:

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

I have an apache server with mod_ssl and server certificate. 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: TLS warning received.

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

+4
source share
3 answers

This β€œregular” warning that you receive means that there is no known organization (certification authority) wishing to vouch for its authenticity. This is what a β€œnormal” warning means, and this is what TLS warns about.

Try setting CURLOPT_SSL_VERIFYHOST to 0 or install the appropriate certificate.

+2
source

I tried to execute the above solution and it 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, this must be done by setting the CURLOPT_SSLVERSION parameter to 3.

+3
source

Understanding that the question is quite old, and one answer has already been accepted, here is an alternative answer that worked fine for me and can be useful for people coming here from the search:

  • Replace libcurl-gnutls alternative to libcurl-openssl .

I noticed that the certificate error was generated only using programs using libcurl, and not with browsers, so I assumed that something about GNUTLS was to blame here, 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 relied on libcurl started working normally right after I replaced the libraries (I also recompiled the programs just in case).

Note. this solution will help you if you get a warning with GNUTLS, but not with, say, browsers. That is, I assume that the certificate chain is indeed configured correctly.

+3
source

All Articles