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

Michele Balistreri commented on PDFBOX-2801:
--------------------------------------------

I produced a document with a similar issue. Acrobat opens it without complaint, 
but PDFBox without the patch failed on it because the length of the string is 
not a multiple of the block size. This only happens with AES of course, with 
RC4 there is no block size so no exception is thrown. If you want to analyze 
the file, only the "Author" attribute at the end of the file is corrupted (I 
deleted one byte).

The patch fixes the behavior and makes it like Acrobat and Preview from OS X 
(since Preview does not support the XML-based version of the metadata, it shows 
garbage in the Author field, as it should be, Acrobat apparently reads the XML 
instead).

> SecurityHandler does not tolerate plain-text COSString
> ------------------------------------------------------
>
>                 Key: PDFBOX-2801
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2801
>             Project: PDFBox
>          Issue Type: Bug
>          Components: PDModel
>    Affects Versions: 2.0.0
>            Reporter: Michele Balistreri
>         Attachments: AES_fullencryption_corrupted.pdf, 
> SecurityHandler-tolerant-decrypt.diff
>
>
> SecurityHandler does not handle the possibility, that a COSString is already 
> plain text if the document is encrypted. This patch makes it tolerant when 
> decrypting COSString, so that if it fails it just logs that and keeps the 
> original content. The code works with all files I have.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to