-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Streaming encryption/decryption #16
Comments
I didn't move it, so it just stayed wherever it is. I've Icebox'd it for now. |
@bmann cool cool thanks :) |
I'd probably budget a day for this. Like with a lot of crypto stuff, it's sort of hard to tell. Theoretically it shouldn't be too hard, but if you run into any issues, it's very hard to debug because you're just dealing with nonsensical bytes. But yeah icebox for now 👍 . This doesn't matter much until we start streaming large private files (private videos for instance) |
I might try to tackle this one soon-ish, so we can add full Fission support to Diffuse 🙏 @dholms I don't think I'll be able to do in one day. So any pointers are welcome 😄 |
👍 Unfortunately it might be a bit of a pain to do... Basically:
The other option is to just leave the library the way it is, fully read info into memory, encrypt/decrypt it, and then just write that to a stream. This is pretty memory intensive & won't work well for large files. But if the goal is just a streaming API and you're working with smaller files (I think songs would be fine 🤔) then this would work as a stopgap Let me know if this makes sense & if you want any clarity on anything or if a call might help! |
Posted in Discord, but relevant here: https://security.stackexchange.com/questions/65085/using-aes-as-a-stream-cipher TL;DR they agree with @dholms on the AES-CTR idea, and give similar tradeoffs. Importantly:
|
Problem
WebCrypto does not support streaming encryption/decryption. This means that if we want to display a large file in the browser, we need to read the entire file into memory, decrypt it, and the stream it to the renderer.
w3c/webcrypto#73
Solution
We're using AES-CTR, so after calculating the nonce, the counter is predictable for each block.
W'll need to read one block at a time, encrypt, write to outStream & increment the counter
The text was updated successfully, but these errors were encountered: