Skip to content

InputStream implementation doesn't allow check for encryption beforehand #359

@bio007

Description

@bio007

Using InputStream to extract files, which I don't know whether they are password protected or not beforehand, doesn't allow to check for encryption before extraction.

Right now you need to call setPassword or provide password via constructor before calling getNextEntry() which is not always possible. On the other hand calling headerReader.readLocalFileHeader() to obtain LocalFileHeader is possible without password and there isEncrypted() can be checked.

Unfortunately getNextEntry() doesn't execute some "password callback" in case this is detected but tries to extract right away after obtaining LocalFileHeader.

Calling headerReader.readLocalFileHeader() first and then getNextEntry() causes skipping of files because headerReader.readLocalFileHeader() moves the position in the stream of course.

To solve this please provide something like "password callback" setter which will be executed if no password was provided and file is encrypted.

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions