Perl Requires Chilkat v11.0.0+
Perl
Get Certificate Public Key from PEM
See more Certificates Examples
Demonstrates how to load a PEM file containing a certificate and access the public key.Chilkat Perl Downloads
use strict;
use warnings;
use Chilkat2;
my $cert = Chilkat2::Cert->new;
my $success = $cert->LoadFromFile('qa_data/pem/my_cert.pem');
if (!$success) {
print $cert->LastErrorText, "\n";
exit;
}
my $pubkey = Chilkat2::PublicKey->new;
$cert->GetPublicKey($pubkey);
# Examine the public key as XML..
print $pubkey->GetXml(), "\n";