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

Allow ZipFile to accept empty strings as passwords when decrypting AES entries #472

Merged
merged 2 commits into from
Jun 19, 2020

Conversation

Numpsy
Copy link
Contributor

@Numpsy Numpsy commented Jun 14, 2020

refs #471

Two changes:

  1. In the current setter for ZipFile.Password, it only updates the rawPassword_ member if the new value isn't null or empty.
    That seems wrong to me in general, as it means that setting the password to a value and then setting it to null would leave the member set to the old value?
    This PR changes it to always just save the new value in rawPassword_.

  2. In CreateAndInitDecryptionStream, throw if the string password is null, but proceed to try to use it if the string is empty.

The current code uses HasKeys to check that it has the keys, but then uses the password instead, which doesn't sound quite right? (though looking at the way KeysRequired/OnKeysRequired I'm not sure if it works to get the password (rather than the keys') for decrypting AES entries?

I certify that I own, and have sufficient rights to contribute, all source code and related material intended to be compiled or integrated with the source code for the SharpZipLib open source product (the "Contribution"). My Contribution is licensed under the MIT License.

@Numpsy
Copy link
Contributor Author

Numpsy commented Jun 14, 2020

Updated to remove accidental test dependency on line ednding settings.

Copy link
Member

@piksel piksel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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

Successfully merging this pull request may close these issues.

2 participants