Skip to content

Update getLength in PDEncryprion according to specification - #724

Merged
MaximPlusov merged 2 commits into
integrationfrom
encryption-length
Aug 27, 2026
Merged

Update getLength in PDEncryprion according to specification#724
MaximPlusov merged 2 commits into
integrationfrom
encryption-length

Conversation

@LonelyMidoriya

@LonelyMidoriya LonelyMidoriya commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes
    • Improved PDF encryption handling by applying the correct default key lengths for encryption algorithms V4 and V5.
    • Preserved existing behavior for other encryption configurations, including dictionary-defined and legacy defaults.
    • Enhanced compatibility when opening and processing encrypted PDF documents that use newer encryption standards.

@LonelyMidoriya LonelyMidoriya self-assigned this Aug 27, 2026
@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: eefe90c3-4b39-4ea6-bdea-c3b4edc53ecb

📥 Commits

Reviewing files that changed from the base of the PR and between 3014e75 and 0ab7f42.

📒 Files selected for processing (1)
  • src/main/java/org/verapdf/pd/encryption/PDEncryption.java

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

PDEncryption.getLength() now returns 128 bits for encryption version 4 and 256 bits for version 5. Version 1 returns 40 bits. Other versions retain the existing LENGTH lookup and 40-bit fallback.

Changes

Encryption key length handling

Layer / File(s) Summary
Version-based key length defaults
src/main/java/org/verapdf/pd/encryption/PDEncryption.java
Adds default lengths for encryption versions 4 and 5. Updates getLength() to select version-specific defaults before the existing LENGTH dictionary lookup and fallback.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Merge Risk: ⚪ Minimal · up to 0ab7f

The change updates encryption key-length selection for specified PDF versions without adding new dependencies, authorization paths, or entrypoints. No actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: maximplusov

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change to getLength() in PDEncryption and indicates that the implementation follows the specification. It contains a typo in PDEncryprion, but the intended …
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title clearly identifies the main change to getLength() in PDEncryption and indicates that the implementation follows the specification. It contains a typo in PDEncryprion, but the intended class is clear.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch encryption-length

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@MaximPlusov
MaximPlusov merged commit 4d1484e into integration Aug 27, 2026
9 checks passed
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.

2 participants