Sample code for 30+ languages & platforms
Node.js

Workaround for the deprecated Crypt2.OpaqueSignString method

Shows how to replace the deprecated OpaqueSignString method. (Chilkat is moving away from the use of CkByteData.)

Chilkat Node.js Downloads

Node.js
NODEJS_PRELUDE

function chilkatExample() {

    var success = false;

    var crypt = new chilkat.Crypt2();

    var cert = new chilkat.Cert();
    //  ...
    //  Load the cert from a source such as a .pfx/.p12 file, smart card, USB token, Apple keychain, Windows certificate store, etc.
    //  
    success = crypt.SetSigningCert(cert);

    //  Sign the utf-8 byte representation of the text.
    crypt.Charset = "utf-8";

    var textToSign = "This is the text to sign";

    //  ------------------------------------------------------------------------
    //  The OpaqueSignString method is deprecated:

    outData = crypt.OpaqueSignString(textToSign);

    //  ------------------------------------------------------------------------
    //  Workaround.
    //  (Chilkat is moving away from using CkByteData)

    crypt.EncodingMode = "base64";
    var base64_sig = crypt.OpaqueSignStringENC(textToSign);

    var bd = new chilkat.BinData();
    bd.AppendEncoded(base64_sig,"base64");

    //  Access the raw bytes from bd.

}

chilkatExample();