1

I'm trying to add two different signatures (with two different certificates, obviously) in a PDF document, using PDFBox. Started with the code provided in this answer but whenever I add the second signature, it invalidates the first one.

I managed to do this easily with iText, as PdfStamper has the possibility to append extra elements, but I cannot use iText for this project, due to its new license.

Can anyone point me in the right direction? And if not, is there any other open source library that has the signing functionality?

Thanks!

EDIT: My problem isn't that I can't add the second signature, it's that the first one becomes invalid once the second one is applied.

Created a method for the second signature and I currently sign my document like this:

PDFSigner signer = new PDFSigner(input, output);
signer.sign(keystore1, password1);
signer.signR(keystore2, password2);
signer.document.saveIncremental(.....);

Community
  • 1
  • 1
v30
  • 41
  • 5
  • The code that answer refers to actually tries to use append mode (using `doc.saveIncremental(fis, fos);`); have you changed that code? Or is that feature broken in PDFBox? – mkl Feb 20 '13 at 16:04
  • As far as I've noticed (correct me if I'm wrong), the actual signing made by the `sign` function provided by the SignatureInterface (which uses the certificate) is called when the document is saved with `doc.saveIncremental(fis, fos)`. I'm able to sign the document twice using the same certificate, but I need to use two different ones. – v30 Feb 20 '13 at 20:12

0 Answers0