at.knowcenter.wag.egov.egiz.framework
Class VerificationFilter

java.lang.Object
  extended by at.knowcenter.wag.egov.egiz.framework.VerificationFilter

public class VerificationFilter
extends Object

This filter transforms an arbitrary input pdf into an ordered List of SignatureHolders for verification.

The pdf document is parsed and the signature blocks (textual, binary, etc.) are extracted as verifyable SignatureHolder objects in the order they appear in the document.

Author:
wprinz

Field Summary
static byte[] EGIZ_DICT_NAME
           
static byte[] EGIZ_KZ_NAME
           
 
Constructor Summary
VerificationFilter()
          Default constructor.
 
Method Summary
protected  void checkKZ(PdfASID kz)
          Checks, if the given KZ is recognized by this application or logs a warning if it isn't.
protected  boolean containsEGIZDict(byte[] pdf, FooterParseResult block)
          Tells, if the given incremental update block contains a binary signature.
protected  PdfASID extractKZFromEGIZBlock(byte[] pdf, FooterParseResult block)
          Extracts the PDF AS ID of the egiz block.
 List extractSignaturesFromPdf(byte[] pdf)
          Extracts the List of SignatureHolders from the given PDF document.
 List extractSignaturesFromPlainText(String raw_text)
          Extracts the List of SignatureHolders from the given plain text document.
static void main(String[] args)
           
protected static void printFoundHolders(String list_caption, List found_holders, PrintStream writer)
           
static String restoreKZ(byte[] pdf, ArrayParseResult kz_apr)
          Restores the Kennzeichnung String from an Array.
protected  void unrollLinearization(List blocks)
          Removes the linearization footer from the list of update blocks.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EGIZ_DICT_NAME

public static final byte[] EGIZ_DICT_NAME

EGIZ_KZ_NAME

public static final byte[] EGIZ_KZ_NAME
Constructor Detail

VerificationFilter

public VerificationFilter()
Default constructor.

Method Detail

extractSignaturesFromPdf

public List extractSignaturesFromPdf(byte[] pdf)
                              throws PresentableException
Extracts the List of SignatureHolders from the given PDF document.

Parameters:
pdf - The PDF document.
Returns:
Returns the ordered List of SignatureHolder objects (the first signature will be at index 0) extracted from the document or an empty list, if none could be found.
Throws:
PresentableException

checkKZ

protected void checkKZ(PdfASID kz)
Checks, if the given KZ is recognized by this application or logs a warning if it isn't.

Parameters:
kz - The Kennzeichnung.

unrollLinearization

protected void unrollLinearization(List blocks)
Removes the linearization footer from the list of update blocks.

Parameters:
blocks - The list of FooterParseResult objects in \prev order.

extractSignaturesFromPlainText

public List extractSignaturesFromPlainText(String raw_text)
                                    throws PDFDocumentException,
                                           SignatureException,
                                           SignatureTypesException,
                                           NormalizeException
Extracts the List of SignatureHolders from the given plain text document.

Note that this can only extract text signatures.

Parameters:
raw_text - The plain text document.
Returns:
Returns the ordered List of SignatureHolder objects (the first signature will be at index 0) extracted from the document or an empty list, if none could be found.
Throws:
SignatureException
PDFDocumentException
SignatureTypesException
NormalizeException

containsEGIZDict

protected boolean containsEGIZDict(byte[] pdf,
                                   FooterParseResult block)
Tells, if the given incremental update block contains a binary signature.

According to definition, if a block is a binary block, it must/cannot contain other signatures than this one.

Parameters:
block - The incremental update block.
Returns:
Returns true, if this block is a binary signature block, false otherwise.

extractKZFromEGIZBlock

protected PdfASID extractKZFromEGIZBlock(byte[] pdf,
                                         FooterParseResult block)
                                  throws PDFDocumentException,
                                         InvalidIDException
Extracts the PDF AS ID of the egiz block.

Parameters:
pdf - The pdf.
block - The IU block.
Returns:
Returns the extracted PDF AS ID.
Throws:
PDFDocumentException - Forwarded exception.
InvalidIDException - Forwarded exception.

restoreKZ

public static String restoreKZ(byte[] pdf,
                               ArrayParseResult kz_apr)
                        throws PDFDocumentException
Restores the Kennzeichnung String from an Array.

Parameters:
pdf - The PDF.
kz_apr - The Array, as parsed from the EGIZ Dict.
Returns:
Returns the restored KZ.
Throws:
PDFDocumentException - Forwarded exception.

printFoundHolders

protected static void printFoundHolders(String list_caption,
                                        List found_holders,
                                        PrintStream writer)

main

public static void main(String[] args)
                 throws IOException,
                        PresentableException
Throws:
IOException
PresentableException


Copyright © 2006-2007 EGIZ - E-Government Innovationszentrum. All Rights Reserved.