No crate that can produce encrypted compressed archives?

I have spent the last 2 hours or so trying to find a crate that can produce password protected zip files. But i cant find any.

All i have found are native implementations of how to produce zip files, but none of these support the ability to encrypt the archive as the likings of 7zip, lzma etc.

Is there no such crate?

Just for reference, here's an open issue discussing encryption support for the popular zip crate:

https://github.com/zip-rs/zip/issues/157

I'm not surprised you couldn't find a zip library implementing encryption. The encryption used by most zip files leaks metadata and is easily crackable.

If you don't need to decrypt existing zip files, I'd recommend just wrapping a normal unencrypted zip file in a layer of encryption. You can use something like PBKDF2 to turn a normal password into an encryption key of the correct length, then encrypt the zip file with a symmetric cipher like AES.

Could you please elaborate when you say they "leak".

For instance 7zip uses Aes-256 as their encryption algo which is as strong as it gets. What i want is to produce a zip file that is password protected, that can be unlocked and unziped by using for instance 7z, but i most preferably dont want to call 7z in a subprocess, or deal with C-bindings to the LZMA header files.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.