Skip to content

Instantly share code, notes, and snippets.

@jbarber
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbarber/3146fc0403ee00e88cab to your computer and use it in GitHub Desktop.
Save jbarber/3146fc0403ee00e88cab to your computer and use it in GitHub Desktop.
Get LDAP TLS certificate in PEM format
#!/usr/bin/env perl
use strict;
use warnings;
use Net::SSLeay qw(get_peer_certificate);
use Net::LDAP;
my $ldap = Net::LDAP->new("ldap.fe.up.pt") or die $!;
$ldap->start_tls or die $!;
$ldap->bind or die $!;
print Net::SSLeay::PEM_get_string_X509(
get_peer_certificate(
$ldap->certificate->_get_ssl_object
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment