Closed C-monC closed 1 year ago
Hi @C-monC,
I presume that by "invalidated" you mean that Acrobat/pyHanko/... judges the signature as invalid? That is expected behaviour: an incremental update will indeed not destroy the underlying signature from a cryptographic point of view (the data remains intact), but the data appended can affect the appearance of the document.
Since such alterations can also significantly change the content of the document a priori, "serious" PDF signature validation implementations will also analyse incremental changes made after a signature, and fail validation if they don't consider them reasonable.
Unlike adding a new signature (which works with form fields/annotations), applying a TextStamp
directly affects the content stream of a page. All incremental update validators that I'm aware of will invalidate prior signatures for page content changes, no questions asked.
Hope that helps.
I'll be moving this to the discussion board since it's not a bug. There might be a different way to achieve the outcome you want without breaking the PDF signature model. If you follow up with some more details about your use case, maybe we can find a more robust solution.
Hi,
My understanding of the IncrementalPdfFileWriter is that adding a stamp and then signing a document with signatures already should create a new version.
Here is code to reproduce the invalidation.
document-signed2.pdf has the first signature invalidated.