This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes I/O and Streams and the fly likes Read a passowrd protected zip file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "Read a passowrd protected zip file" Watch "Read a passowrd protected zip file" New topic

Read a passowrd protected zip file

Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2591

Is there any built-in API in new Java for reading a password protected zip file?

- Manish
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
The Java classes that read Zip files, e.g. ZipInputStream, do not support decrypting password-protected Zip files. I don't know of any publicly-available code in Java which will do this, either. But this functionality is straightforward to add yourself. The decryption algorithm needed is described in You can subclass the existing Java classes to add support for decryption; you will also have to define a mechanism for a user of your subclass to enter the appropriate password, using a dialog box for example. (And if you do so, please make that code publically available and submit a link to that code as feedback to this question!)

Java Developer, Thailand
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8927

Manish Hatwalne
Ranch Hand

Joined: Sep 22, 2001
Posts: 2591

I have read that faq on JGuru, but I am wondering if there is any built in support in new Java for this.

- Manish
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15302

Moving to I/O and Streams...

GenRocket - Experts at Building Test Data
subject: Read a passowrd protected zip file
It's not a secret anymore!