vascomm-rsa-sha

1.0.1 • Public • Published

Vascomm RSA-SHA

Modules Installation

To install the modules, run:

npm install vascomm-rsa-sha

Generating RSA KeyPair

To perform the following actions, you must have OpenSSL installed on your operating system.

  1. Move to the directiories where you want to generate the RSA KeyPair.

  2. Generating the Private Key

    openssl genrsa -out privateKey.pem 2048

    Notes: you can change privateKey.pem to the desired output name of generated Private Key.

  3. Generating the Public Key

    openssl rsa -pubout -in privateKey.pem -out publicKey.pem

    Notes: privateKey.pem must be the Private Key filename. You can change publicKey.pem to the desired output name of generated Public Key.

Usage

let RSA_SHA = require('RSA-SHA');
let fs = require('fs');

let publicKey = fs.readFileSync('/path/to/public/key');
let privateKey = fs.readFileSync('/path/to/private/key');

let text = "Lorem Ipsum"

// Encrypt RSA
let encypted = RSA_SHA.encryptRSA(text, publicKey);
console.log(encypted)

// Decrypt RSA
console.log(RSA_SHA.decryptRSA(encypted, privateKey));

// Sign SHA
let signed = RSA_SHA.signSHA(text, privateKey);
console.log(signed);

//Verify SHA
console.log(RSA_SHA.verifySHA(text,signed, publicKey)); //true

Options

License

This modules is licensed under PT Vascomm Solusi Teknologi.

Contributing

  • Gaby

Questions / Problems?

Ask your developer related questions to Vascomm Backend Division

Package Sidebar

Install

npm i vascomm-rsa-sha

Weekly Downloads

3

Version

1.0.1

License

ISC

Unpacked Size

4.19 kB

Total Files

3

Last publish

Collaborators

  • vascomm