TLS 1.2 not working in cURL TLS 1.2 not working in cURL php php

TLS 1.2 not working in cURL


You must use an integer value for the CURLOPT_SSLVERSION value, not a string as listed above

Try this:

curl_setopt ($setuploginurl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2); // constant NOT string value

http://php.net/manual/en/function.curl-setopt.php

value should be an integer for the following values of the option parameter:CURLOPT_SSLVERSION

One of:

CURL_SSLVERSION_DEFAULT (0)CURL_SSLVERSION_TLSv1 (1)CURL_SSLVERSION_SSLv2 (2)CURL_SSLVERSION_SSLv3 (3)CURL_SSLVERSION_TLSv1_0 (4)CURL_SSLVERSION_TLSv1_1 (5)CURL_SSLVERSION_TLSv1_2 (6)


TLS 1.1 and TLS 1.2 are supported since OpenSSL 1.0.1

Forcing TLS 1.1 and 1.2 are only supported since curl 7.34.0

You should consider an upgrade.


I has similar problem in context of Stripe:

Error: Stripe no longer supports API requests made with TLS 1.0. Please initiate HTTPS connections with TLS 1.2 or later. You can learn more about this at https://stripe.com/blog/upgrading-tls.

Forcing TLS 1.2 using CURL parameter is temporary solution or even it can't be applied because of lack of room to place an update. By default TLS test function https://gist.github.com/olivierbellone/9f93efe9bd68de33e9b3a3afbd3835cf showed following configuration:

SSL version: NSS/3.21 Basic ECCSSL version number: 0OPENSSL_VERSION_NUMBER: 1000105fTLS test (default): TLS 1.0TLS test (TLS_v1): TLS 1.2TLS test (TLS_v1_2): TLS 1.2

I updated libraries using following command:

yum update nss curl openssl

and then saw this:

SSL version: NSS/3.21 Basic ECCSSL version number: 0OPENSSL_VERSION_NUMBER: 1000105fTLS test (default): TLS 1.2TLS test (TLS_v1): TLS 1.2TLS test (TLS_v1_2): TLS 1.2

Please notice that default TLS version changed to 1.2! That globally solved problem. This will help PayPal users too: https://www.paypal.com/au/webapps/mpp/tls-http-upgrade (update before end of June 2017)