mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-01 22:19:10 -06:00
`pdfcraft-cli info`, `text`, `render` and `audit` rejected the owner password of RC4-40, RC4-128 and AES-128 files with "the password is incorrect", while `run doc_open` accepted it (#2670, item 8). The renderer authenticates only the user password of revisions 2–4. `Session::open` works around that by handing it the user password that owner authentication recovers, but the CLI passed the typed password straight to `inspect` and `PageRenderer`. `pdfcraft_engine::render_password_for` now gives any render path outside a session the password the renderer takes, sharing the recovery with `Session::open`. The CLI uses it for the renderer and keeps the typed password for the engine session and the cos document, so the owner password still lifts copy restrictions in `text`. The render test decodes the PNG and checks its dimensions and that it has non-white pixels, for every algorithm with either password. Refs #2670 (item 8 only). Checks: cargo fmt --check; cargo clippy -p pdfcraft-cli -p pdfcraft-engine --all-targets -- -D warnings; cargo test -p pdfcraft-cli; cargo test -p pdfcraft-engine (and --lib); cargo xtask layers, assets, parity. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>