PHP Requires Chilkat v10.1.2+
Chilkat2 PHP
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 Downloads
<?php
use Chilkat2\Cert;
use Chilkat2\CertStore;
use Chilkat2\JsonObject;
$certStore = new CertStore();
// The "AddressBook" is the "Other People" certificate store as shown in certmgr.msc
$readOnly = true;
try {
$certStore->OpenWindowsStore('CurrentUser', 'AddressBook', $readOnly);
// Find the certificate for the email address:
$jsonE = new JsonObject();
$jsonE->UpdateString('email', 'joe@example.com');
$cert = new Cert();
$certStore->FindCert($jsonE, $cert);
} catch (\Chilkat2\Exception $e) {
echo $e->getMessage(), "\n";
exit;
}
echo 'Found certificate: ', $cert->SubjectDN, "\n";