Node.js
Node.js
Example: Crypt2.SetDecryptCert method
Demonstrates how to call the SetDecryptCert method.Chilkat Node.js Downloads
NODEJS_PRELUDE
function chilkatExample() {
var success = false;
var cert = new chilkat.Cert();
success = cert.LoadPfxFile("c:/pfx_files/my.pfx","password");
if (success !== true) {
console.log(cert.LastErrorText);
return;
}
var decrypt = new chilkat.Crypt2();
decrypt.CryptAlgorithm = "pki";
success = decrypt.SetDecryptCert(cert);
if (success !== true) {
console.log(decrypt.LastErrorText);
return;
}
var bd = new chilkat.BinData();
success = bd.LoadFile("c:/someDir/pkcs7_encrypted.dat");
success = decrypt.DecryptBd(bd);
if (success !== true) {
console.log(decrypt.LastErrorText);
return;
}
// bd contains the decrypted content.
}
chilkatExample();