net.aocat.psis.client.samples.verify.pdf
Class PdfValidationSample

java.lang.Object
  extended by net.aocat.psis.client.base.AbstractSample
      extended by net.aocat.psis.client.samples.verify.pdf.PdfValidationSample

public class PdfValidationSample
extends AbstractSample

Java code sample for signed PDF validation and update.

Author:
aalcaide

Field Summary
private static java.lang.String MIME_TYPE_APPLICATION_PDF
           
private  java.lang.String OUT_DIR
           
private  boolean PRINT_REQUEST
           
private  boolean PRINT_RESPONSE
           
private  boolean SAVE_REQUEST_AND_RESPONSE
           
private  boolean SAVE_UPDATED_PDF
           
private  java.lang.String VERIFY_REQUEST
           
private  java.lang.String VERIFY_RESPONSE
           
 
Fields inherited from class net.aocat.psis.client.base.AbstractSample
factory, log
 
Constructor Summary
PdfValidationSample()
           
 
Method Summary
private  void extractUpdatedPDFfromVerifyResponse(x0CoreSchema.oasisNamesTcDss1.VerifyResponseDocument verifyResponse, java.io.File pdf)
          Extracts updated PDF from PSIS response.
static void main(java.lang.String[] args)
           
 void verifyPdf(java.io.File pdf)
          Verifies a signed PDF, and updates it to LTV.
 
Methods inherited from class net.aocat.psis.client.base.AbstractSample
isResultWellFormed, isResultWellFormed, printSaveRequest, printSaveRequest, printSaveResponse, printSaveResponse, showResult
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIME_TYPE_APPLICATION_PDF

private static final java.lang.String MIME_TYPE_APPLICATION_PDF
See Also:
Constant Field Values

PRINT_REQUEST

private boolean PRINT_REQUEST

PRINT_RESPONSE

private boolean PRINT_RESPONSE

OUT_DIR

private java.lang.String OUT_DIR

SAVE_REQUEST_AND_RESPONSE

private boolean SAVE_REQUEST_AND_RESPONSE

VERIFY_REQUEST

private java.lang.String VERIFY_REQUEST

VERIFY_RESPONSE

private java.lang.String VERIFY_RESPONSE

SAVE_UPDATED_PDF

private boolean SAVE_UPDATED_PDF
Constructor Detail

PdfValidationSample

public PdfValidationSample()
Method Detail

main

public static void main(java.lang.String[] args)
Parameters:
args -

verifyPdf

public void verifyPdf(java.io.File pdf)
               throws java.io.IOException,
                      java.text.ParseException
Verifies a signed PDF, and updates it to LTV. Prints and/or saves request and response. Prints signature/s attribute/s. Saves updated PDF to disk.

Parameters:
pdf - signed PDF to validate and update
Throws:
java.io.IOException
java.text.ParseException

extractUpdatedPDFfromVerifyResponse

private void extractUpdatedPDFfromVerifyResponse(x0CoreSchema.oasisNamesTcDss1.VerifyResponseDocument verifyResponse,
                                                 java.io.File pdf)
                                          throws java.io.IOException
Extracts updated PDF from PSIS response.

Parameters:
verifyResponse - PSIS verify response
pdf - original PDF (updated one is saved in the same place than original one with the "_updated.xml" suffix)
Throws:
java.io.IOException