Ruby
Ruby
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
Chilkat Ruby Downloads
require 'chilkat'
success = false
pkey = Chilkat::CkPrivateKey.new()
# Load the private key from an PEM file:
success = pkey.LoadPemFile("private.pem")
if (success == false)
print pkey.lastErrorText() + "\n";
exit
end
pubKey = Chilkat::CkPublicKey.new()
pkey.ToPublicKey(pubKey)
success = pubKey.SavePemFile(false,"pubKey.pem")
if (success != true)
print pubKey.lastErrorText() + "\n";
exit
end
print "Success." + "\n";