I am trying to learn to use Apache\'s pdfBox to deal with digitaly signed documents for work. During testing, I created a completely empty pdf document.
I then signe
The problem is that using PDDocument.save() creates a new document and thus invalidates the signature.
Using PDDocument.saveIncremental(...) does not invalidate the signature, however it will not update any changes to the document (such as annotations or form filling), it is only used to save a signature.
Updating a signed PDF document with annotations or form filling is not yet possible with PDFBox 2.0 but should be possible once PDFBox 2.1 rolls out.
Information on the problem : here and here
Using IText's PDFStamper however solve the problem of adding annotations to a signed document without invalidating the signature as answered here.
From what I can gather from some of Adobe's documentation, there is a timestamp which is included as part of the signature. I would guess by saving the document (even without any content changes) would modify this timestamp value, hence invalidating the signature (which would have been created using the original timestamp).
This isn't an authoritative, mind you - this is just what I've been able glean from a quick glance at Adobe's documentation on the matter.