1
votes

What's the easiest way to zip and encrypt a file with AES (128 or 256) in a Rails app, so that the zip archive can be opened with WinZip?

Requirements:

  1. Zip archive can be opened by WinZip (so no 7-zip)
  2. Zip archive is encrypted with AES-128 or AES-256 (which WinZip supports)

Gems:

  1. Rubyzip: doesn't support encryption
  2. Zipruby: supports only the traditional/legacy non-AES encryption which is significantly less secure.

Any advice on what I can do here?

Thanks!

1

1 Answers

2
votes

Are commercial products out of the question? Chilkat Ruby Zip appears to support WinZip AES. The example code looks pretty temptingly easy.

There also appears to be a Java library available. If you're running in JRuby... Or if you feel like porting!