Closed xqdoo00o closed 3 years ago
AES encryption is not yet fully possible in fflate
. Even if it were, SJCL will slow the compression speed to a halt.
I suggest using zip.js
for this. It supports AES encryption and decryption through its ZipReader and ZipWriter interfaces and does not require any effort from you regarding SJCL because it uses the Web Crypto API, which is built into browsers.
If you'd like to enjoy the performance of fflate
but need AES support, you can use fflate
compression by using the fflate
DEFLATE implementation in zip.js
. I suggest using this file instead of the file linked in that document to minimize bundle size.
Unfortunately, zip.js
is not very optimized for bundle size, so it may be a bit slower to load. I'll look into adding support for AES from fflate
in the future. Hope this works for you!
I've decided to make this possible through a third party Zip/Unzip plugin, but not directly. I'll push an update in a few days that makes it possible; you're welcome to create the plugin, since it seems you already are familiar with AES encryption.
The architecture change for this is taking much longer than expected.
Seeing that zip.js
has actually implemented this, I'm going to ask that anyone needing support for ZIP encryption use zip.js
with the fflate
DEFLATE implementation. zip.js
is close in performance to fflate
outside of the actual compression, so as long as you enable fflate
compression in zip.js
performance will be satisfactory. However, zip.js
still is significantly bigger in bundle size (about 100kB vs. 7kB), so I'll continue to look into ways to make this possible while keeping the package extensible and small. I will update here if any changes arise (e.g. if I do manage to make this extension possible).
What can't you do right now?
Aes encrypt for zip.
An optimal solution Use sjcl to do it.
Could I add a zip aes (en/de)crypt module? And if I could add that module, could you give me some suggestions?