Skip to content

Instantly share code, notes, and snippets.

@thunder-spb
Forked from sanmai/dumpchain.pl
Last active August 29, 2015 14:15
Show Gist options
  • Save thunder-spb/65d2f7698e2ad003177b to your computer and use it in GitHub Desktop.
Save thunder-spb/65d2f7698e2ad003177b to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use strict;
use warnings;
# install libio-socket-ssl-perl to get this
use IO::Socket::SSL;
my $hostname = shift or die "Usage: $0 www.example.com\n";
IO::Socket::SSL->new(
PeerHost => "$hostname:443",
SSL_verify_callback => sub {
my $cert = $_[4];
my $subject = Net::SSLeay::X509_NAME_oneline(Net::SSLeay::X509_get_subject_name($cert));
print "# $subject\n";
print Net::SSLeay::PEM_get_string_X509($cert),"\n";
return 1;
}
) or die $SSL_ERROR||$!;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment