views:

1272

answers:

3

I'd like to unzip an encrypted/password protected file via a Ruby script without dropping down to a system call. I currently use the rubyzip library to unzip files but don't see an option for working with encrypted files.

Anyone know of some code or a library that will do this?

+1  A: 

The only one I've heard of to date is the Chilkat Ruby Zip library, which isn't free. The RubyZip library does not support password-protected files because the underlying library, zlib, doesn't do so either.

John Feminella
+2  A: 

Sometimes the right answer is to use a system call. That's why it's there.

True, it's slower and less elegant than using a library or a method. But it's cheaper than paying a tax to someone (a royalty payment) and much much faster than writing a new library yourself.

Larry K
A: 

Not a ruby library, but...maybe a free option.

If your app runs on Windows, you can use the DotNetZip library, via the new COM interface. It does password-protected files, either Zip encryption (weak), or WinZip-compatible AES encryption.

DotNetZip is free.

If Windows is out of the question, there may be another possibility. DotNetZip runs in Mono, too. I don't know if there are Ruby-to-Mono integration mechanisms to allow you to call from Ruby to Mono on other platforms, but if they exist, they also may let you call into DotNetZip.

Cheeso