1

I want to have a pdf with two signatures and password protection, but I can not do it.

I can protect my pdf using PdfEncryptor.Encrypt() if I don't need a signature and with PdfStamper SetEncryption() if I need only one signature. However I can't do it with more than one signature because SetEncryption() doesn't work in append mode.

Some workaround?

Pac0
  • 21,465
  • 8
  • 65
  • 74
  • 1
    Obviously you cannot select a different encryption than in the original PDF when appending to it. After all, the whole idea of appending is keeping the original as is, and re-encryption would exactly not do that. – mkl Sep 28 '17 at 12:05
  • So it is impossible to have two signatures and password protection at the same time? my objective with password protection is avoid pdf editing – alvaro gonzalez Sep 28 '17 at 12:43
  • With signatures, you avoid editing in the sense of any edit will render the signature invalid. – Pac0 Sep 28 '17 at 13:03
  • *"my objective with password protection is avoid pdf editing"* - as soon as a signature is applied, very little in terms of changes is allowed anyways, cf. [this answer](https://stackoverflow.com/a/16711745/1729265). – mkl Sep 28 '17 at 13:59
  • @Pac0 *"any edit will render the signature invalid"* - This is not the case for integrated PDF signatures, at least as long as the edits are applied as incremental updates (for backgrounds cf. [this answer](https://security.stackexchange.com/a/35131/16096) on Information Security Stack Exchange). But only very few types of changes are considered allowed, cf. the answer I linked to in my previous comment. – mkl Sep 28 '17 at 14:04
  • Encryption changes the bytes of a document in a profound way to protect the content of the document. Changing the bytes of a document invalidates a signature. This doesn't mean that a document can't be encrypted and signed. It means that you **first** have to encrypt it. Once it's encrypted, you can add as many digital signatures as you want, but you can't "re-encrypt" it, once the first signature is applied. (Why would you want to "re-encrypt" an encrypted document anyway? That doesn't make much sense to me.) – Bruno Lowagie Sep 28 '17 at 15:16

0 Answers0