PHP ActiveX
PHP ActiveX
Get Certificate Policy
See more Certificates Examples
Demonstrates how to get a certificate's policy OIDs (if any)Chilkat PHP ActiveX Downloads
<?php
$success = 0;
$cert = new COM("Chilkat.Cert");
$success = $cert->LoadFromFile('qa_data/certs/sample.cer');
if ($success == 0) {
print $cert->LastErrorText . "\n";
exit;
}
// The certificatePolicies OID is 2.5.29.32
$oid = '2.5.29.32';
$strXml = $cert->getExtensionAsXml($oid);
if ($cert->LastMethodSuccess == 1) {
print $strXml . "\n";
// Sample result:
// <sequence><sequence><oid>2.16.840.1.101.2.1.11.39</oid></sequence></sequence>
$xml = new COM("Chilkat.Xml");
$xml->LoadXml($strXml);
print 'Policy OID = ' . $xml->getChildContent('sequence|oid') . "\n";
}
?>