Package Exports
- vascomm-rsa-sha
- vascomm-rsa-sha/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vascomm-rsa-sha) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
RSA-SHA
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.
Move to the directiories where you want to generate the RSA KeyPair.
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.Generating the Public Key
openssl rsa -pubout -in privateKey.pem -out publicKey.pem
Notes:
privateKey.pem
must be the Private Key filename. You can changepublicKey.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