Sample code for 30+ languages & platforms
JavaScript

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).

Note: This example requires Chilkat v10.0.0 or greater.

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;

var cert = new CkCert();
success = cert.LoadByCommonName("Chilkat Software, Inc.");
if (success == false) {
    console.log(cert.LastErrorText);
    return;
}

console.log(cert.SubjectDN);
console.log("Success.");