mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-24 10:08:00 -06:00
Adds crates/crypt/tests/proptests.rs (464 lines): eight properties over the payload and ciphertext side of the standard security handler. Tests only - no product code, no new dependency (proptest was already a dev-dependency here). Upstream's src/tests.rs covers this handler well with fixed vectors (including files qpdf wrote) and one property over malformed dictionaries. Its encrypted round trips run three shapes - a 30-byte text, a 1000-byte ramp and a 10-byte attachment. Not walked before: empty content, block boundaries (15/17), bytes handed to the decoder at lengths it never encrypted, key widths only key_len decides (5/16/16/32), /Perms verified by nothing, and Algorithm 2 step f for unencrypted metadata on revisions below 4. Evidence: 25 one-line breakages of crypt/src, each run against these properties AND upstream --lib; restored and byte-compared per row; verdicts from cargo exit codes. 16 seen here, several by nothing else in the repository (/Num fold width both directions, RC4-40 key length, /EFF selection, Identity name guard, IV scoping, step f, /Perms tail). Named blind spots: four hash_r6 breaks stay green because create() and open() share that function - the companion branch quotes qpdf's own numbers to close them. Gates: cargo test -p pdfcraft-crypt 25 passed / 0 failed; clippy --all-targets -D warnings clean; fmt clean. Default 256 cases, nothing lowered. Co-authored-by: Nick Nyssen <314538108+amoisttowe1@users.noreply.github.com>