Sample code for 30+ languages & platforms
PHP ActiveX

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

PHP ActiveX
<?php

$success = 0;

$cert = new COM("Chilkat.Cert");

$success = $cert->LoadFromFile('qa_data/pem/my_cert.pem');
if ($success == 0) {
    print $cert->LastErrorText . "\n";
    exit;
}

$pubkey = new COM("Chilkat.PublicKey");
$cert->GetPublicKey($pubkey);

// Examine the public key as XML..
print $pubkey->getXml() . "\n";

?>