Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recommendations on a free library to be used for zipping files [closed]

I need to zip and password-protect a file. Is there a good (free) library for this?

This needs to be opened by a third party, so the password protection needs to work with standard tools.

like image 708
nearly_lunchtime Avatar asked Oct 03 '08 11:10

nearly_lunchtime


People also ask

Which module can help extract all of the files from a ZIP file?

extractall() method will extract all the contents of the zip file to the current working directory. You can also call extract() method to extract any file by specifying its path in the zip file.

Which of the encryption algorithms are supported by the zip format?

WinZip offers two kinds of encryption: strong AES encryption and weak Zip 2.0 (Legacy) encryption. If you have important security requirements for your data, you should use WinZip's AES encryption.

Can 7zip encrypt files?

7-Zip can package a single file, multiple files, or an entire folder into a passphrase-protected and encrypted package.


2 Answers

You can try Zip4j, a pure java library to handle zip file. It supports encryption/ decryption of PKWare and AES encryption methods.

Key features:

  • Create, Add, Extract, Update, Remove files from a Zip file
  • Read/Write password protected Zip files
  • Supports AES 128/256 Encryption
  • Supports Standard Zip Encryption
  • Supports Zip64 format
  • Supports Store (No Compression) and Deflate compression method
  • Create or extract files from Split Zip files (Ex: z01, z02,...zip)
  • Supports Unicode file names
  • Progress Monitor

License:

  • Zip4j is released under Apache License, Version 2.0.
like image 132
Matt Avatar answered Oct 06 '22 19:10

Matt


UPDATE 2020: There are other choices now, notably Zip4J.


After much searching, I've found three approaches:

A freely available set of source code, suitable for a single file zip. However, there is no license. Usage is AesZipOutputStream.zipAndEcrypt(...). http://merkert.de/de/info/zipaes/src.zip (https://forums.oracle.com/forums/thread.jspa?threadID=1526137)

UPDATE: This code is now Apache licensed and released at https://github.com/mobsandgeeks/winzipaes (exported from original home at Google code) . It worked for me (one file in the zip), and fills a hole in Java's opens source libraries nicely.

A commercial product ($500 at the time of writing). I can't verify if this works, as their trial license approach is complex. Its also a ported .NET app: http://www.nsoftware.com/ipworks/zip/default.aspx

A commercial product ($290 at the time of writing). Suitable only for Wnidows as it uses a dll: http://www.example-code.com/java/zip.asp

like image 25
JodaStephen Avatar answered Oct 06 '22 17:10

JodaStephen