pdftract/crates/pdftract-core/tests
jedarden a62913f25d feat(pdftract-1z0qt): implement encryption detection + RC4/AES-128/AES-256 decryption
Implement decrypt feature with RC4, AES-128, and AES-256 decryption support
for encrypted PDFs per PDF 1.7/2.0 spec.

Core components:
- detection.rs: Parse /Encrypt dictionary, validate encryption metadata
- rc4.rs: V=1 R=2 (40-bit) and V=2 R=3 (40-128 bit) key derivation
- aes_128.rs: V=4 R=4 AES-128 CBC with PKCS#7 padding
- aes_256.rs: V=5 R=5/6 AES-256 with SHA-256/384/512 key derivation
- decryptor.rs: Unified API for password validation and stream/string decryption

Integration:
- extract_pdf: Detect encryption and validate passwords after xref loading
- CLI: Exit code 3 for encryption errors (wrong password, unsupported)
- Password sources: --password-stdin, PDFTRACT_PASSWORD, --password VALUE (opt-in)

Password validation: Empty string first, then user-provided. Wrong
password emits ENCRYPTION_UNSUPPORTED diagnostic and exits with code 3.

Tests: Unit tests for RC4, AES-128, AES-256 key derivation and
validation. All pass with `cargo test --features decrypt`.

Refs: Plan Phase 1.4 line 1114, EC-04/EC-05/EC-06, PDF spec 7.6

Co-Authored-By: Claude Code <noreply@anthropic.com>
2026-05-28 03:22:36 -04:00
..
classifier_corpus.rs fix: resolve compilation errors across codebase 2026-05-25 08:38:04 -04:00
conformance.rs feat(pdftract-3s2i): implement Phase 5.5.2 validation filter 2026-05-24 04:57:17 -04:00
encryption_aes_128_test.rs fix(pdftract-495uv): AES-128 test buffer allocation for PKCS#7 padding 2026-05-28 01:56:26 -04:00
encryption_aes_256_test.rs feat(pdftract-1z0qt): implement encryption detection + RC4/AES-128/AES-256 decryption 2026-05-28 03:22:36 -04:00
encryption_rc4_test.rs test(pdftract-4isj9): add RC4 encryption integration tests 2026-05-26 20:26:52 -04:00
error_recovery_integration.rs feat(pdftract-4li3d): implement security constraints for serve mode 2026-05-26 18:47:51 -04:00
memory_guard.rs feat(bf-2ervu): implement mmap-backed PdfSource via memmap2 2026-05-24 08:40:11 -04:00
memory_guard_tests.rs feat(bf-2ervu): implement mmap-backed PdfSource via memmap2 2026-05-24 08:40:11 -04:00
ocr_integration.rs fix: resolve compilation errors across codebase 2026-05-25 08:38:04 -04:00
page_classification.rs feat(pdftract-3s2i): implement Phase 5.5.2 validation filter 2026-05-24 04:57:17 -04:00
struct_tree_coverage.rs fix(pdftract-63ka2): AES-128 test buffer allocation for PKCS#7 padding 2026-05-28 01:30:33 -04:00
test_xref_debug.rs feat(pdftract-3s2i): implement Phase 5.5.2 validation filter 2026-05-24 04:57:17 -04:00
TH-01-stream-bomb.rs feat(pdftract-3h9xo): implement threads JSON output + schema integration 2026-05-25 13:40:15 -04:00
TH-03-mcp-no-auth.rs test(pdftract-5m3hp): implement TH-03 MCP no-auth bind security tests 2026-05-24 18:43:52 -04:00
TH-04-js-presence.rs feat(pdftract-4li3d): implement security constraints for serve mode 2026-05-26 18:47:51 -04:00
TH-07-ps-leak.rs fix: resolve compilation errors across codebase 2026-05-25 08:38:04 -04:00
TH-10-cache-poison.rs feat(pdftract-2okbq): implement TH-10 cache poisoning protection 2026-05-26 21:09:54 -04:00
th06_checksum_test.rs feat(pdftract-4li3d): implement security constraints for serve mode 2026-05-26 18:47:51 -04:00
th_05_ssrf_block.rs feat(pdftract-3s2i): implement Phase 5.5.2 validation filter 2026-05-24 04:57:17 -04:00
xref_helpers.rs feat(bf-2ervu): implement mmap-backed PdfSource via memmap2 2026-05-24 08:40:11 -04:00
xref_integration_test.rs feat(bf-2ervu): implement mmap-backed PdfSource via memmap2 2026-05-24 08:40:11 -04:00