Perl
Perl
Get Issuer Certificate Information
See more Certificates Examples
A certificate contains information about its issuer. This example demonstrates how to get the issuer information from a certificate.Chilkat Perl Downloads
use chilkat();
$success = 0;
$cert = chilkat::CkCert->new();
$success = $cert->LoadFromFile("qa_data/certs/sample.cer");
if ($success == 0) {
print $cert->lastErrorText() . "\r\n";
exit;
}
# Get issuer information:
# -----------------------------------------------------------------------
# (Not all subject fields may exist depending on the issuer certificate.)
# -----------------------------------------------------------------------
# Issuer DN (Distinguished Name, i.e. all the Issuer subject parts)
print "DN: " . $cert->issuerDN() . "\r\n";
# Common Subject parts:
# Issuer Common Name
print "CN: " . $cert->issuerCN() . "\r\n";
# Issuer Country
print "C: " . $cert->issuerC() . "\r\n";
# Issuer Email address
print "E: " . $cert->issuerE() . "\r\n";
# Issuer Locality
print "L: " . $cert->issuerL() . "\r\n";
# Issuer Organization
print "O: " . $cert->issuerO() . "\r\n";
# Issuer Organizational Unit
print "OU: " . $cert->issuerOU() . "\r\n";
# Issuer State
print "S: " . $cert->issuerS() . "\r\n";