-
-
Save paulohp/39b44c42e1fa606d13bd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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