(Go) Example: Crypt2.SetDecryptCert method
Demonstrates how to call the SetDecryptCert method.
cert := Cert_Ref.html">chilkat.NewCert()
success := cert.LoadPfxFile("c:/pfx_files/my.pfx","password")
if success != true {
fmt.Println(cert.LastErrorText())
cert.DisposeCert()
return
}
decrypt := Crypt2_Ref.html">chilkat.NewCrypt2()
decrypt.SetCryptAlgorithm("pki")
success = decrypt.SetDecryptCert(cert)
if success != true {
fmt.Println(decrypt.LastErrorText())
cert.DisposeCert()
decrypt.DisposeCrypt2()
return
}
bd := BinData_Ref.html">chilkat.NewBinData()
success = bd.LoadFile("c:/someDir/pkcs7_encrypted.dat")
success = decrypt.DecryptBd(bd)
if success != true {
fmt.Println(decrypt.LastErrorText())
cert.DisposeCert()
decrypt.DisposeCrypt2()
bd.DisposeBinData()
return
}
// bd contains the decrypted content.
cert.DisposeCert()
decrypt.DisposeCrypt2()
bd.DisposeBinData()
|