/** * Copyright 2006 by Know-Center, Graz, Austria * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a * joint initiative of the Federal Chancellery Austria and Graz University of * Technology. * * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by * the European Commission - subsequent versions of the EUPL (the "Licence"); * You may not use this work except in compliance with the Licence. * You may obtain a copy of the Licence at: * http://www.osor.eu/eupl/ * * Unless required by applicable law or agreed to in writing, software * distributed under the Licence is distributed on an "AS IS" basis, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the Licence for the specific language governing permissions and * limitations under the Licence. * * This product combines work with different licenses. See the "NOTICE" text * file for details on the various modules and licenses. * The "NOTICE" text file is part of the distribution. Any derivative works * that you distribute must include a readable copy of the "NOTICE" text file. * * $Id: TextualVerificator_pdfasold.java,v 1.3 2006/10/11 08:03:22 wprinz Exp $ */ package at.knowcenter.wag.egov.egiz.framework.verificators; import java.io.ByteArrayInputStream; import java.util.List; import org.apache.log4j.Logger; import at.knowcenter.wag.egov.egiz.PdfAS; import at.knowcenter.wag.egov.egiz.cfg.ConfigLogger; import at.knowcenter.wag.egov.egiz.exceptions.PDFDocumentException; import at.knowcenter.wag.egov.egiz.exceptions.PresentableException; import at.knowcenter.wag.egov.egiz.framework.Verificator; import at.knowcenter.wag.exactparser.parsing.results.FooterParseResult; /** * This Verificator extracts a PDF-AS old signature from the original document. * * @author wprinz */ public class TextualVerificator_pdfasold implements Verificator { /** * The logger definition. */ private static final Logger logger_ = ConfigLogger.getLogger(TextualVerificator_1_0_0.class); /** * Default Constructor. */ public TextualVerificator_pdfasold() { // Default Constructor. } /** * @see at.knowcenter.wag.egov.egiz.framework.Verificator#parseBlock(byte[], at.knowcenter.wag.exactparser.parsing.results.FooterParseResult, int) */ public List parseBlock(byte[] pdf, FooterParseResult block, int start_of_whole_block) throws PresentableException { if (start_of_whole_block != 0) { throw new PDFDocumentException(201, "The PDF-AS-old Verificator can only be applied on original documents."); } String normalized_text = PdfAS.extractNormalizedTextTextual(pdf, block.next_index); logger_.debug("Scanning block:"); List signature_holders = PdfAS.extractSignatureHoldersTextual(normalized_text, true); logger_.debug(": end of Scanning block"); // List signature_holders = new ArrayList(); // // SignatureTypes sig_types = SignatureTypes.getInstance(); // List signatureTypes_ = sig_types.getSignatureTypeDefinitions(); // // boolean can_separate = true; // int endIndex = normalized_text.length(); // String signed_text = normalized_text; // // SignatureBlock sig_block = new SignatureBlock(signatureTypes_); // can_separate = sig_block.separateBlockFromRawText(signed_text, true); // if (can_separate) // { // endIndex = sig_block.getStartIndex(); // signed_text = signed_text.substring(0, endIndex); // // SignatureObject sig_object = sig_block.getSignatureObject(); // // SignatureHolder holder = new SignatureHolder(); // holder.signed_text = signed_text; // holder.signature_object = sig_object; // signature_holders.add(0, holder); // } return signature_holders; } }