0

I'm having an issue with iTextSharp. I have a document with form fields and I have fields already generated for signatures. When the first person signs the document it works fine. Adobe Reader shows a valid signature. When I have a second person sign the document, Adobe Reader shows that signature 1 is now "Signed by Unknown" and the signature is invalid. Adobe reader shows:

There are errors in the formatting or information contained in this signature (support information: SigDict /Contents illegal data)

The project works to perform the signing as far as iTextSharp is concerned. There are no errors or exceptions. documents with only 1 signature are not an issue. The signing code is all based on the Answer's cut-down code from this article: ITextSharp SetVisibleSignature not working as expected

The most up-to-date version of iTextSharp I can use is 5.5.6. 5.5.7 has a bug referenced by the linked article. I have tried downgrading this project to 5.5.5, 5.5.4 and 5.4.2 and I'm getting the same results. Does anyone have any suggestions on how to troubleshoot why Adobe Reader is considering the Rev. 1 signature to be invalid after the Rev. 2 signature is applied?

Community
  • 1
  • 1
gilm0079
  • 595
  • 1
  • 4
  • 18
  • Are you creating the second, third, etc. signatures in append mode? Not doing so will invalidate earlier signatures. – mkl Oct 21 '15 at 17:13
  • 1
    The final `true` in `PdfStamper.CreateSignature(reader, outputStream, '\0', null, true);` in the answer you reference is important. – mkl Oct 21 '15 at 17:16
  • Yes, it is in append mode. – gilm0079 Oct 21 '15 at 22:31
  • In that case please share a result PDF with 2 signatures fur analysis. – mkl Oct 22 '15 at 04:06
  • @mkl, but why would it create illegal data if you don't do it in append mode? invalidating the signature makes sense, but corrupting it doesn't. – NH. Oct 17 '17 at 21:11
  • The op refrained from sharing his data, so an analysis currently is not possible. – mkl Oct 17 '17 at 21:47

1 Answers1

0

Good thing you asked. I started going through the code to mock up a sample without any sensitive data and stumbled upon a stamper that was injecting form field data and not using append mode. That is what was trashing it. My bad. FYI, the sample signing code from the linked article works great.

gilm0079
  • 595
  • 1
  • 4
  • 18