Return-Path: X-Original-To: apmail-pdfbox-users-archive@www.apache.org Delivered-To: apmail-pdfbox-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1392E10A66 for ; Sat, 10 Jan 2015 15:09:44 +0000 (UTC) Received: (qmail 6974 invoked by uid 500); 10 Jan 2015 15:09:45 -0000 Delivered-To: apmail-pdfbox-users-archive@pdfbox.apache.org Received: (qmail 6947 invoked by uid 500); 10 Jan 2015 15:09:45 -0000 Mailing-List: contact users-help@pdfbox.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@pdfbox.apache.org Delivered-To: mailing list users@pdfbox.apache.org Received: (qmail 6936 invoked by uid 99); 10 Jan 2015 15:09:44 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 10 Jan 2015 15:09:44 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [194.25.134.20] (HELO mailout08.t-online.de) (194.25.134.20) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 10 Jan 2015 15:09:17 +0000 Received: from fwd15.aul.t-online.de (fwd15.aul.t-online.de [172.20.27.63]) by mailout08.t-online.de (Postfix) with SMTP id 659E356E53F for ; Sat, 10 Jan 2015 16:09:15 +0100 (CET) Received: from [192.168.2.102] (Gv65ivZUQhpz-iPFQBVXTZYNZwrKZpfYQFMJn9x8ZgKxgkIy1vCN77QlYtd9EGkwVw@[217.231.150.144]) by fwd15.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-SHA encrypted) esmtp id 1Y9xf8-3pPFui0; Sat, 10 Jan 2015 16:09:14 +0100 Message-ID: <54B140FC.2060309@t-online.de> Date: Sat, 10 Jan 2015 16:10:52 +0100 From: Tilman Hausherr User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: users@pdfbox.apache.org Subject: Re: Problem while decrypting a pdf file in Linux References: In-Reply-To: Content-Type: multipart/alternative; boundary="------------070801050704060201000303" X-ID: Gv65ivZUQhpz-iPFQBVXTZYNZwrKZpfYQFMJn9x8ZgKxgkIy1vCN77QlYtd9EGkwVw X-TOI-MSGID: 30f9b594-073d-46da-8534-459046a277b0 X-Virus-Checked: Checked by ClamAV on apache.org --------------070801050704060201000303 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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 --------------070801050704060201000303--