1

Curl gives me following error:

error:140773F2:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert unexpected message

What does this mean?

Andrejs Cainikovs
  • 27,428
  • 2
  • 75
  • 95

2 Answers2

4

It means bad SSL handshake. You will need to specify the version of the protocol like this:

curl_setopt($curl_connection, CURLOPT_SSLVERSION, 3);

Change 3 to 2 if you still get the error.

Nikola Kotur
  • 1,954
  • 3
  • 13
  • 15
0

I got same error when I use macOS default curl which is an old version that only support up to TLSv1.2. But the endpoint I am trying to call is using TLSv1.3.

On macOS, I succeed by installing a new curl version by brew install curl.

Then you can run something, for example

/usr/local/opt/curl/bin/curl --version

or

/usr/local/opt/curl/bin/curl --tlsv1.3 --request GET \
     --url https://localhost:9200 \
     --cacert ca.crt \
     --key tls.key \
     --cert tls.crt \
     --header 'Content-Type: application/json' \
     --verbose
Hongbo Miao
  • 45,290
  • 60
  • 174
  • 267