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

Tilman Hausherr edited comment on PDFBOX-2729 at 1/7/16 7:50 PM:
-----------------------------------------------------------------

This almost enables AES128 encryption, only the //TODO line must be implemented 
so that it works by default. I've tested it with TestSymmetricKeyEncryption and 
it passes, and the files are really encrypted with AES128 and this is confirmed 
by Adobe Reader.

Gleb, your solution has the problem that it reads and saves the file first, so 
it is no longer the same before signing. Another problem is that we must 
encrypt with the same method than initially done, which is why I implemented 
AES128 too. A third problem will happen with AES256: this one has a random 
component. We must find a way to keep the encryption key after loading the 
file. Currently it is lost due to the SecurityHandler object being created a 
second time for saving, -I haven't fully understood that part yet.-


was (Author: tilman):
This almost enables AES128 encryption, only the //TODO line must be implemented 
so that it works by default. I've tested it with TestSymmetricKeyEncryption and 
it passes, and the files are really encrypted with AES128 and this is confirmed 
by Adobe Reader.

Gleb, your solution has the problem that it reads and saves the file first, so 
it is no longer the same before signing. Another problem is that we must 
encrypt with the same method than initially done, which is why I implemented 
AES128 too. A third problem will happen with AES256: this one has a random 
component. We must find a way to keep the encryption key after loading the 
file. Currently it is lost due to the SecurityHandler object being created a 
second time for saving, I haven't fully understood that part yet.

> Can't sign encrypted PDF files
> ------------------------------
>
>                 Key: PDFBOX-2729
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2729
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Signing
>    Affects Versions: 2.0.0
>            Reporter: Cyril Bremaud
>            Assignee: Andreas Lehmkühler
>         Attachments: Scan0001.pdf, Scan0001_protected.pdf, 
> Scan0001_protected_signed.pdf, Simple-128-bit-encrypted_signed.pdf, 
> Simple-256-bit-encrypted_signed.pdf, Simple-40-bit-encrypted_signed.pdf
>
>
> It is not possible to sign an encrypted PDF document.
> More details here :
> [http://stackoverflow.com/questions/29232684/signing-an-encrypted-pdf-document-with-pdfbox-2-0-0]



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to