Michael Chourdakis
Michael Chourdakis

Reputation: 11148

PDF sign and resign is not recognized when the signatures are visible

The idea is to be able to sign a PDF file multiple times with my own PDF parser.

Reference files: here.

When the signature isn't going to be visible, all work ok. I sign 1.pdf once (2.pdf) and then twice (3.pdf), Adobe Acrobat recognizes the signature.

The problem arises when the signature should be visible. The first signing works correctly (2.pdf). However the second (3.pdf) fails, Acrobat says the first signature is invalidated and the second is not recognized.

As far as I can tell, the only difference between visible and invisible is the adding of the text object. Why adobe invalidates the first signature and why the second isn't recognized?

28 0 obj
<</BaseFont/Helvetica/Type/Font/Subtype/Type1/Encoding/WinAnsiEncoding/Name/Helv>>
endobj
29 0 obj
<</BaseFont/ZapfDingbats/Type/Font/Subtype/Type1/Name/ZaDb>>
endobj
31 0 obj<</Font 32 0 R>>
endobj
32 0 obj<</FAdESFont2 33 0 R>>
endobj
33 0 obj<</Type /Font /Subtype /Type1 /BaseFont /Helvetica>>
endobj
34 0 obj
<</Length 90>>stream
BT
6 760 TD
/FAdESFont2 6 Tf
([email protected] MICHAIL CHOURDAKIS 1/23/2023 17:24:10) Tj
ET

endstream
endobj
26 0 obj
<</Type/XObject/Resources<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]>>/Subtype/Form/BBox[0 0 0 0]/Matrix [1 0 0 1 0 0]/Length 8/FormType 1/Filter/FlateDecode>>stream
xœ    
endstream
endobj
3 0 obj
<</Contents[34 0 R 24 0 R 12 0 R]/CropBox[0.0 0.0 612.0 792.0]/MediaBox[0.0 0.0 612.0 792.0]/Parent 2 0 R/Resources 13 0 R/Rotate 0/Type/Page/Annots[17 0 R 27 0 R]>>
endobj
2 0 obj
<</Count 1/Kids[3 0 R]/Type/Pages>>
endobj
1 0 obj
<</AcroForm<</Fields[17 0 R 27 0 R]/DR<</Font<</Helv 28 0 R/ZaDb 29 0 R>>>>/DA(/Helv 0 Tf 0 g )/SigFlags 3>>/AcroForm<</Fields[17 0 R]/DR<</Font<</Helv 18 0 R/ZaDb 19 0 R>>>>/DA(/Helv 0 Tf 0 g )/SigFlags 3>>/Pages 2 0 R/Type/Catalog>>
endobj
14 0 obj
<</Producer(AdES Tools https://www.turboirc.com)/ModDate(D:20230123152410+00'00')>>
endobj
xref

Upvotes: 0

Views: 95

Answers (1)

mkl
mkl

Reputation: 95888

Why adobe invalidates the first signature and why the second isn't recognized?

Because you add the visualizations of the signatures in an inappropriate way.

You add visualizations of the signatures by adding to the static page content (the page content streams). This is the wrong approach if you want to be able to add signatures to already signed PDFs, because manipulation of the static page content after signing is a forbidden change, see this answer.

The appropriate way to add visualizations of PDF signatures is by adding an appearance stream to the respective signature field widget.

For details you may want to study the PDF specification ISO 32000.

Upvotes: 1

Related Questions