C#
C#
Example: Crypt2.SetDecryptCert method
Demonstrates how to call the SetDecryptCert method.Chilkat C# Downloads
bool success = false;
Chilkat.Cert cert = new Chilkat.Cert();
success = cert.LoadPfxFile("c:/pfx_files/my.pfx","password");
if (success != true) {
Debug.WriteLine(cert.LastErrorText);
return;
}
Chilkat.Crypt2 decrypt = new Chilkat.Crypt2();
decrypt.CryptAlgorithm = "pki";
success = decrypt.SetDecryptCert(cert);
if (success != true) {
Debug.WriteLine(decrypt.LastErrorText);
return;
}
Chilkat.BinData bd = new Chilkat.BinData();
success = bd.LoadFile("c:/someDir/pkcs7_encrypted.dat");
success = decrypt.DecryptBd(bd);
if (success != true) {
Debug.WriteLine(decrypt.LastErrorText);
return;
}
// bd contains the decrypted content.