React Native Requires Chilkat v11.0.0+
React Native
Get Public Key from Certificate PEM
See more Certificates Examples
Loads a certificate from a PEM file and gets the cert's public key.Chilkat React Native Downloads
import { Cert, PublicKey } from '@chilkat/react-native'
function chilkatExample() {
const cert = new Cert();
try {
cert.loadFromFile('qa_data/certs/someCert.pem');
} catch {
console.log(cert.lastErrorText);
return;
}
// Get the certificate's public key:
const pubkey = new PublicKey();
cert.getPublicKey(pubkey);
console.log(pubkey.getPem(false));
// OK.. we have the public key which can be used in other Chilkat classes/methods...
}