|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectat.knowcenter.wag.egov.egiz.PdfAS
This class contains the major methods used by both, the commandline and the webapp, to perform signation and verification.
| Field Summary | |
static String |
CORRECT_DOCUMENT_IF_NECESSARY_KEY
|
static String |
PDF_MIME_TYPE
The Mime Type of a PDF document. |
static String |
PDFAS_VERSION
The current version of the pdf-as library. |
static float |
SIGNATURE_BORDER
The left/right border. |
static float |
SIGNATURE_MARGIN
The top/bottom border. |
static String |
STRICT_MODE_KEY
The key of the strict mode setting. |
| Constructor Summary | |
PdfAS()
|
|
| Method Summary | |
static PositioningInstruction |
adjustSignatureTableandCalculatePosition(PdfDataSource pdfDataSource,
com.lowagie.text.pdf.PdfPTable pdf_table,
TablePos pos)
Sets the width of the table according to the layout of the document and calculates the y position where the PDFPTable should be placed. |
static DataSource |
applyStrictMode(DataSource dataSource)
|
static PdfDataSource |
applyStrictMode(PdfDataSource pdfDataSource)
Applies strict version mode on the PDF and throws an exception, if the pdf is not 1.4. |
static boolean |
checkForSemanticEquality(List found_blocks)
Checks the list of blocks for semantic equality. |
static boolean |
checkFoundRequiredKeys(List found_keys,
boolean old_style)
Checks the found keys for the required keys regarding the old style. |
static boolean |
checkThatOrderIsCorrectAndCorrectFoundKeys(List found_keys,
List profile_keys,
boolean old_style)
Checks that the found keys are in correct order regarding SIG_ID as optional key. |
static boolean |
containsFoundKey(List found_keys,
String key)
|
static SignatureData |
convertSignatureHolderToSignatureData(SignatureHolder signature_holder)
|
static com.lowagie.text.pdf.PdfPTable |
createPdfPTableFromSignatureObject(SignatureObject signature_object)
Creates the iText PDFPTable from a given SignatureObject. |
static SignatureObject |
createSignatureObjectFromType(String signature_type)
Helper method that creates a SignatureObject and initializes it with the given type. |
static PositioningInstruction |
determineTablePositioning(TablePos pos,
String signature_type,
PdfDataSource pdfDataSource,
com.lowagie.text.pdf.PdfPTable pdf_table)
Evalutates absolute positioning and prepares the PositioningInstruction for placing the table. |
static List |
extractNonTextualObjects(PdfDataSource pdfDs)
|
static String |
extractNormalizedTextTextual(byte[] pdf,
int length)
Deprecated. |
static String |
extractNormalizedTextTextual(PdfDataSource pdfDataSource)
Deprecated. Use version with explicit encoding extractNormalizedTextTextual(PdfDataSource, String).
This one uses cp1252. |
static String |
extractNormalizedTextTextual(PdfDataSource pdfDataSource,
String encoding)
|
static List |
extractSignatureHoldersTextual(String raw_text,
boolean old_style)
Extracts all signature blocks from the given raw text using textual mode. |
static TextualSignatureHolder |
extractSignatureHolderTextual(String raw_text,
boolean old_style)
Extracts the last signature holder from the given text. |
static List |
findBlockInText(String text,
SignatureTypeDefinition sig_type_def,
boolean old_style)
Tries to find a block of the given type in the text. |
static int |
getIndexOfFoundKey(List found_keys,
String key)
|
static boolean |
isPdf14(PdfDataSource pdfDataSource)
Checks the version of the given PDF to be 1.4 or lower. |
static boolean |
isStrictPdfChecking()
Tells, if strict PDF checking the PDF version is enabled. |
static String |
normalizeText(String text)
Normalizes the given text. |
static TablePos |
parsePositionFromPosString(String pos_string)
Parses the TablePos object from a given String with the appropriate format. |
static com.lowagie.text.pdf.PdfReader |
readInPdfDocument(PdfDataSource pdfDataSource)
Creates an iText Reader that parses the document. |
static SignSignatureObject |
sign(SignatureData data_to_sign,
Connector connector,
TimeStamper timeStamper)
Signs the given text with the provided connector using the given signature type. |
static SignatorInformation |
signCommandline(PdfDataSource pdfDataSource,
DataSink dataSink,
PdfASID signatorId,
String connectorId,
String profile,
String signatureKeyIdentifier,
TablePos pos,
TimeStamper timeStamper)
|
static SignatorInformation |
signCommandline(PdfDataSource pdfDataSource,
DataSink dataSink,
PdfASID signatorId,
String connectorId,
String profile,
TablePos pos)
|
static void |
sortFoundKeysAscendingly(List found_keys)
Sorts the FoundKeys List ascendingly according to the start indices of the found keys (the first found key in the list will have the lowest start index, the second one the second lowest and so forth). |
static void |
sortFoundKeysDescendingly(List found_keys)
Sorts the FoundKeys List descendingly according to the start indices of the found keys (the first found key in the list will have the highest start index, the second one the second highest and so forth). |
static List |
sortOutEarlyBlocks(List found_blocks)
Sorts out early blocks and leaves only those at the bottom of the text. |
static List |
sortOutLargeBlocks(List found_blocks)
Sorts out large blocks. |
static SignatureResponse |
verify(SignatureHolder signature_holder,
String connectorType,
boolean returnHashInputData,
Date verificationTime)
Verifies a SignatureHolder using the given connector. |
static List |
verifySignatureHolders(List signature_holders,
String connectorType,
boolean returnHashInputData,
Date verificationTime)
|
static List |
verifySignatureHoldersWeb(List signature_holders,
VerifySessionInformation si,
String loc_ref)
|
static SignatureResponse |
verifyWeb(SignatureHolder signature_holder,
String connector,
String loc_ref)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String PDFAS_VERSION
public static final String STRICT_MODE_KEY
public static final float SIGNATURE_BORDER
public static final float SIGNATURE_MARGIN
public static final String PDF_MIME_TYPE
public static final String CORRECT_DOCUMENT_IF_NECESSARY_KEY
| Constructor Detail |
public PdfAS()
| Method Detail |
public static boolean isStrictPdfChecking()
public static boolean isPdf14(PdfDataSource pdfDataSource)
throws PDFDocumentException
This scans the first 1000 bytes of the PDF for the pdf Header.
pdfDataSource - The PDF.
PDFDocumentException - Forwarded exception.
public static PdfDataSource applyStrictMode(PdfDataSource pdfDataSource)
throws PDFDocumentException,
SettingsException,
CorrectorException
Furthermore (independently of strict mode) the PDF is checked for parsability.
pdfDataSource - The pdf to be checked against strict mode.
PDFDocumentException
SettingsException
CorrectorException
public static DataSource applyStrictMode(DataSource dataSource)
throws PDFDocumentException,
SettingsException,
CorrectorException
PDFDocumentException
SettingsException
CorrectorException
public static List extractSignatureHoldersTextual(String raw_text,
boolean old_style)
throws PDFDocumentException,
SignatureException,
SignatureTypesException,
NormalizeException
raw_text - The raw text.
PDFDocumentException - F.e.
SignatureException - F.e.
SignatureTypesException
NormalizeException
public static TextualSignatureHolder extractSignatureHolderTextual(String raw_text,
boolean old_style)
throws SignatureException,
SignatureTypesException,
NormalizeException
raw_text - old_style -
SignatureException
SignatureTypesException
NormalizeException
public static List findBlockInText(String text,
SignatureTypeDefinition sig_type_def,
boolean old_style)
text - The text.sig_type_def - The type of the block.old_style - Tells, if the block is old style (SIG_KZ will be ignored), or if
it is a new block.
public static void sortFoundKeysDescendingly(List found_keys)
found_keys - The List of FoundKey objects to be sorted.public static void sortFoundKeysAscendingly(List found_keys)
found_keys - The List of FoundKey objects to be sorted.
public static boolean checkThatOrderIsCorrectAndCorrectFoundKeys(List found_keys,
List profile_keys,
boolean old_style)
If the SIG_ID key is misplaced, it will be removed from the found keys list.
found_keys - The found keys ordered descendingly to their start positionprofile_keys - The profile keys.old_style - Tells, if SIG_KZ should be ignored, or not.
public static List sortOutEarlyBlocks(List found_blocks)
found_blocks - The found blocks.
public static List sortOutLargeBlocks(List found_blocks)
found_blocks - The found blocks.
public static boolean checkForSemanticEquality(List found_blocks)
found_blocks - The list of found blocks.
public static int getIndexOfFoundKey(List found_keys,
String key)
public static boolean containsFoundKey(List found_keys,
String key)
public static boolean checkFoundRequiredKeys(List found_keys,
boolean old_style)
found_keys - The found keys.old_style - Flag that tells, if KZ is not required.
public static List verifySignatureHolders(List signature_holders,
String connectorType,
boolean returnHashInputData,
Date verificationTime)
throws PDFDocumentException,
NormalizeException,
SignatureException,
ConnectorException,
ConnectorFactoryException
PDFDocumentException
NormalizeException
SignatureException
ConnectorException
ConnectorFactoryException
public static List verifySignatureHoldersWeb(List signature_holders,
VerifySessionInformation si,
String loc_ref)
throws PDFDocumentException,
NormalizeException,
SignatureException,
ConnectorException
PDFDocumentException
NormalizeException
SignatureException
ConnectorException
public static SignatureResponse verify(SignatureHolder signature_holder,
String connectorType,
boolean returnHashInputData,
Date verificationTime)
throws NormalizeException,
PDFDocumentException,
SignatureException,
ConnectorException,
ConnectorFactoryException
signature_holder - The SignatureHolder to be verified.
NormalizeException - F.e.
PDFDocumentException - F.e.
SignatureException - F.e.
ConnectorException
ConnectorFactoryException
public static SignatureResponse verifyWeb(SignatureHolder signature_holder,
String connector,
String loc_ref)
throws NormalizeException,
PDFDocumentException,
SignatureException,
ConnectorException
NormalizeException
PDFDocumentException
SignatureException
ConnectorExceptionpublic static SignatureData convertSignatureHolderToSignatureData(SignatureHolder signature_holder)
public static SignSignatureObject sign(SignatureData data_to_sign,
Connector connector,
TimeStamper timeStamper)
throws SignatureException,
PDFDocumentException,
ConnectorException
data_to_sign - The data to be signed.connector - The connector.
SignatureException - F.e.
PDFDocumentException - F.e.
ConnectorException
public static SignatureObject createSignatureObjectFromType(String signature_type)
throws SignatureException,
SignatureTypesException
signature_type - The type.
SignatureException - f.e.
SignatureTypesException - f.e.
public static SignatorInformation signCommandline(PdfDataSource pdfDataSource,
DataSink dataSink,
PdfASID signatorId,
String connectorId,
String profile,
String signatureKeyIdentifier,
TablePos pos,
TimeStamper timeStamper)
throws PresentableException
PresentableException
public static SignatorInformation signCommandline(PdfDataSource pdfDataSource,
DataSink dataSink,
PdfASID signatorId,
String connectorId,
String profile,
TablePos pos)
throws PresentableException
PresentableExceptionpublic static List extractNonTextualObjects(PdfDataSource pdfDs)
pdfDs -
NonTextObjectInfo
public static String extractNormalizedTextTextual(PdfDataSource pdfDataSource)
throws PresentableException
extractNormalizedTextTextual(PdfDataSource, String).
This one uses cp1252.
pdfDataSource -
PresentableException
public static String extractNormalizedTextTextual(PdfDataSource pdfDataSource,
String encoding)
throws PresentableException
PresentableException
public static String extractNormalizedTextTextual(byte[] pdf,
int length)
throws PresentableException
PresentableException
public static String normalizeText(String text)
throws NormalizeException
text - The text to be normalized.
NormalizeException - F.e.
public static com.lowagie.text.pdf.PdfPTable createPdfPTableFromSignatureObject(SignatureObject signature_object)
throws PDFDocumentException,
SignatureException
signature_object - The SignatureObject.
PDFDocumentException - F.e.
SignatureException - F.e.
public static PositioningInstruction determineTablePositioning(TablePos pos,
String signature_type,
PdfDataSource pdfDataSource,
com.lowagie.text.pdf.PdfPTable pdf_table)
throws PDFDocumentException,
SettingsException
pos - The absolute positioning parameter. If null it is sought in the
profile definition.signature_type - The profile definition of the table to be written.pdf_table - The pdf table to be written.
PDFDocumentException - F.e.
SettingsException - F.e.
public static PositioningInstruction adjustSignatureTableandCalculatePosition(PdfDataSource pdfDataSource,
com.lowagie.text.pdf.PdfPTable pdf_table,
TablePos pos)
throws PDFDocumentException
pdf_table - The PDFPTable to be placed.
PDFDocumentException - F.e.
public static com.lowagie.text.pdf.PdfReader readInPdfDocument(PdfDataSource pdfDataSource)
throws PDFDocumentException
This is a convenience function for wrapping the Reader's exceptions into PDFDocumentException.
PDFDocumentException - F.e.
public static TablePos parsePositionFromPosString(String pos_string)
throws PDFDocumentException
pos_string - The pos string. e.g. x:40.0;y:auto;w:auto;p:1;f:300.0
PDFDocumentException - Thrown, if the String doesn't have the proper format.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||