Ruby
Ruby
Get Public Key from Certificate PEM
See more Certificates Examples
Loads a certificate from a PEM file and gets the cert's public key.Chilkat Ruby Downloads
require 'chilkat'
success = false
cert = Chilkat::CkCert.new()
success = cert.LoadFromFile("qa_data/certs/someCert.pem")
if (success == false)
print cert.lastErrorText() + "\n";
exit
end
# Get the certificate's public key:
pubkey = Chilkat::CkPublicKey.new()
cert.GetPublicKey(pubkey)
print pubkey.getPem(false) + "\n";
# OK.. we have the public key which can be used in other Chilkat classes/methods...