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

Get Certificate's Public Key

Loads a certificate from PEM and gets the public key.

Chilkat React Native Downloads

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

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

  const strPem = '-----BEGIN CERTIFICATE----- ...';

  try {
    cert.loadPem(strPem);
  } catch {
    console.log(cert.lastErrorText);
    return;
  }

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

  // You can now use the public key object however it is needed,
  // and access its various properties and methods..

  console.log(pubKey.getXml());
}