PHP Extension
PHP Extension
Find a Certificate in the "Other People" Windows Certificate Store
See more Certificates Examples
Demonstrates how to open the "Current User --> Other People" Windows certificate store, and locates a certificate matching an email address.Chilkat PHP Extension Downloads
<?php
include("chilkat.php");
$success = false;
$certStore = new CkCertStore();
// The "AddressBook" is the "Other People" certificate store as shown in certmgr.msc
$readOnly = true;
$success = $certStore->OpenWindowsStore('CurrentUser','AddressBook',$readOnly);
if ($success != true) {
print $certStore->lastErrorText() . "\n";
exit;
}
// Find the certificate for the email address:
$jsonE = new CkJsonObject();
$jsonE->UpdateString('email','joe@example.com');
$cert = new CkCert();
$success = $certStore->FindCert($jsonE,$cert);
if ($success == false) {
print $certStore->lastErrorText() . "\n";
exit;
}
print 'Found certificate: ' . $cert->subjectDN() . "\n";
?>