Ruby
Ruby
Load Certificate from .cer and Private Key from .pem
See more Certificates Examples
Load a certificate from a .cer and its associated private key from a .pem.Chilkat Ruby Downloads
require 'chilkat'
success = false
cert = Chilkat::CkCert.new()
success = cert.LoadFromFile("C:/certs_and_keys/Certificate.cer")
if (success == false)
print cert.lastErrorText() + "\n";
exit
end
sbPem = Chilkat::CkStringBuilder.new()
success = sbPem.LoadFile("C:/certs_and_keys/PrivateKey.pem","utf-8")
if (success == false)
print "Failed to load private key PEM" + "\n";
exit
end
success = cert.SetPrivateKeyPem(sbPem.getAsString())
if (success == false)
print cert.lastErrorText() + "\n";
exit
end
print "The certificate and associated private key are now loaded and ready for signing." + "\n";