0
votes

I am generating digital signatures for PDF using iText 5.5.9 and the example C2_01_SignHelloWorld.java given at digital signature white paper examples.

I am getting plain digital signature appearance. What I need is a digital signature that appears with an icon that indicates its verification status like the yellow question mark in this example:

pdf signature with visible verification indicator

This yellow question mark changes to a red cross or a green tick depending on whether the signature was verified or not.

I have searched for this for the past two days and the only difference I see is that the digital certificate that I am using is self signed whereas the digital certificate used in the reference PDF is issued by a vendor who is in Adobe Approved Trust List. But before I make that purchase, I would like to know if I am missing out something obvious.

1
Such a signature would be in violation with the PAdES standard. Tell whoever asked you to implement this to read PAdES.Bruno Lowagie
The verification status is something that only the client that opens your file can finally tell, right? So that is the place where a check or a cross could be added in some way or another.Stefan Hegny
The icons appear to be part of the signature box. in other readers like preview in mac os, only the yellow question mark appears. in adobe reader dc however it displays a dialog about downloading certificates and the yellow question mark changes to a green tick.Kinjal Dixit
The use of these on-page indicators of signature validity has been deprecated a long time ago. If i recall correctly, even before pdf became an ISO standard, when it still was an adobe controlled format. Adobe Reader only supports this for backward compatibility. If you take current standards like PAdES into account, such indications inside the document are not allowed anymore. That been said, you can use / tweak itext to create such signatures but they will start out with questionable legal value.mkl

1 Answers

1
votes

To get this kind of icon to appear, set two additional properties in the PdfSignatureAppearance object.

Follow along from the Signatures.java example in Chapter 12 of the iText in Action book, and modify according to this snippet.

// appearance
PdfSignatureAppearance appearance = stamper.getSignatureAppearance();
// insert the next two lines
appearance.setAcro6Layers(false);
appearance.setLayer4Text(PdfSignatureAppearance.questionMark);

In case you are working with iTextSharp, these are properties, so you will have to do:

appearance.Acro6Layers = false;
appearance.Layer4Text = PdfSignatureAppearance.questionMark;