(PHP ActiveX) List Certificates in the Current User Certificate Store (Windows Only)
This is a Windows-only example to list the certificates in the current-user certificate store (located in the Windows Registry).
<?php
// This is a Windows-only example because it lists the certificates
// stored in the Windows Current User Certificate Store located in the
// Windows Registry.
// For versions of Chilkat < 10.0.0, use new COM('Chilkat_9_5_0.Chilkat.CertStore')
$certStore = new COM("Chilkat.CertStore");
$readOnly = 1;
$success = $certStore->OpenCurrentUserStore($readOnly);
if ($success == 0) {
print $certStore->LastErrorText . "\n";
exit;
}
$numCerts = $certStore->NumCertificates;
$i = 0;
while ($i < $numCerts) {
// cert is a Chilkat.Cert
$cert = $certStore->GetCertificate($i);
print 'DN = ' . $cert->SubjectDN . "\n";
print 'Email = ' . $cert->SubjectE . "\n";
$i = $i + 1;
}
?>
|