[jira] [Comment Edited] (PDFBOX-3889) javax.crypto.BadPaddingException: Given final block not properly padded
[ https://issues.apache.org/jira/browse/PDFBOX-3889?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16122925#comment-16122925 ] Tilman Hausherr edited comment on PDFBOX-3889 at 8/11/17 6:33 AM: -- [~lucille.wilson] has your problem been solved with the last comment I posted? was (Author: tilman): [~lucille.wilson] has your problem been solved with the last change I posted? > javax.crypto.BadPaddingException: Given final block not properly padded > --- > > Key: PDFBOX-3889 > URL: https://issues.apache.org/jira/browse/PDFBOX-3889 > Project: PDFBox > Issue Type: Bug > Components: Crypto >Affects Versions: 1.8.13 > Environment: Java 1.8. Pdfbox 1.8.13 Windows and Linux >Reporter: Lucille Wilson > Labels: security > Attachments: 14-03-1159.pdf > > Original Estimate: 24h > Remaining Estimate: 24h > > Using the attached pdf, When running the pdf through > org.apache.pdfbox.pdmodel.encryption.SecurityHandler I get > BadPaddingException. > The exception occurs when it is processing > nextObj = COSObject{3304,0} I see: nextCOSBase = > COSDictionary{(COSName{Length}:COSInt{3504}) (COSName{Subtype}:COSName{XML}) > (COSName{Type}:COSName{Metadata}) } > The problem is that SecurityHandler.proceedDecryption() runs > decryptObject(nextObj); > and then decrypt(base, objNum, genNum) and then decryptStream() > However for this object decryptStream doesn't actually decrypt anything > because the type is xml. > So when decryptStream calls encryptData() encryptData() throws the bad packet > exception. > output.write(decryptCipher.doFinal()); throws the exception because the data > buffer is all zeros. It has nothing in it. I recommend that encryption be > skipped if the data buffer has all zeros. -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Comment Edited] (PDFBOX-3889) javax.crypto.BadPaddingException: Given final block not properly padded
[ https://issues.apache.org/jira/browse/PDFBOX-3889?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16118858#comment-16118858 ] Tilman Hausherr edited comment on PDFBOX-3889 at 8/8/17 7:34 PM: - I am able to open that file with 2.0.7, or with 1.8.13 when using {{PDDocument.loadNonSeq()}}. Please try that and confirm that it works now. was (Author: tilman): I am able to open that file with 2.0.7, or with 1.8.13 when using loadNonSeq. Please try that. > javax.crypto.BadPaddingException: Given final block not properly padded > --- > > Key: PDFBOX-3889 > URL: https://issues.apache.org/jira/browse/PDFBOX-3889 > Project: PDFBox > Issue Type: Bug > Components: Crypto >Affects Versions: 1.8.13 > Environment: Java 1.8. Pdfbox 1.8.13 Windows and Linux >Reporter: Lucille Wilson > Labels: security > Attachments: 14-03-1159.pdf > > Original Estimate: 24h > Remaining Estimate: 24h > > Using the attached pdf, When running the pdf through > org.apache.pdfbox.pdmodel.encryption.SecurityHandler I get > BadPaddingException. > The exception occurs when it is processing > nextObj = COSObject{3304,0} I see: nextCOSBase = > COSDictionary{(COSName{Length}:COSInt{3504}) (COSName{Subtype}:COSName{XML}) > (COSName{Type}:COSName{Metadata}) } > The problem is that SecurityHandler.proceedDecryption() runs > decryptObject(nextObj); > and then decrypt(base, objNum, genNum) and then decryptStream() > However for this object decryptStream doesn't actually decrypt anything > because the type is xml. > So when decryptStream calls encryptData() encryptData() throws the bad packet > exception. > output.write(decryptCipher.doFinal()); throws the exception because the data > buffer is all zeros. It has nothing in it. I recommend that encryption be > skipped if the data buffer has all zeros. -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org