Sample code for 30+ languages & platforms
JavaScript

List Certificates in the Current User Certificate Store (Windows Only)

See more Certificates Examples

This is a Windows-only example to list the certificates in the current-user certificate store (located in the Windows Registry).
Note
This example is intended for running within a Chilkat.Js embedded JavaScript engine. All Chilkat JavaScript examples require Chilkat v11.4.0 or greater.
JavaScript
var success = false;

// This is a Windows-only example because it lists the certificates
// stored in the Windows Current User Certificate Store located in the
// Windows Registry.

var certStore = new CkCertStore();

var readOnly = true;
success = certStore.OpenCurrentUserStore(readOnly);
if (success == false) {
    console.log(certStore.LastErrorText);
    return;
}

var cert = new CkCert();
var numCerts = certStore.NumCertificates;
var i = 0;
while (i < numCerts) {
    certStore.GetCert(i,cert);
    console.log("DN = " + cert.SubjectDN);
    console.log("Email = " + cert.SubjectE);
    i = i+1;
}