Sample code for 30+ languages & platforms
PHP

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 Downloads

PHP
<?php

use Chilkat2\Cert;

$cert = new Cert();

try {
    $cert->LoadFromFile('qa_data/certs/sample.cer');
} catch (\Chilkat2\Exception $e) {
    echo $e->getMessage(), "\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)
echo 'DN: ', $cert->IssuerDN, "\n";

// Common Subject parts:
// Issuer Common Name
echo 'CN: ', $cert->IssuerCN, "\n";

// Issuer Country
echo 'C: ', $cert->IssuerC, "\n";

// Issuer Email address
echo 'E: ', $cert->IssuerE, "\n";

// Issuer Locality
echo 'L: ', $cert->IssuerL, "\n";

// Issuer Organization
echo 'O: ', $cert->IssuerO, "\n";

// Issuer Organizational Unit
echo 'OU: ', $cert->IssuerOU, "\n";

// Issuer State
echo 'S: ', $cert->IssuerS, "\n";