pdfBox - Signature validity checkmark not visible in Acrobat reader

I am adding a visual signature to a pdf using this as reference - https://stackoverflow.com/a/27940667/7103795

I am able to print the details properly. But the pdf does not display a green tick when opened in Acrobat though it is written "Signed and all signatures are valid." in the signature panel.

This is an example of what I need:

Screenshot

How can I ensure that the validity sign show up?

I am using pdfBox version 2.0.1


In-document visualisations of the signature validity have been deprecated nearly a decade ago. Adobe Reader supports them for backward compatibility reasons only but they have never been part of the iso pdf specification.

The OP in a comment asked for documentation on this; this answer focuses on that.


Deprecation in respect to Adobe Acrobat

In Adobe Acrobat version 6 Adobe moved away from creating PDFs with in-document signature validity visualizations provided by the PDF itself, cf. Digital Signature Appearances page 8:

excerpt page 8

The validity was still shown in the signature visualization in the document but the graphics for visualizing the state were now generated by Adobe Acrobat itself. Only for compatibility old documents with their own validity appearances continued to be displayed using those custom appearances.

In Adobe Acrobat version 9 Adobe eventually moved away from using in-document signature validity visualizations, cf. Adobe Acrobat 9 Digital Signatures, Changes and Improvements page 10:

excerpt page 10

Thus, since Acrobat 9 Adobe displays its own icons only in the signature panel, not the document itself, and requires evaluation of signature validity by business users by inspecting the signature panel and generates signatures accordingly.

Only for compatibility reasons old documents with their own validity appearances still continued to be displayed using those custom appearances inside the document area.

Deprecation in respect to ISO 32000-1

The official PDF specification ISO 32000-1 dated July 1st 2008 does not specify any means by which a PDF can provide visualizations for signature validities. Have a look at the copy of ISO 32000-1 shared by Adobe, there is no mentioning of those "layers" n1, n3, and n4 anymore. Actually no such layers are mentioned at all, the ISO norm expects a usual single appearance stream without variants.

Deprecation in respect to PAdES

PAdES part 6 (ETSI TS 102 778-6 V1.1.1 on the "Visual Representations of Electronic Signatures") eventually requires

A conforming signature handler shall not display the result of the signature validation inside the page content.

(section 6 - The visual representation of AdES signature verification)

Thus, by adding those "layers" n1, n3, and n4 to a signature in a PDF, you force Adobe Reader to act as a not PAdES-conforming signature handler which might be a show stopper depending on your specific security environment.

... and according to ISO 32000-2:2017: Forbiddance

According to the updated PDF specification ISO 32000-2, in-document visualisations of the signature validity even are forbidden:

A PDF processor shall not incorporate the validation status of a signature (e.g. a checkmark for passed or an X for failed) into the appearance of the signature field.

(ISO 32000-2 section 12.7.5.5 — Signature fields)