Add password-protected archives and CLI tools#394
Merged
Conversation
Implement Traditional PKWARE Encryption (APPNOTE 6.1) for reading and
writing password-protected zip archives. The feature is fully backward
compatible -- existing APIs and non-password usage are unchanged.
New public API:
- zip_open_with_password / zip_open_with_password_and_error
- zip_stream_open_with_password
- ZIP_EPASSWD error code
Encryption details:
- PKWARE cipher key derivation with raw (uncomplemented) CRC32
- On-the-fly encryption via tdefl callback for compressed entries
- Re-encryption at entry close to patch the CRC-based check byte,
ensuring interoperability with Info-ZIP unzip and Python zipfile
- Supports both compressed (deflate) and stored (level 0) entries
Add standalone CLI tools (gated behind -DZIP_BUILD_TOOLS=ON):
- zipcli -- create archives, with optional -p password
- unzipcli -- list/extract archives, with optional -p password
Add comprehensive test suite (test/test_password.c, 17 tests) covering
write/read round-trips, wrong passwords, stream API, entry deletion,
large data, and multiple writes per entry.
Update README.md with password-protected archive examples.
50b259d to
4069e17
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement Traditional PKWARE Encryption (APPNOTE 6.1) for reading and writing password-protected zip archives. The feature is fully backward compatible -- existing APIs and non-password usage are unchanged.
New public API:
Encryption details:
Add standalone CLI tools (gated behind -DZIP_BUILD_TOOLS=ON):
Add comprehensive test suite (test/test_password.c, 17 tests) covering write/read round-trips, wrong passwords, stream API, entry deletion, large data, and multiple writes per entry.
Update README.md with password-protected archive examples.
Closes https://github.com/kuba--/zip/issues/358