Sample code for 30+ languages & platforms
PHP Extension

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 PHP Extension Downloads

PHP Extension
<?php

include("chilkat.php");

$success = false;

$cert = new CkCert();

$success = $cert->LoadFromFile('qa_data/certs/sample.cer');
if ($success == false) {
    print $cert->lastErrorText() . "\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() . "\n";

// Common Subject parts:
// Issuer Common Name
print 'CN: ' . $cert->issuerCN() . "\n";

// Issuer Country
print 'C: ' . $cert->issuerC() . "\n";

// Issuer Email address
print 'E: ' . $cert->issuerE() . "\n";

// Issuer Locality
print 'L: ' . $cert->issuerL() . "\n";

// Issuer Organization
print 'O: ' . $cert->issuerO() . "\n";

// Issuer Organizational Unit
print 'OU: ' . $cert->issuerOU() . "\n";

// Issuer State
print 'S: ' . $cert->issuerS() . "\n";

?>