Open cnasikas opened 6 years ago
Hi
First of all I would like to thank you for this great crypto library!
I am opening this issue for guidance and discussion.
Goal:
Encrypt/decrypt efficiently and securely a file.
Requirements:
Experiments:
Encrypt a 400mb file with sjcl.encypt(key, wholeTextFile). That's takes a lot of memory and it is inefficient.
So I was wondering if it is possible to encrypt chunks of the file having the same security guarantees as sjcl.encrypt
sjcl.encrypt
Sketch:
const { Transform } = require('stream') class FileEncryptStreamer extends Transform { _transform (chunk, encoding, callback = () => {}) { this.push(sjcl.encryptChunk(chunk)) // encryptChunk function does not exist. That's what we try to implement callback() } } let iv = sjcl.codec.hex.fromBits(sjcl.random.randomWords(4)) //128 bit iv const frs = fs.createReadStream('file.txt', {highWaterMark: 16}) //chunk size const fws = fs.createWriteStream('file.enc') const fes = new FileEncryptStreamer(symmetricKey, hmacKey, Buffer.from(iv, 'hex')) frs.pipe(fes).pipe(fws)
Questions:
sjcl.mode.ccm.encrypt
Thanks a lot!!
I second this request. I would like to be able to run HMAC on multi-megabyte files.
Hi
First of all I would like to thank you for this great crypto library!
I am opening this issue for guidance and discussion.
Goal:
Encrypt/decrypt efficiently and securely a file.
Requirements:
Experiments:
Encrypt a 400mb file with sjcl.encypt(key, wholeTextFile). That's takes a lot of memory and it is inefficient.
So I was wondering if it is possible to encrypt chunks of the file having the same security guarantees as
sjcl.encrypt
Sketch:
Questions:
sjcl.encrypt
orsjcl.mode.ccm.encrypt
directly to every chunk ?Thanks a lot!!