Sample code for 30+ languages & platforms
React Native

Load PEM Format Certificate (.pem)

See more Certificates Examples

Loads a PEM format digital certificate and fetches information about the cert.

Chilkat React Native Downloads

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

function chilkatExample() {
  const cert = new Cert();

  // LoadFromFile will load virtually any certificate format file.
  // It will auto-recognize the format and load appropiately.

  try {
    cert.loadFromFile('/Users/chilkat/testData/cer/cert.pem');
  } catch {
    console.log(cert.lastErrorText);
    return;
  }

  // DN = "Distinguished Name"
  console.log(`SubjectDN:${cert.subjectDN}`);

  console.log(`Common Name:${cert.subjectCN}`);
  console.log(`Issuer Common Name:${cert.issuerCN}`);

  console.log(`Serial Number:${cert.serialNumber}`);
}