pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: Input length must be multiple of 16 when decrypting with padded cipher
Date Wed, 10 Feb 2016 22:04:11 GMT
No, I can't think of one, only a code change...

One might change the code of SecurityHandler.decryptStream(), to 
identify meta streams that are not encrypted (they start with 
"<?xpacket"), or to catch the exception that you got. I'll test this 
tomorrow. In the meantime, please open an issue in JIRA
https://issues.apache.org/jira/browse/PDFBOX

Tilman

Am 10.02.2016 um 20:05 schrieb Brzrk One:
> Is there a workaround?
>
> On Wed, Feb 10, 2016 at 1:17 PM, Tilman Hausherr <THausherr@t-online.de>
> wrote:
>
>> Your file is incorrect: it is encrypted, the META data is unencrypted, but
>> EncryptMetadata is not set to false.
>>
>> Tilman
>>
>>
>> Am 10.02.2016 um 18:36 schrieb Brzrk One:
>>
>>> Hi there!
>>> Using pdfbox-1.8.9, pdfbox-1.8.11, and pdfbox-2.0.0-RC3, I get the
>>> error/trace shown below for the PDF at this web address. Same error using
>>> PDFDebugger or Decrypt, or any other command-line too. Same error in my
>>> code, using either the bottom-up or top-down parser.
>>>
>>> Curiously, pdfbox-1.8.3 does not complain. (Not that I will use 1.8.3...)
>>>
>>> Is this a known bug?
>>> Tnx, Pat
>>>
>>> URL:
>>>
>>> http://pharmacychain366.ru/wp-content/files_mf/1431539883%D0%9E%D1%82%D1%87%D0%B5%D1%82%D0%BD%D0%BE%D1%81%D1%82%D1%8C%D0%9C%D0%A1%D0%A4%D0%9E%D0%B8%D0%B0%D1%83%D0%B4%D0%B8%D1%82%D0%BE%D1%80%D1%81%D0%BA%D0%BE%D0%B5%D0%B7%D0%B0%D0%BA%D0%BB%D1%8E%D1%87%D0%B5%D0%BD%D0%B8%D0%B5%D0%B7%D0%B02014%D0%B3..pdf
>>>
>>> Stack trace (pdfbox-1.8.11):
>>>
>>> Feb 10, 2016 12:35:15 PM org.apache.pdfbox.pdfparser.PDFParser parse
>>>
>>> INFO: Document is encrypted
>>>
>>> PDFDebugger failed with the following exception:
>>>
>>> org.apache.pdfbox.exceptions.WrappedIOException: Input length must be
>>> multiple of 16 when decrypting with padded cipher
>>>
>>> at
>>>
>>> org.apache.pdfbox.pdmodel.encryption.SecurityHandler.encryptData(SecurityHandler.java:368)
>>>
>>> at
>>>
>>> org.apache.pdfbox.pdmodel.encryption.SecurityHandler.decryptStream(SecurityHandler.java:472)
>>>
>>> at
>>>
>>> org.apache.pdfbox.pdmodel.encryption.SecurityHandler.decrypt(SecurityHandler.java:430)
>>>
>>> at
>>>
>>> org.apache.pdfbox.pdmodel.encryption.SecurityHandler.decryptObject(SecurityHandler.java:400)
>>>
>>> at
>>>
>>> org.apache.pdfbox.pdmodel.encryption.SecurityHandler.proceedDecryption(SecurityHandler.java:218)
>>>
>>> at
>>>
>>> org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.decryptDocument(StandardSecurityHandler.java:158)
>>>
>>> at
>>> org.apache.pdfbox.pdmodel.PDDocument.openProtection(PDDocument.java:1612)
>>>
>>> at org.apache.pdfbox.pdmodel.PDDocument.decrypt(PDDocument.java:958)
>>>
>>> at org.apache.pdfbox.PDFDebugger.parseDocument(PDFDebugger.java:412)
>>>
>>> at org.apache.pdfbox.PDFDebugger.readPDFFile(PDFDebugger.java:387)
>>>
>>> at org.apache.pdfbox.PDFDebugger.main(PDFDebugger.java:375)
>>>
>>> at org.apache.pdfbox.PDFBox.main(PDFBox.java:78)
>>>
>>> Caused by: javax.crypto.IllegalBlockSizeException: Input length must be
>>> multiple of 16 when decrypting with padded cipher
>>>
>>> at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)
>>>
>>> at com.sun.crypto.provider.SunJCE_f.b(DashoA13*..)
>>>
>>> at com.sun.crypto.provider.AESCipher.engineDoFinal(DashoA13*..)
>>>
>>> at javax.crypto.Cipher.doFinal(DashoA13*..)
>>>
>>> at
>>>
>>> org.apache.pdfbox.pdmodel.encryption.SecurityHandler.encryptData(SecurityHandler.java:348)
>>>
>>> ... 11 more
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
>> For additional commands, e-mail: users-help@pdfbox.apache.org
>>
>>


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


Mime
View raw message