JavaScript
JavaScript
Duplicate openssl pkey -in private.pem -pubout -out pubkey.pem
See more OpenSSL Examples
How to output the public part of a private key: Demonstrates how to duplicate this OpenSSL command:openssl pkey -in private.pem -pubout -out pubkey.pem
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 pkey = new CkPrivateKey();
// Load the private key from an PEM file:
success = pkey.LoadPemFile("private.pem");
if (success == false) {
console.log(pkey.LastErrorText);
return;
}
var pubKey = new CkPublicKey();
pkey.ToPublicKey(pubKey);
success = pubKey.SavePemFile(false,"pubKey.pem");
if (success !== true) {
console.log(pubKey.LastErrorText);
return;
}
console.log("Success.");