Exciting news!Announcing our $4.6M Series Seed. Learn more
Socket
LoveBlogFAQ
Install
Log in

rsa-keygen

Package Overview
Dependencies
1
Maintainers
1
Versions
6
Issues
File Explorer

Advanced tools

rsa-keygen

Native RSA Keygen

    1.0.6latest

Version published
Maintainers
1
Yearly downloads
21,229
increased by2.33%

Weekly downloads

Readme

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

Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc