Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

issue with pkzip weak encryption #266

Open
ArnaudDebaene opened this issue Aug 23, 2022 · 1 comment
Open

issue with pkzip weak encryption #266

ArnaudDebaene opened this issue Aug 23, 2022 · 1 comment

Comments

@ArnaudDebaene
Copy link

ArnaudDebaene commented Aug 23, 2022

Hello,

Using Dotnetzip 1.16 from nuget with .Net core sample app, I run into an issue with PkzipWeak encryption:

Using the following simple test:

private static void Main(string[] args)
{
    using (var zipFile = new ZipFile())
    {
        var entry = zipFile.AddEntry("dummy.bin", (nameof, stream) =>
        {
            var r = new Random();
            var buffer = new byte[40960];
            r.NextBytes(buffer);
            stream.Write(buffer);
        });
        entry.Encryption = EncryptionAlgorithm.PkzipWeak;
        entry.Password = "pwd12345";
        zipFile.Save("testzip.zip");
    }

    var check = ZipFile.CheckZipPassword("testzip.zip", "pwd12345");
}

The verification of the file with CheckWithPassword fails.
I also checked with several tools (Z-zip, Windows Explorer,...) that the generated file is indeed incorrect (or at least cannot be dezipped with specified password).
When using Aes128 or Aes256 for encryption method, the test succeeds....

What gives? I must be missing something obvious here...

Thank you!

@jshergal
Copy link
Collaborator

Thanks for reporting this bug/problem, and sorry about the delay in getting back to you. This is a self-service repository, where we merge PRs and where the merging of PRs causes nugets to be pushed automatically (if you bump the version number in your PR). I'll leave this issue open until someone (or yourself) fixes it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants