Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

read from zipstream with password #301

Closed
black-06 opened this issue Mar 18, 2021 · 2 comments
Closed

read from zipstream with password #301

black-06 opened this issue Mar 18, 2021 · 2 comments

Comments

@black-06
Copy link

Hi,i want to read file from ZipInputstream.
This zip may be password protected or not,
and the password can also be any one of the known passwords.

I saw all the construction methods of ZipInputStream,but there is no suitable one.
What should I do?
Is there a method similar to ZipFile.isEncrypted and setPassword.
Thank you.

@srikanth-lingala
Copy link
Owner

srikanth-lingala commented Apr 6, 2021

Below is the equivalent of ZipFile.isEncrypted:

ZipInputStream zipInputStream = new ZipInputStream(...);
LocalFileHeader localFileHeader = zipInputStream.getNextEntry();
localFileHeader.isEncrypted();

But unfortunately, once the password is set via ZipInputStream's constructor, it cannot be changed again. I will add a feature to also set the password later via a ZipInputStream.setPassword(char[]) method. I will include this in the next release.

@srikanth-lingala
Copy link
Owner

Feature added in v2.8.0 released today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants