Perl Requires Chilkat v10.1.2+
Chilkat2 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 strict;
use warnings;
use Chilkat2;
my $certStore = Chilkat2::CertStore->new;
# The "AddressBook" is the "Other People" certificate store as shown in certmgr.msc
my $readOnly = 1;
my $success = $certStore->OpenWindowsStore('CurrentUser', 'AddressBook', $readOnly);
if (!$success) {
print $certStore->LastErrorText, "\n";
exit;
}
# Find the certificate for the email address:
my $jsonE = Chilkat2::JsonObject->new;
$jsonE->UpdateString('email', 'joe@example.com');
my $cert = Chilkat2::Cert->new;
$success = $certStore->FindCert($jsonE, $cert);
if (!$success) {
print $certStore->LastErrorText, "\n";
exit;
}
print 'Found certificate: ', $cert->SubjectDN, "\n";