Sample code for 30+ languages & platforms
Ruby

Transition from Cert.ExportPrivateKey to Cert.GetPrivateKey

Provides instructions for replacing deprecated ExportPrivateKey method calls with GetPrivateKey.

Chilkat Ruby Downloads

Ruby
require 'chilkat'

success = false

cert = Chilkat::CkCert.new()

# ------------------------------------------------------------------------
# The ExportPrivateKey method is deprecated:

# privatekeyObj is a CkPrivateKey
privatekeyObj = cert.ExportPrivateKey()
if (cert.get_LastMethodSuccess() == false)
    print cert.lastErrorText() + "\n";
    exit
end

# ...
# ...

# ------------------------------------------------------------------------
# Do the equivalent using GetPrivateKey.
# Your application creates a new, empty PrivateKey object which is passed 
# in the last argument and filled upon success.

privatekeyOut = Chilkat::CkPrivateKey.new()
success = cert.GetPrivateKey(privatekeyOut)
if (success == false)
    print cert.lastErrorText() + "\n";
    exit
end