Skip to content

Can't open an AES-encrypted Zip archive with password set to empty string. Is this archive nonstandard? #471

Closed
@michaelrgibbs

Description

@michaelrgibbs

Steps to reproduce

  1. Create a zip file with AES-256 encryption and an empty password. I have some created in the past with DotNetZip. I don't think they can be created with SharpZipLib.
  2. Create a ZipFile object from the zip file and set the Password field to "".
  3. Try to extract.

Expected behavior

The zip file is opened and extracted.

Actual behavior

The code acts as if no password has been set and throws exception "No password available for AES encrypted stream".

I see the setter code doesn't differentiate between null and empty string: https://github.com/icsharpcode/SharpZipLib/blob/master/src/ICSharpCode.SharpZipLib/Zip/ZipFile.cs#L360

7zip and DotNetZip allow these files to be extracted with an empty password, but I can't work out if they are just being more lenient than they need to be.

Version of SharpZipLib

1.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionzipRelated to ZIP file format

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions