Skip to content
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

Could I add a zip aes (en/de)crypt module ? #45

Closed
xqdoo00o opened this issue Mar 2, 2021 · 3 comments
Closed

Could I add a zip aes (en/de)crypt module ? #45

xqdoo00o opened this issue Mar 2, 2021 · 3 comments

Comments

@xqdoo00o
Copy link

xqdoo00o commented Mar 2, 2021

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?

@101arrowz
Copy link
Owner

101arrowz commented Mar 2, 2021

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!

@101arrowz
Copy link
Owner

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.

@101arrowz
Copy link
Owner

101arrowz commented Mar 21, 2021

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants