Perl Requires Chilkat v11.0.0+
Chilkat2 Perl
Get Certificate's Public Key
Loads a certificate from PEM and gets the public key.Chilkat Perl Downloads
use strict;
use warnings;
use Chilkat2;
my $cert = Chilkat2::Cert->new;
my $strPem = '-----BEGIN CERTIFICATE----- ...';
my $success = $cert->LoadPem($strPem);
if (!$success) {
print $cert->LastErrorText, "\n";
exit;
}
my $pubKey = Chilkat2::PublicKey->new;
$cert->GetPublicKey($pubKey);
# You can now use the public key object however it is needed,
# and access its various properties and methods..
print $pubKey->GetXml(), "\n";