1.0.1 • Published 1 year ago
vascomm-rsa-sha v1.0.1
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. 1. Move to the directiories where you want to generate the RSA KeyPair. 2. Generating the Private Key
``` bash
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