Sample code for 30+ languages & platforms
PHP ActiveX

Get Certificate's Public Key

Loads a certificate from PEM and gets the public key.

Chilkat PHP ActiveX Downloads

PHP ActiveX
<?php

$success = 0;

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

$strPem = '-----BEGIN CERTIFICATE----- ...';

$success = $cert->LoadPem($strPem);
if ($success == 0) {
    print $cert->LastErrorText . "\n";
    exit;
}

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

// You can now use the public key object however it is needed,
// and access its various properties and methods..

print $pubKey->getXml() . "\n";

?>