Sample code for 30+ languages & platforms
Node.js

Example: Crypt2.SetDecryptCert method

Demonstrates how to call the SetDecryptCert method.

Chilkat Node.js Downloads

Node.js
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();