Sample code for 30+ languages & platforms
Node.js

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 Node.js Downloads

Node.js
NODEJS_PRELUDE

function chilkatExample() {

    var success = false;

    var certStore = new chilkat.CertStore();

    // The "AddressBook" is the "Other People" certificate store as shown in certmgr.msc
    var readOnly = true;
    success = certStore.OpenWindowsStore("CurrentUser","AddressBook",readOnly);
    if (success !== true) {
        console.log(certStore.LastErrorText);
        return;
    }

    // Find the certificate for the email address:
    var jsonE = new chilkat.JsonObject();
    jsonE.UpdateString("email","joe@example.com");

    var cert = new chilkat.Cert();
    success = certStore.FindCert(jsonE,cert);
    if (success == false) {
        console.log(certStore.LastErrorText);
        return;
    }

    console.log("Found certificate: " + cert.SubjectDN);

}

chilkatExample();