(PHP ActiveX) Get Certificate Policy
Demonstrates how to get a certificate's policy OIDs (if any)
<?php
// For versions of Chilkat < 10.0.0, use new COM('Chilkat_9_5_0.Chilkat.Cert')
$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>
// For versions of Chilkat < 10.0.0, use new COM('Chilkat_9_5_0.Chilkat.Xml')
$xml = new COM("Chilkat.Xml");
$xml->LoadXml($strXml);
print 'Policy OID = ' . $xml->getChildContent('sequence|oid') . "\n";
}
?>
|