JavaScript
JavaScript
Apple Keychain - List Certificates
See more Apple Keychain Examples
Iterates over the certificates in the Apple Keychain.
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.
var success = false;
var certStore = new CkCertStore();
// On MacOS and iOS, the OpenCurrentUserStore method opens the Keychain.
// The argument passed to OpenCurrentUserStore is ignored.
success = certStore.OpenCurrentUserStore(false);
if (success == false) {
console.log(certStore.LastErrorText);
return;
}
var numCerts = certStore.NumCertificates;
console.log("numCerts = " + numCerts);
var cert = new CkCert();
var i = 0;
while (i < numCerts) {
certStore.GetCert(i,cert);
console.log(cert.SubjectDN);
console.log(cert.SubjectCN);
console.log(cert.SerialNumber);
console.log("----");
i = i+1;
}
certStore.CloseCertStore();