React Native Requires Chilkat v10.1.2+
React Native
Load PFX (PKCS#12) and List Certificates
See more Certificates Examples
Loads a PFX file (.pfx, .p12) and iterates over the certificates found within.Chilkat React Native Downloads
import { Cert, CertStore } from '@chilkat/react-native'
function chilkatExample() {
const certStore = new CertStore();
const pfxPath = '/Users/chilkat/testData/pfx/chilkat_ssl.pfx';
const pfxPassword = 'test';
try {
certStore.loadPfxFile(pfxPath, pfxPassword);
} catch {
console.log(certStore.lastErrorText);
return;
}
const numCerts = certStore.numCertificates;
console.log(`PFX contains ${numCerts} certificates`);
const cert = new Cert();
let i = 0;
while (i < numCerts) {
certStore.getCert(i, cert);
console.log(`${i}: (Common Name) ${cert.subjectCN}`);
console.log(`${i}: (Serial Number) ${cert.serialNumber}`);
console.log(`${i}: (Distinguished Name) ${cert.subjectDN}`);
i++;
}
}