Perl
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 chilkat();
$success = 0;
$cert = chilkat::CkCert->new();
$success = $cert->LoadFromFile("qa_data/pem/my_cert.pem");
if ($success == 0) {
print $cert->lastErrorText() . "\r\n";
exit;
}
$pubkey = chilkat::CkPublicKey->new();
$cert->GetPublicKey($pubkey);
# Examine the public key as XML..
print $pubkey->getXml() . "\r\n";