0

I am trying to add LTV in the digitally signed document. On some files, it's working fine but in some files, it's not working. I am attaching all the documents for reference.

My LTV add code link is given bellow https://github.com/akr/pdftimestamp

Success input and output file link is given bellow inputFile:- https://verdantistech-my.sharepoint.com/:b:/g/personal/rabin_samanta_ultria_com/EYn2S0SqxPBJi1f6qDPGBG0BPUj1uLkqj5aoerJOnIGlYg?e=1fqoZP outputFile:- https://verdantistech-my.sharepoint.com/:b:/g/personal/rabin_samanta_ultria_com/EeHWotTg511Kg6Hz_JeTjnUB4-8ya7lcWyxhhgtvy1OkHQ?e=CYnX1r

Failed input and output file link is given bellow inputFile:- https://verdantistech-my.sharepoint.com/:b:/g/personal/rabin_samanta_ultria_com/Ecw0TtX8YzlPjZJT6OGJarYBx1yFBm2h1PvOSKPaKK1fuA?e=EC7Xsr outputFile:- https://verdantistech-my.sharepoint.com/:b:/g/personal/rabin_samanta_ultria_com/ETf9smc-pkFPggRMXi1I1WsBJ6OZOzOj9lmvXPD25tgWiw?e=j24Ipe

Please help me on this why in some file the signature got corrupted using the same code.

Rabin
  • 5
  • 3

1 Answers1

1

The cause is that already the source PDF and consequentially the first revision of your signed and extended file is broken!

The source PDF has only a single revision and its cross reference table looks like this:

xref
0 118
0000000000 65535 f
0000000018 00000 n
...
0000304213 00000 n
119 64
0000304499 00000 n
...
0000316209 00000 n
185 5
0000316253 00000 n
...
0000316837 00000 n
192 1
0000316969 00000 n
194 8
0000317581 00000 n
...
0000342232 00000 n

(The signed and extended version of the PDF has a similar looking cross reference table of its first revision.)

As you see it consists of multiple sections and has gaps (e.g. there is no entry for object 118).

This is invalid:

For a file that has never been incrementally updated, the cross-reference section shall contain only one subsection, whose object numbering begins at 0.

(ISO 32000-1 and ISO 32000-2, in both cases section 7.5.4 "Cross-Reference Table")

Usually this goes unnoticed, Adobe Acrobat is usually quite lax when encountering small issues invalidating PDFs.

Usually, that is, except when validating documents with integrated signatures and incremental updates after the signed revision, in that situation Adobe Acrobat often considers such issues suspect and fails validation of the signature, even though it doesn't complain when validating the same PDF without the incremental updates after the signed revision.

Your example PDF according to its Info dictionary has been produced by Aspose.Pdf for Java 16.10.0. Indeed, Aspose PDF components have been known to create such invalid first cross reference tables, see this answer and the PDF/A-1 conversion creates invalid XRef table thread on the Aspose free support forum.

iText 7 also generated similarly broken cross reference tables in its early 7.0.x versions, see this answer.

mkl
  • 90,588
  • 15
  • 125
  • 265
  • except when validating documents with integrated signatures and incremental updates after the signed revision -> Is there any way to add the digital signature and LTV in same call without incremental updates document? else how i can solve my issue? – Rabin May 21 '21 at 17:25
  • *"how i can solve my issue?"* - you could reject broken PDFs. Or you could repair them. Repair of course only is possible in PDFs without previous signatures. (Simply *adding the digital signature and LTV in same call without incremental updates* would merely shift the problem to the next service to process that PDF, e.g. to timestamp it again later.) – mkl May 21 '21 at 17:35
  • I could not reject the pdf. The same pdf I upload to the DocuSign platform but they are able to process the pdf without rejection. – Rabin May 21 '21 at 18:24
  • Then they repair it. Adobe Acrobat also repairs it. Nonetheless, you should beware and be ready to reject some broken pdfs. Otherwise the signed document might say something else than intended by the user. – mkl May 21 '21 at 18:25