9.10.  Extract Signature Information to XML

Signatures and certificates containe a huge amount of data. Only some of them are testable with direct tests. But all of the data can be evaluated using XPath. Section 3.23: “Signatures and Certificates” describes tests with signatures and certificates.

The following script will start the extraction:

Program Start

::
:: Extract infos about signatures and certificates of a PDF document as XMLe
::

@echo off
setlocal
set CLASSPATH=./lib/pdfunit-2015.10/*;%CLASSPATH%
set CLASSPATH=./lib/itext-5.5.1/*;%CLASSPATH%
set CLASSPATH=./lib/bouncycastle-jdk15on-150/*;%CLASSPATH%

set TOOL=com.pdfunit.tools.ExtractSignaturesInfo
set OUT_DIR=./tmp
set IN_FILE=signed/helloWorld_sign.pdf
set PASSWD=

java  %TOOL%  %IN_FILE%  %OUT_DIR%  %PASSWD%
endlocal

Input

Adobe Reader® shows the signature data for helloWorld_sign.pdf:

Output

Here is a snippet of the output file _signatureinfo_helloWorld_sign.out.xml:

The tests for signatures and certificates are still under development (release 2015.10). This may lead to changes in the XML structure.