Last active
December 1, 2020 13:14
-
-
Save sanmai/98666f96294d05c64172 to your computer and use it in GitHub Desktop.
Dumps the whole certificate chain for a server in purposes of OCSP stapling
This file contains hidden or 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
#!/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