🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

rsa-keygen

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rsa-keygen

Native RSA Keygen

1.0.6
latest
Source
npm
Version published
Weekly downloads
513
27.93%
Maintainers
1
Weekly downloads
 
Created
Source

node-rsa-keygen

NPM version Build Status Dependency Status

Generates a RSA keypair using native OpenSSL library.

This code is loosely based on ursa RSA generation code.

History

As from node 0.11 the crypto library has publicEncrypt and privateDecrypt functions, we don't need to rely on any external libraries for public-key cryptography.

Usage

Install the library:

npm install --save rsa-keygen
var rsaKeygen = require('rsa-keygen');
var keys = rsaKeygen.generate();

Example

var crypto = require('crypto');
var rsaKeygen = require('rsa-keygen');

var keys = rsaKeygen.generate();

var result = crypto.publicEncrypt({
    key: keys.public_key
}, new Buffer('Hello world!'));
// <Crypted Buffer>

var plaintext = crypto.privateDecrypt({
    key: keys.private_key
}, result);
// Hello world!

Keywords

rsa

FAQs

Package last updated on 20 May 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts