JavaScript
JavaScript
Get Certificate's Public Key
Loads a certificate from PEM and gets the public key.
Note
This example is intended for running within a Chilkat.Js embedded JavaScript engine. All Chilkat JavaScript examples require Chilkat
v11.4.0 or greater.
var success = false;
var cert = new CkCert();
var strPem = "-----BEGIN CERTIFICATE----- ...";
success = cert.LoadPem(strPem);
if (success == false) {
console.log(cert.LastErrorText);
return;
}
var pubKey = new CkPublicKey();
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());