Skip to content

ZipFile.TestArchive seems to always return false for AES encrypted zips #317

@Numpsy

Description

@Numpsy

Steps to reproduce

call

var zipFile = new ZipFile(@"AES.zip")
{
    Password = password
};

Assert.That(zipFile.TestArchive(false), Is.True, "Zip file should be valid");

On an AES encrypted zip file (happens with files generated with both SharpZipLib and 7-Zip).

Expected behavior

I assume that the test should pass for a valid AES archive?

Actual behavior

TestArchive returns false.

Looks like it fails @ https://github.com/icsharpcode/SharpZipLib/blob/master/src/ICSharpCode.SharpZipLib/Zip/ZipFile.cs#L1207 because the flags are different (localFlags just has the encrypted bit set, whereas entry.Flags has the StrongEncryption bit set I think).

If it gets past that, it will also fail on the compression method comparison, as entry.CompressionMethod is the compression format (Deflate), but compressionMethod is 99 (WinZipAES).

Version of SharpZipLib

1.1.0

Obtained from (only keep the relevant lines)

  • Compiled from source, commit: 25ee644

Metadata

Metadata

Assignees

Labels

bugzipRelated to ZIP file format

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions