Ruby
Ruby
Example: Crypt2.SetDecryptCert method
Demonstrates how to call the SetDecryptCert method.Chilkat Ruby Downloads
require 'chilkat'
success = false
cert = Chilkat::CkCert.new()
success = cert.LoadPfxFile("c:/pfx_files/my.pfx","password")
if (success != true)
print cert.lastErrorText() + "\n";
exit
end
decrypt = Chilkat::CkCrypt2.new()
decrypt.put_CryptAlgorithm("pki")
success = decrypt.SetDecryptCert(cert)
if (success != true)
print decrypt.lastErrorText() + "\n";
exit
end
bd = Chilkat::CkBinData.new()
success = bd.LoadFile("c:/someDir/pkcs7_encrypted.dat")
success = decrypt.DecryptBd(bd)
if (success != true)
print decrypt.lastErrorText() + "\n";
exit
end
# bd contains the decrypted content.