Sample code for 30+ languages & platforms
Node.js

RSA Import Public Key

See more RSA Examples

Shows how to select/import a public key for RSA encryption or signature verification.

Chilkat Node.js Downloads

Node.js
NODEJS_PRELUDE

function chilkatExample() {

    var success = false;

    var pubKey = new chilkat.PublicKey();
    //  In all Chilkat methods expecting a path, you pass either absolute or relative paths.
    success = pubKey.LoadFromFile("rsaKeys/myTestRsaPublic.pem");
    if (success == false) {
        console.log(pubKey.LastErrorText);
        return;
    }

    var rsa = new chilkat.Rsa();

    //  Tell RSA to use the public key.
    rsa.UsePublicKey(pubKey);

}

chilkatExample();