Sample code for 30+ languages & platforms
Node.js

Transition from Cert.ExportPrivateKey to Cert.GetPrivateKey

Provides instructions for replacing deprecated ExportPrivateKey method calls with GetPrivateKey.

Chilkat Node.js Downloads

Node.js
NODEJS_PRELUDE

function chilkatExample() {

    var success = false;

    var cert = new chilkat.Cert();

    //  ------------------------------------------------------------------------
    //  The ExportPrivateKey method is deprecated:

    // privatekeyObj: PrivateKey
    var privatekeyObj = cert.ExportPrivateKey();
    if (cert.LastMethodSuccess == false) {
        console.log(cert.LastErrorText);
        return;
    }

    //  ...
    //  ...

    //  ------------------------------------------------------------------------
    //  Do the equivalent using GetPrivateKey.
    //  Your application creates a new, empty PrivateKey object which is passed 
    //  in the last argument and filled upon success.

    var privatekeyOut = new chilkat.PrivateKey();
    success = cert.GetPrivateKey(privatekeyOut);
    if (success == false) {
        console.log(cert.LastErrorText);
        return;
    }


}

chilkatExample();