Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Unknown encryption type R = 5" #1199

Open
brettrowberry opened this issue Aug 7, 2024 · 7 comments
Open

"Unknown encryption type R = 5" #1199

brettrowberry opened this issue Aug 7, 2024 · 7 comments

Comments

@brettrowberry
Copy link

Is your feature request related to a problem? Please describe.
Similar to #375, which resolved "R = 6" exceptions, I am getting "Unknown encryption type R = 5" with certain files.

Describe the solution you'd like
Files with R = 5 encryption type supported.

Describe alternatives you've considered
I could try PDFBox.

Your real name
Brett Rowberry

Additional context
Here's a file that can produce the exception r-equals-5.pdf.

@Lonzak
Copy link
Contributor

Lonzak commented Aug 8, 2024

MKL implemented support for R=6 some time ago (one of the best additions to openPDF imho).
However R=5 is a proprietary adobe extension which has been deprecated and should not be used. (Thats why it wasn't implemented)
You are of course free to implement it - perhaps mkl can give you some pointers. Maybe it is only extending R=4 with AES256?

@mkl-public
Copy link
Contributor

@Lonzak already correctly explained that R=5 encryption is part of an Adobe extension to PDF that never became standard and only is mentioned as deprecated and forbidden to use in ISO 32000-2.
In contrast to his assumption "Maybe it is only extending R=4 with AES256", though, the R=5 algorithm is more related to R=6 than R=4. The differences between R=5 and R=6 mostly are additional variable numbers of hashing rounds in the latter to make breaking the encryption harder for brute force and quantum approaches.

@Lonzak
Copy link
Contributor

Lonzak commented Aug 8, 2024

In contrast to his assumption "Maybe it is only extending R=4 with AES256", though, the R=5 algorithm is more related to R=6 than R=4.

...was just a (wild) guess ;-)

@brettrowberry
Copy link
Author

You are of course free to implement it

I'm going to keep getting PDFs with R = 5. So, either I'll have to:

  1. implement it as you suggest, or
  2. switch to PDFBox, which would be a pretty significant change to our code base.

@brettrowberry
Copy link
Author

Let's pretend that I write a perfect PR adding R = 5 support and it's merged. How long would it take to get a new version out in Maven Central?

@andreasrosdal
Copy link
Contributor

@brettrowberry please submit that perfect PR adding R = 5 support. I am sure the new version would be available within reasonable time in Maven Central. I am also seeing this Unknown encryption type R = 5 error in production, however the percentage is not very large.

@melloware
Copy link

@brettrowberry any progress on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants