haf / DotNetZip.Semverd

Please use System.IO.Compression! A fork of the DotNetZip project without signing with a solution that compiles cleanly. This project aims to follow semver to avoid versioning conflicts. DotNetZip is a FAST, FREE class library and toolset for manipulating zip files. Use VB, C# or any .NET language to easily create, extract, or update zip files.
Other
550 stars 235 forks source link

Zip encryption fails for empty input files #105

Open JKLeipzig opened 7 years ago

JKLeipzig commented 7 years ago

Hi,

I'm habing an issue encrypting files in an archive. If I put an empty file in an archive, the files is not encrypted though I want it to, and have it specified in the code. If I put any content in the file to be zipped, it is encrypted using exactly the same code.

I made a small test program demonstraiting the issue. You can verify the issue by running it. Also, if you have a look at the generated zip file in 7-sip, or so, you'll see the file with content to be stored encrypted while the empty file is stored unencrypted.

That seems to be bug in the library...

Test project demonstating the issue: https://github.com/JKLeipzig/IonicZipTest

Kindest regards, Jan

haf commented 7 years ago

This repo is a self-service repo at the time of writing; we merge PRs, but don't do much more development. If you'd be open to submitting a PR with a fix for your repo, we'd be delighted.

JKLeipzig commented 7 years ago

While debugging the issue, I stumbled over [1]. So that seems to be kind of a "feature", well, maybe more a workaround to get non-corrupted zip files for zero-length inputs. As it works with other libs, it should be fixed, though it might need some time to work this out...

I'll try to provide a fix for the issue ASAP.

[1] https://dotnetzip.codeplex.com/workitem/8931

Best regard Jan