Sample code for 30+ languages & platforms
React Native Requires Chilkat v10.1.2+

Apple Keychain - List Certificates

See more Apple Keychain Examples

Iterates over the certificates in the Apple Keychain.

Chilkat React Native Downloads

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

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

  // On MacOS and iOS, the OpenCurrentUserStore method opens the Keychain.
  // The argument passed to OpenCurrentUserStore is ignored.
  try {
    certStore.openCurrentUserStore(false);
  } catch {
    console.log(certStore.lastErrorText);
    return;
  }

  const numCerts = certStore.numCertificates;
  console.log(`numCerts = ${numCerts}`);

  const cert = new Cert();
  let i = 0;
  while (i < numCerts) {
    certStore.getCert(i, cert);
    console.log(cert.subjectDN);
    console.log(cert.subjectCN);
    console.log(cert.serialNumber);
    console.log('----');
    i++;
  }

  certStore.closeCertStore();
}