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

Duplicate openssl pkey -in private.pem -pubout -out pubkey.pem

See more OpenSSL Examples

How to output the public part of a private key: Demonstrates how to duplicate this OpenSSL command:
openssl pkey -in private.pem -pubout -out pubkey.pem

Chilkat React Native Downloads

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

function chilkatExample() {
  const pkey = new PrivateKey();

  // Load the private key from an PEM file:
  try {
    pkey.loadPemFile('private.pem');
  } catch {
    console.log(pkey.lastErrorText);
    return;
  }

  const pubKey = new PublicKey();
  pkey.toPublicKey(pubKey);

  try {
    pubKey.savePemFile(false, 'pubKey.pem');
  } catch {
    console.log(pubKey.lastErrorText);

    return;
  }

  console.log('Success.');
}