Sample code for 30+ languages & platforms
Perl Requires Chilkat v10.0.0+

Windows Certificate Stores - Find Certificate by Common Name

See more Certificates Examples

Searches the Windows certificate stores for a certificate that matches the specified common name (CN).

Chilkat Perl Downloads

Chilkat2 Perl
use strict;
use warnings;
use Chilkat2;

my $cert = Chilkat2::Cert->new;
my $success = $cert->LoadByCommonName('Chilkat Software, Inc.');
if (!$success) {
    print $cert->LastErrorText, "\n";
    exit;
}

print $cert->SubjectDN, "\n";
print "Success.\n";