Hi, could you try using PDFBox 1.8.8 as this should have been addressed there [https://issues.apache.org/jira/browse/PDFBOX-2522]
BR Maruan Sahyoun Am 09.01.2015 um 09:55 schrieb Barry Zhao [Zhao] <[email protected]>: > 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

