DotNetZip.Semverd icon indicating copy to clipboard operation
DotNetZip.Semverd copied to clipboard

Zip encryption fails for empty input files

Open JKLeipzig opened this issue 8 years ago • 2 comments

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

JKLeipzig avatar Nov 27 '17 13:11 JKLeipzig

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.

haf avatar Nov 28 '17 12:11 haf

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

JKLeipzig avatar Nov 29 '17 13:11 JKLeipzig