Last active
September 16, 2017 12:29
-
-
Save bhelx/b0d5a03478e500644bbc to your computer and use it in GitHub Desktop.
TLS Low Level Testing. You should expect to see it print TLS version 1.2.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// This example is for testing php with libcurl | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_URL, "https://www.howsmyssl.com/a/check"); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE); | |
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_HEADER, 1); | |
$response = curl_exec($ch); | |
curl_close($ch); | |
list($header, $body) = explode("\r\n\r\n", $response, 2); | |
$data = json_decode($body, true); | |
print "TLS Version Negotiated: " . $data['tls_version'] . "\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import httplib | |
import json | |
conn = httplib.HTTPSConnection('www.howsmyssl.com') | |
conn.request('GET', '/a/check') | |
data = json.load(conn.getresponse()) | |
print "TLS Version Negotiated: %s" % data['tls_version'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'net/https' | |
require 'json' | |
uri = URI("https://www.howsmyssl.com/") | |
http = ::Net::HTTP.new uri.host, uri.port | |
http.use_ssl = true | |
data = JSON.parse(http.get('/a/check').body) | |
puts "TLS Version Negotiated: #{data['tls_version']}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment