Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jaykishanmutkawoa/9e8353f3db748f1e0578c41d723266b6 to your computer and use it in GitHub Desktop.
Save jaykishanmutkawoa/9e8353f3db748f1e0578c41d723266b6 to your computer and use it in GitHub Desktop.
Adding TLSv1.3 Support in PHP CURL LIBRARY
The OpenSSL was compiled accordingly.
==============
[root@TLS1-3 curl]# openssl version
OpenSSL 1.1.1-pre8 (beta) 20 Jun 2018
=============
PHP was also compiled.
=============
OpenSSL 1.1.1-pre8 (beta) 20 Jun 2018
[root@TLS1-3 curl]# php --version
PHP 7.3.0-dev (cli) (built: Jul 13 2018 10:34:18) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.0-dev, Copyright (c) 1998-2018 Zend Technologies
=============
Curl was also compiled
=============
[root@TLS1-3 curl]# curl --version
curl 7.61.0-DEV (x86_64-pc-linux-gnu) libcurl/7.61.0-DEV OpenSSL/1.1.1 zlib/1.2.11
Release-Date: [unreleased]
Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP UnixSockets HTTPS-proxy
=============
It was ensured that the module CURL was enabled in the PHP module
============
[root@TLS1-3 curl]# php -m
[PHP Modules]
calendar
Core
ctype
curl
date
dom
fileinfo
filter
hash
iconv
json
libxml
mbstring
openssl
pcre
PDO
pdo_sqlite
Phar
posix
Reflection
session
SimpleXML
SPL
sqlite3
standard
tokenizer
xml
xmlreader
xmlwriter
[Zend Modules]
============
The following PHP code was use to test the curl output.
===========
[root@TLS1-3 ~]# cat testphpcurl2.php
<?php
// create a new cURL resource
$ch = curl_init();
// set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, "https://tls13.crypto.mozilla.org/");
curl_setopt($ch, CURLOPT_HEADER, 0);
//curl_setopt($ch, CURLOPT_SSLVERSION, 7);
curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_3);
// grab URL and pass it to the browser
curl_exec($ch);
// close cURL resource, and free up system resources
curl_close($ch);
?>
===========
Wireshark was used to check if same is compatible for only TLSv1.3 and it was succesful.
===========
Extension: supported_versions (len=7)
Type: supported_versions (43)
Length: 7
Supported Versions length: 6
Supported Version: TLS 1.3 (draft 28) (0x7f1c)
Supported Version: TLS 1.3 (draft 27) (0x7f1b)
Supported Version: TLS 1.3 (draft 26) (0x7f1a)
===========
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment