Sample code for 30+ languages & platforms
CkPython

Example: Crypt2.SetDecryptCert method

Demonstrates how to call the SetDecryptCert method.

Chilkat CkPython Downloads

CkPython
import sys
import chilkat

success = False

cert = chilkat.CkCert()

success = cert.LoadPfxFile("c:/pfx_files/my.pfx","password")
if (success != True):
    print(cert.lastErrorText())
    sys.exit()

decrypt = chilkat.CkCrypt2()
decrypt.put_CryptAlgorithm("pki")

success = decrypt.SetDecryptCert(cert)
if (success != True):
    print(decrypt.lastErrorText())
    sys.exit()

bd = chilkat.CkBinData()
success = bd.LoadFile("c:/someDir/pkcs7_encrypted.dat")

success = decrypt.DecryptBd(bd)
if (success != True):
    print(decrypt.lastErrorText())
    sys.exit()

# bd contains the decrypted content.