You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (Jira)" <ji...@apache.org> on 2020/12/30 11:35:00 UTC

[jira] [Commented] (PDFBOX-5062) IllegalBlockSizeException when loading the file

    [ https://issues.apache.org/jira/browse/PDFBOX-5062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17256474#comment-17256474 ] 

Tilman Hausherr commented on PDFBOX-5062:
-----------------------------------------

Your PDF is corrupted or malformed.

The log output shows a warning before the exception:
{noformat}
 Warning  [COSParser] The end of the stream doesn't point to the correct offset, using workaround to read the stream, stream start position: 125739, length: 7088, expected end position: 132827
 Error  [SecurityHandler] IOException thrown when decrypting object 2 0 obj
{noformat}
The second line is new, it's just for clarification of the exception you already know. However it allows to tell that it happens in the _same_ stream that has the bad length. You can use an editor like NOTEPAD++ to see what's at these offsets.

> IllegalBlockSizeException when loading the file
> -----------------------------------------------
>
>                 Key: PDFBOX-5062
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5062
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Crypto, PDModel
>    Affects Versions: 2.0.22
>            Reporter: Zubair Uddin Farooqui
>            Priority: Major
>         Attachments: Medical services-1 (dup-keywords) (1).pdf
>
>
> Getting _IllegalBlockSizeException_ when loading the fileĀ 
> *Code:*
> {code:java}
> PDDocument pdDoc = PDDocument.load(file);{code}
> *Exception:*
> {code:java}
> java.io.IOException: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 16 when decrypting with padded cipherjava.io.IOException: javax.crypto.IllegalBlockSizeException: Input length must be multiple of 16 when decrypting with padded cipher at org.apache.pdfbox.pdmodel.encryption.SecurityHandler.encryptDataAESother(SecurityHandler.java:315) at org.apache.pdfbox.pdmodel.encryption.SecurityHandler.encryptData(SecurityHandler.java:201) at org.apache.pdfbox.pdmodel.encryption.SecurityHandler.decryptStream(SecurityHandler.java:510) at org.apache.pdfbox.pdfparser.COSParser.parseFileObject(COSParser.java:929) at org.apache.pdfbox.pdfparser.COSParser.parseObjectDynamically(COSParser.java:886) at org.apache.pdfbox.pdfparser.COSParser.parseObjectDynamically(COSParser.java:806) at org.apache.pdfbox.pdfparser.COSParser.parseDictObjects(COSParser.java:766) at org.apache.pdfbox.pdfparser.PDFParser.initialParse(PDFParser.java:187) at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:226) at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1099) at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1082) at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1041) at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:989)
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org