PHP ActiveX
PHP ActiveX
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 ActiveX Downloads
<?php
$success = 0;
$certStore = new COM("Chilkat.CertStore");
// The "AddressBook" is the "Other People" certificate store as shown in certmgr.msc
$readOnly = 1;
$success = $certStore->OpenWindowsStore('CurrentUser','AddressBook',$readOnly);
if ($success != 1) {
print $certStore->LastErrorText . "\n";
exit;
}
// Find the certificate for the email address:
$jsonE = new COM("Chilkat.JsonObject");
$jsonE->UpdateString('email','joe@example.com');
$cert = new COM("Chilkat.Cert");
$success = $certStore->FindCert($jsonE,$cert);
if ($success == 0) {
print $certStore->LastErrorText . "\n";
exit;
}
print 'Found certificate: ' . $cert->SubjectDN . "\n";
?>