From ff0b0dcca2d34cec9e69933c4eeb04b6b8064f73 Mon Sep 17 00:00:00 2001 From: Richard Webb Date: Sat, 15 Jun 2019 22:44:33 +0100 Subject: [PATCH 1/2] Change ZipFile.TestLocalHeader to check CompressionMethodForHeader rather than CompressionMethod. refs #317. --- src/ICSharpCode.SharpZipLib/Zip/ZipFile.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ICSharpCode.SharpZipLib/Zip/ZipFile.cs b/src/ICSharpCode.SharpZipLib/Zip/ZipFile.cs index 4afc1bf75..b2fab2f1b 100644 --- a/src/ICSharpCode.SharpZipLib/Zip/ZipFile.cs +++ b/src/ICSharpCode.SharpZipLib/Zip/ZipFile.cs @@ -1215,7 +1215,7 @@ private long TestLocalHeader(ZipEntry entry, HeaderTest tests) } // Central header compression method matches local entry - if (entry.CompressionMethod != (CompressionMethod)compressionMethod) + if (entry.CompressionMethodForHeader != (CompressionMethod)compressionMethod) { throw new ZipException("Central header/local header compression method mismatch"); } From c8ae5a719598c0247e7cb76e85cd4099a8bda270 Mon Sep 17 00:00:00 2001 From: Richard Webb Date: Sat, 15 Jun 2019 22:45:25 +0100 Subject: [PATCH 2/2] Test ZipFile.TestArchive with an AES encrypted archive. --- test/ICSharpCode.SharpZipLib.Tests/Zip/ZipEncryptionHandling.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/ICSharpCode.SharpZipLib.Tests/Zip/ZipEncryptionHandling.cs b/test/ICSharpCode.SharpZipLib.Tests/Zip/ZipEncryptionHandling.cs index 3f8f64427..e18d06548 100644 --- a/test/ICSharpCode.SharpZipLib.Tests/Zip/ZipEncryptionHandling.cs +++ b/test/ICSharpCode.SharpZipLib.Tests/Zip/ZipEncryptionHandling.cs @@ -71,6 +71,8 @@ public void ZipFileAesDecryption() Assert.AreEqual(DummyDataString, content, "Decompressed content does not match input data"); } } + + Assert.That(zipFile.TestArchive(false), Is.True, "Encrypted archive should pass validation."); } }