pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joel Hirsh <joelehi...@gmail.com>
Subject Re: Illegal Key Size error
Date Thu, 07 Jun 2018 02:30:14 GMT
Turns out that with the Security changes, the password does work in a jre,
but not in a jdk.  I'm not sure why that would be, but no need to
investigate further.

---------- Forwarded message ----------
From: Joel Hirsh <joelehirsh@gmail.com>
Date: Wed, Jun 6, 2018 at 10:13 AM
Subject: Illegal Key Size error
To: users@pdfbox.apache.org


I am getting a violation of Illegal Key size (see stack trace below) when

PDDocument.*load*(istream, password);
on a specific PDF file.

I googled the error and it appears to be due to Java security
restrictions.  So I did all the appropriate things to correct that, and
just before the call to load() I verify Security.*getProperty*("crypto.p
olicy")) and it is "unlimited".  But the error still occurs.

A sample PDF I created a password on works fine.  And the PDF with the
problem is readable in Acrobat with the password.  So it appears to
be something to do with using this password.

But I'm mystified as to what else other than "crypto policy" might be
causing this??


*java.io.IOException*: *java.security.InvalidKeyException*: Illegal key size
at org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler
at org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler
 at org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler
at org.apache.pdfbox.pdfparser.PDFParser.prepareDecryption(
at org.apache.pdfbox.pdfparser.PDFParser.initialParse(*PDFParser.java:225*)
at org.apache.pdfbox.pdfparser.PDFParser.parse(*PDFParser.java:276*)
at org.apache.pdfbox.pdmodel.PDDocument.load(*PDDocument.java:1143*)
at org.apache.pdfbox.pdmodel.PDDocument.load(*PDDocument.java:1077*)

Caused by: *java.security.InvalidKeyException*: Illegal key size
 at javax.crypto.Cipher.checkCryptoPerm(*Cipher.java:1029*)
 at javax.crypto.Cipher.implInit(*Cipher.java:795*)
 at javax.crypto.Cipher.chooseProvider(*Cipher.java:854*)
 at javax.crypto.Cipher.init(*Cipher.java:1374*)
 at javax.crypto.Cipher.init(*Cipher.java:1308*)
 at org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler

... 16 more

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message