Sample code for 30+ languages & platforms
React Native Requires Chilkat v11.0.0+

Get Certificate Public Key from PEM

See more Certificates Examples

Demonstrates how to load a PEM file containing a certificate and access the public key.

Chilkat React Native Downloads

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

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

  try {
    cert.loadFromFile('qa_data/pem/my_cert.pem');
  } catch {
    console.log(cert.lastErrorText);
    return;
  }

  const pubkey = new PublicKey();
  cert.getPublicKey(pubkey);

  // Examine the public key as XML..
  console.log(pubkey.getXml());
}