Hi,
Please try PDDocument.loadNonSeq instead of load. It should then work
with 1.8.8.
If it still doesn't work, please open an issue in JIRA, but read this to
create a good bug report:
https://pdfbox.apache.org/support.html
Tilman
Am 09.01.2015 um 09:55 schrieb Barry Zhao [Zhao]:
Hi team,
I use PDFBox V1.8.7.
In Windows, it can work well.
When I run my code in Linux, I got the exception below:
java.io.IOException: javax.crypto.IllegalBlockSizeException: Input
length must be multiple of 16 when decrypting with padded cipher
at javax.crypto.CipherInputStream.getMoreData(CipherInputStream.java:115)
at javax.crypto.CipherInputStream.read(CipherInputStream.java:233)
at javax.crypto.CipherInputStream.read(CipherInputStream.java:209)
at
org.apache.pdfbox.pdmodel.encryption.SecurityHandler.encryptData(SecurityHandler.java:316)
at
org.apache.pdfbox.pdmodel.encryption.SecurityHandler.decryptString(SecurityHandler.java:486)
at
org.apache.pdfbox.pdmodel.encryption.SecurityHandler.decrypt(SecurityHandler.java:386)
at
org.apache.pdfbox.pdmodel.encryption.SecurityHandler.decryptDictionary(SecurityHandler.java:466)
at
org.apache.pdfbox.pdmodel.encryption.SecurityHandler.decrypt(SecurityHandler.java:394)
at
org.apache.pdfbox.pdmodel.encryption.SecurityHandler.decryptObject(SecurityHandler.java:365)
at
org.apache.pdfbox.pdmodel.encryption.SecurityHandler.proceedDecryption(SecurityHandler.java:196)
at
org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.decryptDocument(StandardSecurityHandler.java:158)
at
org.apache.pdfbox.pdmodel.PDDocument.openProtection(PDDocument.java:1595)
at org.apache.pdfbox.pdmodel.PDDocument.decrypt(PDDocument.java:942)
.....etc.
Caused by: javax.crypto.IllegalBlockSizeException: Input length must
be multiple of 16 when decrypting with padded cipher
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:750)
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:676)
at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:313)
at javax.crypto.Cipher.doFinal(Cipher.java:1970)
at javax.crypto.CipherInputStream.getMoreData(CipherInputStream.java:112)
And my code is :
PDDocument doc = PDDocument.load(originFile);
if (doc.isEncrypted())
{
try
{
DecryptionMaterial dm = new StandardDecryptionMaterial("");
doc.openProtection(dm);
doc.setAllSecurityToBeRemoved(true);
}
catch (Exception cre) {
cre.printStackTrace();
}
}
And my jre version is 1.7.
I use the attachment file to do the operation.
Please help me to figure out the problem or do you guys have
workarounds for this?
Many thanks.
Best wishes,
Barry