Miss any of our Open RFC calls?Watch the recordings here! »

node-jsbnrsa

0.0.6 • Public • Published

node-jsbnrsa

node base RSA encrypt / decrypt module

NPM

Example

var RSA = require('node-jsbnrsa');
var assert = require('assert');

var modulus =
	'38F991C8E0F947214A470DEB79FE1B37' +
	'EDE859A7323A2934C0E8DBB5E069C6D7' +
	'4E451A6C4C5406295CF49289EAA697E5' +
	'544E71DB7424805FF3E128F5B913278B' +
	'9EFE797AF82C44B089EEC12923CABD7B' +
	'5A8B8DB5C629136A1CBD9A534A2AF62E' +
	'BCB5D8AC2BBA57BCDD1365DD9A8A49C0' +
	'6E9177774F1B08F9CC416D84B7BCCCE4' +
	'0835E1CFBF63041FF2BCDC139FA19616' +
	'4B961A6B6C1751B3896E1A3F3E3DA6DB' +
	'32C244583BB0A1A167E96D8957CB5EA7';

var exponent = '1001';

var encryptedData =
	'38F991C8E0F947214A470DEB79FE1B37' +
	'EDE859A7323A2934C0E8DBB5E069C6D7' +
	'4E451A6C4C5406295CF49289EAA697E5' +
	'544E71DB7424805FF3E128F5B913278B' +
	'9EFE797AF82C44B089EEC12923CABD7B' +
	'5A8B8DB5C629136A1CBD9A534A2AF62E' +
	'BCB5D8AC2BBA57BCDD1365DD9A8A49C0' +
	'6E9177774F1B08F9CC416D84B7BCCCE4' +
	'0835E1CFBF63041FF2BCDC139FA19616' +
	'4B961A6B6C1751B3896E1A3F3E3DA6DB' +
	'32C244583BB0A1A167E96D8957CB5EA7';

var key = new RSA();
var data = key.encrypt(encryptedData);
var buf = new Buffer(data, 'hex');

assert(buf[0] === 0x6A);
assert(buf[buf.length-1] === 0xBC);

Installation

You can install the latest tag via npm:

npm install node-jsbnrsa

Install

npm i node-jsbnrsa

DownloadsWeekly Downloads

31

Version

0.0.6

License

BSD

Last publish

Collaborators

  • avatar