Node.js
Node.js
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 Node.js Downloads
NODEJS_PRELUDE
function chilkatExample() {
var success = false;
var cert = new chilkat.Cert();
success = cert.LoadFromFile("qa_data/certs/someCert.pem");
if (success == false) {
console.log(cert.LastErrorText);
return;
}
// Get the certificate's public key:
var pubkey = new chilkat.PublicKey();
cert.GetPublicKey(pubkey);
console.log(pubkey.GetPem(false));
// OK.. we have the public key which can be used in other Chilkat classes/methods...
}
chilkatExample();