Skip to content

Instantly share code, notes, and snippets.

@paulohp
Forked from alanhoff/decriptar.js
Created June 27, 2014 21:46
Show Gist options
  • Save paulohp/39b44c42e1fa606d13bd to your computer and use it in GitHub Desktop.
Save paulohp/39b44c42e1fa606d13bd to your computer and use it in GitHub Desktop.
var rsa = require('rsa-stream');
var fs = require('fs');
var privkey = fs.readFileSync('./minhaPrivKey.key', 'utf8');
var encStream = rsa.decrypt(privkey);
var inStream = fs.createReadStream('./foto.enc');
var outStream = fs.createWriteStream('./minhafotolocodedoida.jpg');
inStream.pipe(encStream).pipe(outStream);
var rsa = require('rsa-stream');
var fs = require('fs');
var pubkey = fs.readFileSync('./minhaPubKey.pub', 'utf8');
var encStream = rsa.encrypt(pubkey);
var inStream = fs.createReadStream('./minhafotolocodedoida.jpg');
var outStream = fs.createWriteStream('./foto.enc');
inStream.pipe(encStream).pipe(outStream);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment