Perl
Perl
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 Perl Downloads
use chilkat();
$success = 0;
$certStore = chilkat::CkCertStore->new();
# 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() . "\r\n";
exit;
}
# Find the certificate for the email address:
$jsonE = chilkat::CkJsonObject->new();
$jsonE->UpdateString("email",'joe@example.com');
$cert = chilkat::CkCert->new();
$success = $certStore->FindCert($jsonE,$cert);
if ($success == 0) {
print $certStore->lastErrorText() . "\r\n";
exit;
}
print "Found certificate: " . $cert->subjectDN() . "\r\n";