Node.js
Node.js
Get Certificate's Public Key
Loads a certificate from PEM and gets the public key.Chilkat Node.js Downloads
NODEJS_PRELUDE
function chilkatExample() {
var success = false;
var cert = new chilkat.Cert();
var strPem = "-----BEGIN CERTIFICATE----- ...";
success = cert.LoadPem(strPem);
if (success == false) {
console.log(cert.LastErrorText);
return;
}
var pubKey = new chilkat.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());
}
chilkatExample();