Skip to content

Instantly share code, notes, and snippets.

@alanhoff
Created June 27, 2014 19:23
Show Gist options
  • Save alanhoff/6c7cd17a944618c4d115 to your computer and use it in GitHub Desktop.
Save alanhoff/6c7cd17a944618c4d115 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.dencrypt(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