Sample code for 30+ languages & platforms
Chilkat2-Python

Example: Crypt2.SetDecryptCert method

Demonstrates how to call the SetDecryptCert method.

Chilkat Chilkat2-Python Downloads

Chilkat2-Python
import sys
import chilkat2

success = False

cert = chilkat2.Cert()

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

decrypt = chilkat2.Crypt2()
decrypt.CryptAlgorithm = "pki"

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

bd = chilkat2.BinData()
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.