Perl
Perl
Get Certificate's Public Key
Loads a certificate from PEM and gets the public key.Chilkat Perl Downloads
use chilkat();
$success = 0;
$cert = chilkat::CkCert->new();
$strPem = "-----BEGIN CERTIFICATE----- ...";
$success = $cert->LoadPem($strPem);
if ($success == 0) {
print $cert->lastErrorText() . "\r\n";
exit;
}
$pubKey = chilkat::CkPublicKey->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() . "\r\n";