Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with Pkzip weak encryption #19

Open
ArnaudDebaene opened this issue Aug 23, 2022 · 0 comments
Open

Error with Pkzip weak encryption #19

ArnaudDebaene opened this issue Aug 23, 2022 · 0 comments

Comments

@ArnaudDebaene
Copy link

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!

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

No branches or pull requests

1 participant