/**
*
* It doesn't modify the original document, but simply returns the XML signature * response as the signed document. *
* * @author wprinz */ public class DetachedSignator_1_0_0 implements Signator { /** * The Pdf-AS ID of this Signator. */ public static final PdfASID MY_ID = new PdfASID(SignatorFactory.VENDOR, SignatorFactory.TYPE_TEST, SignatorFactory.VERSION_1_0_0); /** * @see at.knowcenter.wag.egov.egiz.framework.Signator#getMyId() */ public PdfASID getMyId() { return MY_ID; } /** * The Mime Type. */ public static final String MIME_TYPE = "text/xml"; //$NON-NLS-1$ /** * Default constructor. */ public DetachedSignator_1_0_0() { // Default constructor. } /** * @see at.knowcenter.wag.egov.egiz.framework.Signator#prepareSign(byte[], * String, TablePos, boolean) */ public IncrementalUpdateInformation prepareSign(PdfDataSource pdf, String signature_type, TablePos pos, boolean has_SIG_ID) throws PresentableException { IncrementalUpdateInformation iui = new IncrementalUpdateInformation(); iui.original_document = pdf; iui.signature_type = signature_type; iui.pos = pos; String document_text = PdfAS.extractNormalizedTextTextual(pdf); // logger_.debug("signed_text = " + document_text); DataSource ds = new TextDataSourceImpl(document_text); iui.signature_data = new SignatureDataImpl(ds, MIME_TYPE, "UTF-8"); //$NON-NLS-1$ //$NON-NLS-2$ return iui; } /** * @see at.knowcenter.wag.egov.egiz.framework.Signator#finishSign(at.knowcenter.wag.egov.egiz.pdf.IncrementalUpdateInformation) */ public SignResult finishSign(IncrementalUpdateInformation iui) throws PresentableException { try { String response = iui.signed_signature_object.response_properties.getProperty(BKUPostConnection.RESPONSE_STRING_KEY); byte[] response_bytes = response.getBytes("UTF-8"); //$NON-NLS-1$ SignResult sign_result = new SignResult(MIME_TYPE, response_bytes); return sign_result; } catch (UnsupportedEncodingException e) { e.printStackTrace(); throw new PDFDocumentException(300, e); } } }