PHP Requires Chilkat v11.0.0+
Chilkat2 PHP
Get Certificate's Public Key
Loads a certificate from PEM and gets the public key.Chilkat PHP Downloads
<?php
use Chilkat2\Cert;
use Chilkat2\PublicKey;
$cert = new Cert();
$strPem = '-----BEGIN CERTIFICATE----- ...';
try {
$cert->LoadPem($strPem);
} catch (\Chilkat2\Exception $e) {
echo $e->getMessage(), "\n";
exit;
}
$pubKey = new PublicKey();
$cert->GetPublicKey($pubKey);
// You can now use the public key object however it is needed,
// and access its various properties and methods..
echo $pubKey->GetXml(), "\n";