9.10.  Extract Signature Information to XML

Signatures contain a huge amount of data. Some of them reachable by PDFUnit tests. Section 3.28: “Signed PDF” describes tests with signatures.

The following script will start the extraction:

Program Start

::
:: Extract infos about signatures of a PDF document as XML:
::

@echo off
setlocal
set CLASSPATH=./lib/aspectj-1.8.7/*;%CLASSPATH%
set CLASSPATH=./lib/bouncycastle-jdk15on-153/*;%CLASSPATH%
set CLASSPATH=./lib/commons-logging-1.2/*;%CLASSPATH%
set CLASSPATH=./lib/pdfbox-2.0.0/*;%CLASSPATH%
set CLASSPATH=./lib/pdfunit-2016.05/*;%CLASSPATH%

set TOOL=com.pdfunit.tools.ExtractSignatureInfo
set OUT_DIR=./tmp
set IN_FILE=signed/helloWorld_signed.pdf
set PASSWD=

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

Input

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

Output

Here is the output file _signatureinfo_helloWorld_signed.out.xml:

<?xml version="1.0" encoding="UTF-8" ?>
<signatures>
  <signature fieldname="sign_rbl" 
             signatory="Raymond Berthou" 
             signingdate="2007-10-14T09:09:12"
             reason="Test SignPDF berthou.mc" 
             signed="true" 
             covers.whole.document="true" 
  />
</signatures>

PFUnit will provide more features to test signatures in future releases. This may lead to changes in the XML structure. In case of a problem, please look to an actual user manual.