pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bogdan Daniliuc <bdanil...@montran.com>
Subject Trying to both sign and encrypt PDF with PDFBox 1.8.8
Date Fri, 13 Feb 2015 14:30:07 GMT

I'm having an use case where a PDF document has to be both signed and 
encrypted, with only some access permissions allowed. I was unable to 
find an example.

Either operation works separately. Starting with a simple PDF a valid 
signed one or a valid encrypted one can be obtained. However executing 
both operations on the same file fails.

When trying to do a signed/encrypted file the the procedure I use is:
- read the original PDF file doc (has no security)
- create AccessPermission with restricted permissions
- create StandardProtectionPolicy with password encryption and the above 
- call doc.protect with the above policy
- create PDSignature with visual component
- call doc.addSignature
at this point:
- calling doc.saveIncremental results in document with digital 
signature, encryption and correct access permissions but no visible text
- calling doc.save results in a document with encryption, correct 
permissions and visible text, but the digital signature is invalid.

What are the steps that I should follow? If it is correct, do you need 
any example files?

Thank you,



This message and any attachments (the "message") is intended solely for the addressees and
is confidential. If you receive this message in error, please delete it and immediately notify
the sender. Any use not in accordance with its purpose, any dissemination or disclosure, either
whole or partial, is prohibited except with formal written approval. The sender cannot guarantee
the integrity of this message. Montran Corporation (and its subsidiaries) shall not therefore
be liable for the message if modified.

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

View raw message