Sample code for 30+ languages & platforms
React Native

Iterate over Certificates in a Certificate Store

See more Cert Store Examples

Demonstrates how to iterate over the certificates in a certificate store.

Note: Requires Chilkat v10.1.2 or later.

Chilkat React Native Downloads

React Native
import { Cert, CertStore } from '@chilkat/react-native'

function chilkatExample() {
  const certStore = new CertStore();

  // This opens the Current User certificate store on Windows,
  // On MacOS and iOS it opens the default Keychain.
  const readOnly = false;
  try {
    certStore.openCurrentUserStore(readOnly);
  } catch {
    console.log(certStore.lastErrorText);
    return;
  }

  const cert = new Cert();

  const numCerts = certStore.numCertificates;
  let i = 0;

  while (i < numCerts) {
    // Load the cert object with the Nth certificate.
    certStore.getCert(i, cert);
    console.log(`${i}: ${cert.subjectCN}`);
    i++;
  }
}