Create password protected zip

7-zip and other applications allow you to “password-protected” a zip archive (using some encryption, usually AES.)

The zip erlang module unfortunately does not support this feature, as per the documentation:

The zip module supports zip archive versions up to 6.1. However, password-protection and Zip64 are not supported.

So I’m wondering what would be the best strategy to handle that:

  • is there another erlang / elixir library that would handle this ?
  • should I find the C library behind the zip exe (if opensource ?) and call it (woud ports be the right tool ?)
  • should it be possible to create the zip in erlang and encrypt it out of bound ?
  • or should I just give up on trying to do this with code, and assume a external client-line tool (zip, 7zip, etc…) is available to generate the file out of the application (using System.cmd ?)
1 Like

Packages | Hex - seems like zstream has support?

I does seem to. I missed it on hex, thanks ! :man_facepalming:

1 Like

Try with zstream hex-package
https://hexdocs.pm/zstream/readme.html

The zstream lib can not create multivolume archive, and if I want to create multivolume archive what lib/method should be use? thanks much!


For my scenario, I choose to execute external executable program (7zz for Linux environment) for create multivolume archive, the code like follow:

appdir = Application.app_dir(:APPNAME)
System.cmd("#{appdir}/priv/executable/7zz", ["a", "-tzip", "target_zip_name.zip", "/dir1/dir2/source_file_name.zip", "-v100k"])