Perl Requires Chilkat v11.0.0+
Perl
Get Public Key from Certificate PEM
See more Certificates Examples
Loads a certificate from a PEM file and gets the cert's public key.Chilkat Perl Downloads
use strict;
use warnings;
use Chilkat2;
my $cert = Chilkat2::Cert->new;
my $success = $cert->LoadFromFile('qa_data/certs/someCert.pem');
if (!$success) {
print $cert->LastErrorText, "\n";
exit;
}
# Get the certificate's public key:
my $pubkey = Chilkat2::PublicKey->new;
$cert->GetPublicKey($pubkey);
print $pubkey->GetPem(0), "\n";
# OK.. we have the public key which can be used in other Chilkat classes/methods...