The aim of this example is to verify the document signature that was produced using the PDF Signature Generation example. To understand this example, we recommend that you first understand the CMS/PKCS#7 Signature Verification example.

To try this example you must download the file, sampleAxis13.zip, and follow the instructions in Configuration of the Environment.

The downloaded file contains a signed PDF document, but if you wish you can replace it with the document generated in the PDF Signature Generation example to check the validity of the signature.

 

This example is very similar to the CMS/PKCS#7 Signature Verification example; however, in this case we are verifying a PDF signature.

VerifyRequest vr = new VerifyRequest();
vr.setProfile(new URI(PROF_VERIFY_PDF));

To verify a PDF signature, we simply enter the PDF document because it already contains a signature. Therefore, we create a Document object and enter the data encoded in Base64

InputDocuments idoc = new InputDocuments();
Document doc = new Document();
Base64Data b64data = new Base64Data();
b64data.set_value(Util.readBinaryFile(path_in + signname));
b64data.setMimeType("application/pdf");
doc.setBase64Data(b64data);
idoc.setDocument(doc);
vr.setInputDocuments(idoc);

To send the request we invoke the verify() method.

VerifyResponse vrs = bindingDsv.verify(vr)

Once the example has been executed, we receive a summary with the result of the verification.

** RESPONSE **
---------------------
Major: urn:oasis:names:tc:dss:1.0:resultmajor:Success
Minor: urn:oasis:names:tc:dss:1.0:resultminor:ValidSignature_OnAllDocuments
DN: CN=Dave, OU=Demo, O=TrustedX, C=ES
Issuer Trust Level: 0
Issuer Trust Label: Administration