Skip to content

feat: validate WinZip AES ZIP extraction - #137

Merged
nextestudios merged 2 commits into
mainfrom
feature/64-zip-aes
Sep 27, 2026
Merged

nextestudios merged 2 commits into
mainfrom
feature/64-zip-aes

Conversation

@nextestudios

@nextestudios nextestudios commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Wrong AES password is now reported as such. SharpCompress rejects a WinZip AES password through the 2-byte verifier with InvalidFormatException("bad password"); ErrorMapper mapped it to "wrong password or corrupt" (non-fatal, per entry). It now maps to WrongPassword, so the extraction stops before writing and the app asks for the password again, like ZipCrypto/RAR.
  • Fixtures:
    • zip/Zip.deflate.WinzipAES.zip (AES-256, AE-2, password test) copied unchanged from SharpCompress b6cc95af (MIT, same provenance as the existing RAR/7z fixtures); extracted files are checked by SHA-256 against the originals.
    • AesZipFixtures (test support) writes AE-1/AE-2 archives per the public WinZip spec (PBKDF2-HMAC-SHA1, AES-CTR, HMAC-SHA1), used for AES-128 (AE-1, CRC checked) and AES-192 (AE-2, CRC 0 skipped).
  • Tests: missing → PasswordRequired; wrong → WrongPassword, nothing left behind; correct → byte-identical content; a tampered AE-1 entry is refused by the CRC check and not placed (security boundary).
  • docs/archive-support.md, fixture README and both changelogs updated with the observed results. Documented limitation: AE-2 stores CRC 0 and the engine doesn't verify the HMAC, so tampered AE-2 data is only noticed if decompression fails.

Tested in CI

  • Windows runner: all new tests pass.

Manual checks

  • None needed beyond the existing password keyboard flow.

Closes #64

🤖 Generated with Claude Code

nextestudios and others added 2 commits September 27, 2026 01:49
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@nextestudios
nextestudios merged commit 005d495 into main Sep 27, 2026
1 check passed
@nextestudios
nextestudios deleted the feature/64-zip-aes branch September 27, 2026 04:52
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.

feat: add AES-encrypted ZIP support (validation and fixtures)

1 participant