JavaScript
JavaScript
Get Certificate Public Key from PEM
See more Certificates Examples
Demonstrates how to load a PEM file containing a certificate and access 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();
success = cert.LoadFromFile("qa_data/pem/my_cert.pem");
if (success == false) {
console.log(cert.LastErrorText);
return;
}
var pubkey = new CkPublicKey();
cert.GetPublicKey(pubkey);
// Examine the public key as XML..
console.log(pubkey.GetXml());