pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Evert-Jan de Bruin <evert-jan.de.br...@caci.nl>
Subject Signed PDF with non-encrypted headers causes issue in PDFBox 2.0.9
Date Tue, 24 Apr 2018 10:48:14 GMT
Hello,

For my project I have to merge PDF files together. This usually works fine, but it does not
always work with digitally signed PDF files.

Simply a load() of the document will already fail with InvalidBlockSizeException. Here is
an example document: https://ufile.io/mgshz

I went into the PDFBox code, and the issue seems to be that it detects AES encryption in the
PDF due to the digital signature, but then assumes everything is encrypted and needs to be
decrypted. However, the headers are *not* encrypted so decryption fails.

I can get it all to work by going to PDFParser.java and disabling these three lines in prepareDecryption():

//                securityHandler = encryption.getSecurityHandler();
//                securityHandler.prepareForDecryption(encryption, document.getDocumentID(),
//                        decryptionMaterial);
//                accessPermission = securityHandler.getCurrentAccessPermission();

However, this is of course very ugly as decryption is now totally disabled. I also get warnings
about offset issues but the end result seems fine.

Is there a more elegant solution or is this really a bug?

It seems to be a repetition of https://issues.apache.org/jira/browse/PDFBOX-3229 but this
should have been fixed in 2.0.0, however, it still occurs in 2.0.9

Regards,

Evert-Jan de Bruin

[K00716_Osiris_MailSignature-logo]

CACI bv
www.osiris-ho.nl<http://www.osiris-ho.nl/>

De Ruyterkade 7
1013 AA Amsterdam

088 - 654 3594
evert-jan.de.bruin@caci.nl<mailto:evert-jan.de.bruin@caci.nl>


This electronic message contains information from CACI BV, which may be confidential, proprietary,
privileged or otherwise protected from disclosure. The information is intended to be used
solely by the recipient(s) named above. If you are not an intended recipient, be aware that
any review, disclosure, copying, distribution or use of this transmission or its contents
is prohibited.
If you have received this transmission in error, please notify the sender immediately and
delete all copies of this message.


Mime
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message