From 535a04fa05f739ec16dd81666e3b0f82dfbd442d Mon Sep 17 00:00:00 2001 From: tknall Date: Wed, 9 Jan 2013 15:41:29 +0000 Subject: pdf-as-lib maven project files moved to pdf-as-lib git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/pdf-as/trunk@926 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../gv/egiz/pdfas/framework/ConnectorFactory.java | 107 ----------------- .../egiz/pdfas/framework/ConnectorParameters.java | 118 ------------------- .../at/gv/egiz/pdfas/framework/DataManager.java | 55 --------- .../gv/egiz/pdfas/framework/DataSourceHolder.java | 45 ------- .../at/gv/egiz/pdfas/framework/DataStrategy.java | 57 --------- .../gv/egiz/pdfas/framework/SignatorFactory.java | 131 --------------------- .../pdfas/framework/SignatureHolderHelper.java | 57 --------- .../egiz/pdfas/framework/VerificatorFactory.java | 65 ---------- .../pdfas/framework/config/SettingsHelper.java | 81 ------------- .../gv/egiz/pdfas/framework/input/DataSource.java | 70 ----------- .../pdfas/framework/input/ExtractionStage.java | 90 -------------- .../egiz/pdfas/framework/input/PdfDataSource.java | 41 ------- .../pdfas/framework/input/PdfDataSourceHolder.java | 49 -------- .../egiz/pdfas/framework/input/TextDataSource.java | 39 ------ .../framework/input/correction/Corrector.java | 61 ---------- .../input/correction/CorrectorFactory.java | 63 ---------- .../gv/egiz/pdfas/framework/output/DataSink.java | 42 ------- .../sigdevice/SequentialSignatureDevice.java | 45 ------- .../pdfas/framework/sigdevice/SignatureDevice.java | 36 ------ .../gv/egiz/pdfas/framework/signator/Signator.java | 71 ----------- .../framework/signator/SignatorInformation.java | 99 ---------------- .../pdfas/framework/verificator/Verificator.java | 61 ---------- .../framework/vfilter/VerificationFilter.java | 72 ----------- .../vfilter/VerificationFilterParameters.java | 105 ----------------- 24 files changed, 1660 deletions(-) delete mode 100644 src/main/java/at/gv/egiz/pdfas/framework/ConnectorFactory.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/framework/ConnectorParameters.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/framework/DataManager.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/framework/DataSourceHolder.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/framework/DataStrategy.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/framework/SignatorFactory.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/framework/SignatureHolderHelper.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/framework/VerificatorFactory.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/framework/config/SettingsHelper.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/framework/input/DataSource.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/framework/input/ExtractionStage.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/framework/input/PdfDataSource.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/framework/input/PdfDataSourceHolder.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/framework/input/TextDataSource.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/framework/input/correction/Corrector.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/framework/input/correction/CorrectorFactory.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/framework/output/DataSink.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/framework/sigdevice/SequentialSignatureDevice.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/framework/sigdevice/SignatureDevice.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/framework/signator/Signator.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/framework/signator/SignatorInformation.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/framework/verificator/Verificator.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/framework/vfilter/VerificationFilter.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/framework/vfilter/VerificationFilterParameters.java (limited to 'src/main/java/at/gv/egiz/pdfas/framework') diff --git a/src/main/java/at/gv/egiz/pdfas/framework/ConnectorFactory.java b/src/main/java/at/gv/egiz/pdfas/framework/ConnectorFactory.java deleted file mode 100644 index c9b6238..0000000 --- a/src/main/java/at/gv/egiz/pdfas/framework/ConnectorFactory.java +++ /dev/null @@ -1,107 +0,0 @@ -/** - * 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. - */ -package at.gv.egiz.pdfas.framework; - -import at.knowcenter.wag.egov.egiz.exceptions.ConnectorException; -import at.knowcenter.wag.egov.egiz.exceptions.ConnectorFactoryException; -import at.knowcenter.wag.egov.egiz.sig.connectors.Connector; -import at.knowcenter.wag.egov.egiz.sig.connectors.bku.EnvelopedBase64BKUConnector; -import at.knowcenter.wag.egov.egiz.sig.connectors.bku.MultipartDetachedBKUConnector; -import at.knowcenter.wag.egov.egiz.sig.connectors.bku.OldEnvelopingBase64BKUConnector; -import at.knowcenter.wag.egov.egiz.sig.connectors.moa.EnvelopingBase64MOAConnector; -import at.knowcenter.wag.egov.egiz.sig.connectors.moa.MOASoapWithAttachmentConnector; - -/** - * @author wprinz - */ -public class ConnectorFactory -{ - // TODO the functionality of the connector should be split into template - // handling and the actualy hardware access - - public static String DETACHED_MULTIPART_BKU_CONNECTOR = "DetachedMultipartBKUConnector"; - - public static String ENVELOPING_BASE64_BKU_CONNECTOR = "EnvelopingBase64BKUConnector"; - - public static String OLD_ENVELOPING_BASE64_BKU_CONNECTOR = "OldEnvelopingBase64BKUConnector"; - - public static String DETACHED_LOCREF_MOA_CONNECTOR = "DetachedLocRefMOAConnector"; - - public static String ENVELOPING_BASE64_MOA_CONNECTOR = "EnvelopingBase64MOAConnector"; - - - - public static Connector createConnector (String connectorId, ConnectorParameters connectorParameters) throws ConnectorFactoryException, ConnectorException - { - if (connectorId.equals(DETACHED_MULTIPART_BKU_CONNECTOR)) - { - return new MultipartDetachedBKUConnector(connectorParameters); - } - - if (connectorId.equals(ENVELOPING_BASE64_BKU_CONNECTOR)) - { - return new EnvelopedBase64BKUConnector(connectorParameters.getProfileId()); - } - - if (connectorId.equals(OLD_ENVELOPING_BASE64_BKU_CONNECTOR)) - { - return new OldEnvelopingBase64BKUConnector(connectorParameters.getProfileId()); - } - - if (connectorId.equals(DETACHED_LOCREF_MOA_CONNECTOR)) - { -// TODO Hier wird der neue Connector verwendet -// return new DetachedLocRefMOAConnector(profile, locRef); - return new MOASoapWithAttachmentConnector(connectorParameters); - } - - if (connectorId.equals(ENVELOPING_BASE64_MOA_CONNECTOR)) - { -// TODO Hier wird NICHT der neue Connector verwendet - return new EnvelopingBase64MOAConnector(connectorParameters); -// return new MOASoapWithAttachmentConnector(profile); - } - - throw new ConnectorFactoryException("The connector Id " + connectorId + " couldn't be found by the ConnectorFactory."); - } - - public static boolean isMOA (String connectorId) - { - if (connectorId.equals(DETACHED_LOCREF_MOA_CONNECTOR) || connectorId.equals(ENVELOPING_BASE64_MOA_CONNECTOR)) - { - return true; - } - - return false; - } - -// public static Connector createConnectorForCommandline (String connectorId) throws ConnectorFactoryException -// { -// } -// -// public static Connector createConnectorForCommandline (String connectorId) throws ConnectorFactoryException -// { -// } - -} diff --git a/src/main/java/at/gv/egiz/pdfas/framework/ConnectorParameters.java b/src/main/java/at/gv/egiz/pdfas/framework/ConnectorParameters.java deleted file mode 100644 index a0b7ceb..0000000 --- a/src/main/java/at/gv/egiz/pdfas/framework/ConnectorParameters.java +++ /dev/null @@ -1,118 +0,0 @@ -/** - * 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. - */ -package at.gv.egiz.pdfas.framework; - -import java.util.Date; - -/** - * Parameters passed to the constructor of the Connector. - * - *

- * Each Connector must have a constructor accepting this parameter class as an - * argument. - *

- * - * @author wprinz - */ -public class ConnectorParameters { - /** - * The profile Id to get the connector parameters from. - * - *

- * The there are no explicit parameters for the connector in the profile, the - * default parameters are used. - *

- */ - protected String profileId = null; - - /** - * The signature key identifier to be used or null if it should be read from - * the profile. - * - *

- * Currently this is only used by MOA connectors and identifies the MOA key - * group to be used when signing. If null, the MOA connector reads the key - * from the profile. - *

- */ - protected String signatureKeyIdentifier = null; - - /** - * Tells, if the connector should ask the device to return the hash input - * data. - * - *

- * Note that not all connectors support to return the hash input data - so - * there is no guarantee that the hash value will actually be returned. - *

- */ - protected boolean returnHashInputData = false; - - /** - * Allows to specify an explicit time of verification. - * - *

- * If null, the device's default behaviour determines the time of - * verification, which is usually the current time. - *

- *

- * The time of verification usually influences the certificate check. E.g. - * the certificate may not be valid at the time of verification. - *

- */ - protected Date verificationTime = null; - - public String getProfileId() { - return this.profileId; - } - - public void setProfileId(String profileId) { - this.profileId = profileId; - } - - public String getSignatureKeyIdentifier() { - return this.signatureKeyIdentifier; - } - - public void setSignatureKeyIdentifier(String signatureKeyIdentifier) { - this.signatureKeyIdentifier = signatureKeyIdentifier; - } - - public boolean isReturnHashInputData() { - return this.returnHashInputData; - } - - public void setReturnHashInputData(boolean returnHashInputData) { - this.returnHashInputData = returnHashInputData; - } - - public Date getVerificationTime() { - return this.verificationTime; - } - - public void setVerificationTime(Date verificationTime) { - this.verificationTime = verificationTime; - } - -} diff --git a/src/main/java/at/gv/egiz/pdfas/framework/DataManager.java b/src/main/java/at/gv/egiz/pdfas/framework/DataManager.java deleted file mode 100644 index 4f0641a..0000000 --- a/src/main/java/at/gv/egiz/pdfas/framework/DataManager.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * 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. - */ -package at.gv.egiz.pdfas.framework; - -/** - * The DataManager is a mediator for all components that need to allocate large - * data elements. - * - *

- * The DataManager uses a certain DataStrategy to perform the actual tasks. The - * strategy may be different in different environments. E.g. The commandline may - * implement a strategy to keep all data in memory, whereas the web might - * implement one that puts as many data onto the disk as possible to save - * memory. - *

- * - * @author wprinz - * - */ -public class DataManager -{ - protected static DataStrategy dataStrategy = null; - - public static void initialize(DataStrategy ds) - { - dataStrategy = ds; - } - - public static DataStrategy getDataStrategy() - { - return dataStrategy; - } - -} diff --git a/src/main/java/at/gv/egiz/pdfas/framework/DataSourceHolder.java b/src/main/java/at/gv/egiz/pdfas/framework/DataSourceHolder.java deleted file mode 100644 index 355da37..0000000 --- a/src/main/java/at/gv/egiz/pdfas/framework/DataSourceHolder.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * 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. - */ -package at.gv.egiz.pdfas.framework; - -import at.gv.egiz.pdfas.framework.input.DataSource; - -public class DataSourceHolder { - private DataSource dataSource; - - public DataSourceHolder(DataSource dataSource) { - this.dataSource = dataSource; - } - - public DataSource getDataSource() { - return dataSource; - } - - public void setDataSource(DataSource dataSource) { - this.dataSource = dataSource; - } - - - -} diff --git a/src/main/java/at/gv/egiz/pdfas/framework/DataStrategy.java b/src/main/java/at/gv/egiz/pdfas/framework/DataStrategy.java deleted file mode 100644 index 659ba1d..0000000 --- a/src/main/java/at/gv/egiz/pdfas/framework/DataStrategy.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * 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. - */ -package at.gv.egiz.pdfas.framework; - -import java.io.InputStream; - -import at.gv.egiz.pdfas.framework.input.DataSource; -import at.gv.egiz.pdfas.framework.input.PdfDataSource; -import at.gv.egiz.pdfas.framework.input.TextDataSource; -import at.gv.egiz.pdfas.framework.output.DataSink; - -/** - * Factory for creating DataSources. - * - * @author wprinz - */ -public interface DataStrategy -{ - - public TextDataSource createTextDataSource (String text); - - public PdfDataSource createPdfDataSource (InputStream is); - - public PdfDataSource createPdfDataSource (DataSource other, int length); - - /** - * @deprecated - use streaming. - * @param pdf - * @return - */ - public PdfDataSource createPdfDataSource (byte [] pdf); - - public void destroyDataSource (DataSource dataSource); - - public DataSink createDataSink (); -} diff --git a/src/main/java/at/gv/egiz/pdfas/framework/SignatorFactory.java b/src/main/java/at/gv/egiz/pdfas/framework/SignatorFactory.java deleted file mode 100644 index 891551c..0000000 --- a/src/main/java/at/gv/egiz/pdfas/framework/SignatorFactory.java +++ /dev/null @@ -1,131 +0,0 @@ -/** - * 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. - */ -package at.gv.egiz.pdfas.framework; - -import at.knowcenter.wag.egov.egiz.PdfASID; -import at.knowcenter.wag.egov.egiz.exceptions.SignatorFactoryException; -import at.gv.egiz.pdfas.impl.signator.binary.BinarySignator_1_0_0; -import at.gv.egiz.pdfas.impl.signator.binary.BinarySignator_1_1_0; -import at.gv.egiz.pdfas.impl.signator.detached.DetachedTextualSignator_1_0_0; -import at.gv.egiz.pdfas.impl.signator.textual.TextualSignator_1_0_0; -import at.gv.egiz.pdfas.impl.signator.textual.TextualSignator_1_1_0; -import at.gv.egiz.pdfas.impl.signator.textual.TextualSignator_1_2_0; -import at.gv.egiz.pdfas.framework.signator.Signator; - -/** - * @author wprinz - * - */ -public class SignatorFactory -{ - /** - * The Vendor. - */ - public static final String VENDOR = "bka.gv.at"; //$NON-NLS-1$ - - /** - * The binary Signator algorithm. - */ - public static final String TYPE_BINARY = "binaer"; //$NON-NLS-1$ - - /** - * The textual Signator algorithm. - */ - public static final String TYPE_TEXTUAL = "text"; //$NON-NLS-1$ - - /** - * Detached Signator. - */ - public static final String TYPE_DETACHED_TEXTUAL = "detachedtext"; //$NON-NLS-1$ - - /** - * This application's current algorithm versions. - */ - public static final String VERSION_1_0_0 = "v1.0.0"; //$NON-NLS-1$ - - /** - * This application's current algorithm versions. - */ - public static final String VERSION_1_1_0 = "v1.1.0"; //$NON-NLS-1$ - - /** - * This application's current algorithm versions. - */ - public static final String VERSION_1_2_0 = "v1.2.0"; //$NON-NLS-1$ - - - public static Signator createSignator (PdfASID id) throws SignatorFactoryException - { - if (!id.getVendor().equals(VENDOR)) - { - throw new SignatorFactoryException("The vendor '" + id.getVendor() + "' is unrecognized by this SignatorFactory. (id='" + id + "')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } - - if (id.getType().equals(TYPE_BINARY)) - { - if (id.getVersion().equals(VERSION_1_0_0)) - { - return new BinarySignator_1_0_0(); - } - if (id.getVersion().equals(VERSION_1_1_0)) - { - return new BinarySignator_1_1_0(); - } - - throw new SignatorFactoryException("The version '" + id.getVersion() + "' of type '" + id.getType() + "' is not supported by this SignatorFactory. (id='" + id + "')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - } - - if (id.getType().equals(TYPE_TEXTUAL)) - { - if (id.getVersion().equals(VERSION_1_0_0)) - { - return new TextualSignator_1_0_0(); - } - if (id.getVersion().equals(VERSION_1_1_0)) - { - return new TextualSignator_1_1_0(); - } - if (id.getVersion().equals(VERSION_1_2_0)) - { - return new TextualSignator_1_2_0(); - } - - - throw new SignatorFactoryException("The version '" + id.getVersion() + "' of type '" + id.getType() + "' is not supported by this SignatorFactory. (id='" + id + "')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - } - - if (id.getType().equals(TYPE_DETACHED_TEXTUAL)) - { - if (id.getVersion().equals(VERSION_1_0_0)) - { - return new DetachedTextualSignator_1_0_0(); - } - - throw new SignatorFactoryException("The version '" + id.getVersion() + "' of type '" + id.getType() + "' is not supported by this SignatorFactory. (id='" + id + "')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - } - - throw new SignatorFactoryException("The type '" + id.getType() + "' is not supported by this SignatorFactory. (id='" + id + "')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } - -} diff --git a/src/main/java/at/gv/egiz/pdfas/framework/SignatureHolderHelper.java b/src/main/java/at/gv/egiz/pdfas/framework/SignatureHolderHelper.java deleted file mode 100644 index 7aaa285..0000000 --- a/src/main/java/at/gv/egiz/pdfas/framework/SignatureHolderHelper.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * 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. - */ -package at.gv.egiz.pdfas.framework; - -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - -import at.knowcenter.wag.egov.egiz.pdf.EGIZDate; -import at.knowcenter.wag.egov.egiz.pdf.SignatureHolder; - -public final class SignatureHolderHelper -{ - - /** - * Sorts the List of SignatureHolders by date. - * - * @param signatureHolders - * The List of SignatureHolders. - */ - public static void sortByDate(List signatureHolders) - { - Collections.sort(signatureHolders, new Comparator() { - public int compare(Object o1, Object o2) - { - SignatureHolder sh1 = (SignatureHolder) o1; - SignatureHolder sh2 = (SignatureHolder) o2; - - EGIZDate date1 = EGIZDate.parseFromString(sh1.getSignatureObject().getSignationDate()); - EGIZDate date2 = EGIZDate.parseFromString(sh2.getSignatureObject().getSignationDate()); - - return date1.compareTo(date2); - } - }); - } -} diff --git a/src/main/java/at/gv/egiz/pdfas/framework/VerificatorFactory.java b/src/main/java/at/gv/egiz/pdfas/framework/VerificatorFactory.java deleted file mode 100644 index 2cc964b..0000000 --- a/src/main/java/at/gv/egiz/pdfas/framework/VerificatorFactory.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * 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. - */ -package at.gv.egiz.pdfas.framework; - -import at.gv.egiz.pdfas.exceptions.framework.VerificatorFactoryException; -import at.gv.egiz.pdfas.framework.verificator.Verificator; -import at.gv.egiz.pdfas.impl.verificator.binary.BinaryVerificator_1_0_0; -import at.gv.egiz.pdfas.impl.verificator.binary.BinaryVerificator_1_1_0; -import at.knowcenter.wag.egov.egiz.PdfASID; -import at.knowcenter.wag.egov.egiz.framework.SignatorFactory; - -/** - * @author wprinz - * - */ -public class VerificatorFactory -{ - - public static Verificator createVerificator(PdfASID kz) throws VerificatorFactoryException - { - if (kz.getType().equals(SignatorFactory.TYPE_BINARY)) - { - return createBinaryVerificator(kz); - } - - return null; - } - - public static Verificator createBinaryVerificator(PdfASID kz) throws VerificatorFactoryException - { - assert kz.getType().equals(SignatorFactory.TYPE_BINARY); - - if (kz.equals(BinaryVerificator_1_0_0.MY_ID)) - { - return new BinaryVerificator_1_0_0(); - } - if (kz.equals(BinaryVerificator_1_1_0.MY_ID)) - { - return new BinaryVerificator_1_1_0(); - } - - throw new VerificatorFactoryException("kz is not a known binary signator " + kz); - } -} diff --git a/src/main/java/at/gv/egiz/pdfas/framework/config/SettingsHelper.java b/src/main/java/at/gv/egiz/pdfas/framework/config/SettingsHelper.java deleted file mode 100644 index fc9860a..0000000 --- a/src/main/java/at/gv/egiz/pdfas/framework/config/SettingsHelper.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * 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. - */ -package at.gv.egiz.pdfas.framework.config; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import at.gv.egiz.pdfas.framework.vfilter.VerificationFilterParameters; -import at.gv.egiz.pdfas.impl.vfilter.VerificationFilterParametersImpl; -import at.knowcenter.wag.egov.egiz.cfg.SettingsReader; -import at.knowcenter.wag.egov.egiz.exceptions.SettingsException; - -/** - * Contains helpful Settings functions. - * - * @author wprinz - */ -public final class SettingsHelper -{ - /** - * The log. - */ - private static final Log log = LogFactory.getLog(SettingsHelper.class); - - public static VerificationFilterParameters readVerificationFilterParametersFromSettings() throws SettingsException - { - boolean binaryOnly = getFlag("binary_only"); - boolean assumeOnlySB = getAssumeSB(); - boolean checkOld = getFlag("check_old_textual_sigs"); - - VerificationFilterParameters vfp = new VerificationFilterParametersImpl(binaryOnly, assumeOnlySB, checkOld); - return vfp; - } - - protected static boolean getFlag(String settingsKey) throws SettingsException - { - String flag = SettingsReader.getInstance().getSetting(settingsKey, "false"); - boolean b = true; - if (flag.equals("false")) - { - b = false; - } - return b; - } - - protected static boolean getAssumeSB() throws SettingsException - { - // backward compatibility for typo - String setting_with_typo = SettingsReader.getInstance().getSetting("assume_only_signauture_blocks", null); - if (setting_with_typo != null) - { - log.warn("You still have the typo in your configuration file. Please change 'assume_only_signauture_blocks' to 'assume_only_signature_blocks'. Thanks."); - boolean assumeOnlySB_typo = getFlag("assume_only_signauture_blocks"); - return assumeOnlySB_typo; - } - - boolean assumeOnlySB = getFlag("assume_only_signature_blocks"); - return assumeOnlySB; - } -} diff --git a/src/main/java/at/gv/egiz/pdfas/framework/input/DataSource.java b/src/main/java/at/gv/egiz/pdfas/framework/input/DataSource.java deleted file mode 100644 index f834622..0000000 --- a/src/main/java/at/gv/egiz/pdfas/framework/input/DataSource.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * 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. - */ -package at.gv.egiz.pdfas.framework.input; - -import java.io.InputStream; - -/** - * The input document data source. - * - *

- * Usually this is a PdfDataSource, but it may be a TextDataSource as well. - *

- * - * @author wprinz - * - */ -public interface DataSource -{ - /** - * Creates a new InputStream that allows to read out the document's binary - * data from the beginning. - * - * @return Returns the InputStream with the binary data. - */ - public InputStream createInputStream(); - - /** - * Returns the length (number of bytes) of the stream. - * - * @return Returns the length (number of bytes) of the stream. - */ - public int getLength(); - - /** - * Returns the data of this DataSource as a byte array. - * - *

- * Calling this method indicates that you need a byte array for random read access. - * The DataSource implementation should of course cache this byte array to avoid too much memory usage. - *

- *

- * Performance analysis has shown that the libraries internally convert the streams to byte arrays and - * that file system access is very slow. - *

- * - * @return - */ - public byte [] getAsByteArray(); -} diff --git a/src/main/java/at/gv/egiz/pdfas/framework/input/ExtractionStage.java b/src/main/java/at/gv/egiz/pdfas/framework/input/ExtractionStage.java deleted file mode 100644 index 19065b0..0000000 --- a/src/main/java/at/gv/egiz/pdfas/framework/input/ExtractionStage.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * 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. - */ -package at.gv.egiz.pdfas.framework.input; - -import java.util.List; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import at.gv.egiz.pdfas.exceptions.ErrorCode; -import at.gv.egiz.pdfas.exceptions.framework.VerificationFilterException; -import at.gv.egiz.pdfas.framework.DataSourceHolder; -import at.gv.egiz.pdfas.framework.vfilter.VerificationFilter; -import at.gv.egiz.pdfas.framework.vfilter.VerificationFilterParameters; -import at.gv.egiz.pdfas.impl.input.IncrementalUpdateParser; -import at.gv.egiz.pdfas.impl.vfilter.VerificationFilterImpl; -import at.knowcenter.wag.egov.egiz.exceptions.PDFDocumentException; -import at.knowcenter.wag.egov.egiz.exceptions.PresentableException; - -/** - * Extracts all signatures from a given input DataSource. - * - * @author wprinz - */ -public class ExtractionStage -{ - /** - * The log. - */ - private static final Log log = LogFactory.getLog(ExtractionStage.class); - - public List extractSignatureHolders(final DataSourceHolder dataSource, VerificationFilterParameters parameters) throws PresentableException - { - if (dataSource.getDataSource() instanceof PdfDataSource) - { - PdfDataSource pdfDataSource = (PdfDataSource) dataSource.getDataSource(); - - PdfDataSourceHolder pdsh = new PdfDataSourceHolder(pdfDataSource); - List blocks = parsePdfIntoBlocks(pdsh); - dataSource.setDataSource(pdsh.getDataSource()); - parameters.setBeenCorrected(pdsh.hasChanged()); - - VerificationFilter vf = new VerificationFilterImpl(); - List signatures = vf.extractSignatureHolders(pdsh.getDataSource(), blocks, parameters); - - return signatures; - } - - if (dataSource.getDataSource() instanceof TextDataSource) - { - TextDataSource textDataSource = (TextDataSource) dataSource.getDataSource(); - - VerificationFilter vf = new VerificationFilterImpl(); - List signatures = vf.extractSignaturHolders(textDataSource, parameters); - - return signatures; - } - - String msg = "The input DataSource is neither pdf nor text. class.name = " + dataSource.getClass().getName(); - log.error(msg); - throw new VerificationFilterException(ErrorCode.DOCUMENT_CANNOT_BE_READ, msg); - } - - protected List parsePdfIntoBlocks(PdfDataSourceHolder pdfDataSource) throws PDFDocumentException - { - List blocks = IncrementalUpdateParser.parsePdfIntoIUBlocks(pdfDataSource); - return blocks; - } -} diff --git a/src/main/java/at/gv/egiz/pdfas/framework/input/PdfDataSource.java b/src/main/java/at/gv/egiz/pdfas/framework/input/PdfDataSource.java deleted file mode 100644 index ce3d658..0000000 --- a/src/main/java/at/gv/egiz/pdfas/framework/input/PdfDataSource.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * 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. - */ -package at.gv.egiz.pdfas.framework.input; - - -/** - * Represents the binary data of a PDF document. - * - *

- * This interface allows Pdf data to be handled in an abstract way so that the - * storage (byta array, disk etc.) of pdf documents can be separated from the - * algorithms. - *

- * - * @author wprinz - */ -public interface PdfDataSource extends DataSource -{ - // jsut a marker interface -} diff --git a/src/main/java/at/gv/egiz/pdfas/framework/input/PdfDataSourceHolder.java b/src/main/java/at/gv/egiz/pdfas/framework/input/PdfDataSourceHolder.java deleted file mode 100644 index 14a4ff4..0000000 --- a/src/main/java/at/gv/egiz/pdfas/framework/input/PdfDataSourceHolder.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * 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. - */ -package at.gv.egiz.pdfas.framework.input; - -public class PdfDataSourceHolder { - private PdfDataSource dataSource; - private boolean hasChanged = false; - - public PdfDataSourceHolder(PdfDataSource dataSource) { - this.dataSource = dataSource; - } - - public PdfDataSource getDataSource() { - return dataSource; - } - - public void setDataSource(PdfDataSource dataSource) { - this.dataSource = dataSource; - this.hasChanged = true; - } - - public boolean hasChanged() { - return this.hasChanged; - } - - - -} diff --git a/src/main/java/at/gv/egiz/pdfas/framework/input/TextDataSource.java b/src/main/java/at/gv/egiz/pdfas/framework/input/TextDataSource.java deleted file mode 100644 index 7623896..0000000 --- a/src/main/java/at/gv/egiz/pdfas/framework/input/TextDataSource.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * 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. - */ -package at.gv.egiz.pdfas.framework.input; - -/** - * Represents a free-text input text to be processed. - * - * @author wprinz - */ -public interface TextDataSource extends DataSource -{ - /** - * Returns the text to be processed. - * @return Returns the text to be processed. - */ - public String getText(); - -} diff --git a/src/main/java/at/gv/egiz/pdfas/framework/input/correction/Corrector.java b/src/main/java/at/gv/egiz/pdfas/framework/input/correction/Corrector.java deleted file mode 100644 index 71f3ded..0000000 --- a/src/main/java/at/gv/egiz/pdfas/framework/input/correction/Corrector.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * 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. - */ -package at.gv.egiz.pdfas.framework.input.correction; - -import at.gv.egiz.pdfas.exceptions.framework.CorrectorException; -import at.gv.egiz.pdfas.framework.input.PdfDataSource; - -/** - * Interface for PDF corretors. - * - *

- * Often PDF documents generated by various document to PDF converters have an - * invalid structure that upsets PDF-AS. The correction mechanism allows these - * documents to be corrected before being signed. - *

- *

- * A PDF corrector takes an incorrect PDF document and transforms it into a - * correct one. - *

- *

- * Note that correcting a document destroys all signatures in that document, so - * never correct an already signed document. - *

- * - * @author wprinz - */ -public interface Corrector -{ - /** - * Corrects the given PDF document to a form that PDF-AS can use. - * - * @param document - * The (incorrect) PDF document. - * @return Returns the corrected PDF document. - * @throws CorrectorException - * Exception thrown if the document couldn't be corrected. - */ - public PdfDataSource correctDocument(PdfDataSource document) throws CorrectorException; - -} diff --git a/src/main/java/at/gv/egiz/pdfas/framework/input/correction/CorrectorFactory.java b/src/main/java/at/gv/egiz/pdfas/framework/input/correction/CorrectorFactory.java deleted file mode 100644 index 8c954f7..0000000 --- a/src/main/java/at/gv/egiz/pdfas/framework/input/correction/CorrectorFactory.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * 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. - */ -package at.gv.egiz.pdfas.framework.input.correction; - -import at.gv.egiz.pdfas.impl.input.correction.ExternalCorrector; -import at.gv.egiz.pdfas.impl.input.correction.InternalCorrector; -import at.knowcenter.wag.egov.egiz.cfg.SettingsReader; -import at.knowcenter.wag.egov.egiz.exceptions.SettingsException; - -/** - * Factory for creating Correctors. - * - * @author wprinz - */ -public class CorrectorFactory -{ - public static final String INTERNAL_CORRECTOR = "internal"; - - public static final String EXTERNAL_CORRECTOR = "external"; - - public static final String CORRECTOR_KEY = "corrector"; - - public static Corrector createCorrector(String id) throws SettingsException - { - if (id.equals(INTERNAL_CORRECTOR)) - { - return new InternalCorrector(); - } - if (id.equals(EXTERNAL_CORRECTOR)) - { - return new ExternalCorrector(); - } - throw new SettingsException("The connector id '" + id + "' is not a valid corrector id."); - } - - public static Corrector createCorrector() throws SettingsException - { - String id = SettingsReader.getInstance().getSetting(CORRECTOR_KEY, INTERNAL_CORRECTOR); - return createCorrector(id); - } - -} diff --git a/src/main/java/at/gv/egiz/pdfas/framework/output/DataSink.java b/src/main/java/at/gv/egiz/pdfas/framework/output/DataSink.java deleted file mode 100644 index 52959a9..0000000 --- a/src/main/java/at/gv/egiz/pdfas/framework/output/DataSink.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * 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. - */ -package at.gv.egiz.pdfas.framework.output; - -import java.io.OutputStream; - -/** - * Output document data sink. - * - * @author wprinz - */ -public interface DataSink -{ - public OutputStream createOutputStream(String mimeType); - - public OutputStream createOutputStream(String mimeType, String characterEncoding); - - public String getMimeType(); - - public String getCharacterEncoding(); -} diff --git a/src/main/java/at/gv/egiz/pdfas/framework/sigdevice/SequentialSignatureDevice.java b/src/main/java/at/gv/egiz/pdfas/framework/sigdevice/SequentialSignatureDevice.java deleted file mode 100644 index 4edc435..0000000 --- a/src/main/java/at/gv/egiz/pdfas/framework/sigdevice/SequentialSignatureDevice.java +++ /dev/null @@ -1,45 +0,0 @@ -/** - * 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. - */ -package at.gv.egiz.pdfas.framework.sigdevice; - -/** - * A SignatureDevice that can be accessed in a sequential manner. - * - *

- * A sequential device handles all necessary steps in sequence. E.g. all the - * data is transformed into a http request and sent to a server. The server - * processes the request and answers. The response from the server is then - * analyzed and returned. - *

- * - * @author wprinz - */ -public interface SequentialSignatureDevice extends SignatureDevice -{ - // This is just a concept how it could be realized in future. - public void sign(); - - public void verify(); - -} diff --git a/src/main/java/at/gv/egiz/pdfas/framework/sigdevice/SignatureDevice.java b/src/main/java/at/gv/egiz/pdfas/framework/sigdevice/SignatureDevice.java deleted file mode 100644 index eb7656a..0000000 --- a/src/main/java/at/gv/egiz/pdfas/framework/sigdevice/SignatureDevice.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * 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. - */ -package at.gv.egiz.pdfas.framework.sigdevice; - -/** - * Performs the task of passing the signature XML and data from the application - * to an external signature device and return the response in an form that the - * application can use. - * - * @author wprinz - */ -public interface SignatureDevice -{ - // Marker interface -} diff --git a/src/main/java/at/gv/egiz/pdfas/framework/signator/Signator.java b/src/main/java/at/gv/egiz/pdfas/framework/signator/Signator.java deleted file mode 100644 index 073af4d..0000000 --- a/src/main/java/at/gv/egiz/pdfas/framework/signator/Signator.java +++ /dev/null @@ -1,71 +0,0 @@ -/** - * 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: Signator.java,v 1.1 2006/08/25 17:07:21 wprinz Exp $ - */ -package at.gv.egiz.pdfas.framework.signator; - -import at.gv.egiz.pdfas.api.timestamp.TimeStamper; -import at.gv.egiz.pdfas.exceptions.framework.SignatorException; -import at.gv.egiz.pdfas.framework.input.PdfDataSource; -import at.gv.egiz.pdfas.framework.output.DataSink; -import at.knowcenter.wag.egov.egiz.PdfASID; -import at.knowcenter.wag.egov.egiz.pdf.TablePos; - -/** - * The basic interface for signator algorithms. - * - * @author wprinz - */ -public interface Signator -{ - /** - * Returns the PdfASID of this Connector. - * - *

- * This should always return the MY_ID static field of the connector. Dont't - * forget to override this. - *

- *

- * Within connector code always use this method so that code reuse through - * derivation can take place correctly. - *

- * - * @return Returns the PdfASID of this Connector. - */ - public PdfASID getMyId(); - - /** - * Suppies encoding for text extraction - * @return - */ - public String getEncoding(); - - // dferbas no more has_SIG_ID - - public SignatorInformation prepareSign(PdfDataSource pdfDataSource, - String profile, TablePos pos, TimeStamper timestamper) throws SignatorException; - - - public void finishSign(SignatorInformation signatorInformation, DataSink dataSink) throws SignatorException; -} diff --git a/src/main/java/at/gv/egiz/pdfas/framework/signator/SignatorInformation.java b/src/main/java/at/gv/egiz/pdfas/framework/signator/SignatorInformation.java deleted file mode 100644 index f9efcbe..0000000 --- a/src/main/java/at/gv/egiz/pdfas/framework/signator/SignatorInformation.java +++ /dev/null @@ -1,99 +0,0 @@ -/** - * 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. - */ -package at.gv.egiz.pdfas.framework.signator; - -import java.util.List; - -import at.gv.egiz.pdfas.api.analyze.NonTextObjectInfo; -import at.knowcenter.wag.egov.egiz.pdf.ActualTablePos; -import at.knowcenter.wag.egov.egiz.sig.SignatureData; -import at.knowcenter.wag.egov.egiz.sig.connectors.bku.SignSignatureObject; - -/** - * Encapsulates the Signator dependant information that needs to be passed from - * prepareSign to finishSign. - * - *

- * This supersedes the IncrementalUpdateInformation. - *

- * - * @author wprinz - */ -public interface SignatorInformation -{ - /** - * Returns the SignatureData to be signed. - *

- * This is passed on to the Connector and signature device for signing. - *

- * - * @return Returns the SignatureData to be signed. - */ - public SignatureData getSignatureData(); - - /** - * Sets the SignSignatureObject with the signature data. - * - *

- * This is called by the framework to provide the finishSign with the - * signature data. - *

- * - * @param signSignatureObject - * The SignSignatureObject. - */ - public void setSignSignatureObject(SignSignatureObject signSignatureObject); - - /** - * Returns the SignSignatureObject. - * - *

- * After signation, this is used by the framework/API to get additional - * information about the signature. - *

- * - * @return Returns the SignSignatureObject. - */ - public SignSignatureObject getSignSignatureObject(); - - /** - * Returns the position where the signature table was actually placed. - * - * @return Returns the position where the signature table was actually placed. - */ - public ActualTablePos getActualTablePos(); - - /** - * Returns a list<{@link NonTextObjectInfo} of non textual objects in the pdf document. - * Only available for textual signatures. Show this to the user who signed the textual content only! - * @return List<{@link NonTextObjectInfo} or null of not available (binary signature) - */ - public List getNonTextualObjects(); - - /** - * Set a list<{@link NonTextObjectInfo} of non textual objects in the pdf document. - * Only available for textual signatures. Show this to the user who signed the textual content only! - */ - public void setNonTextualObjects(List nonTextObjects); -} diff --git a/src/main/java/at/gv/egiz/pdfas/framework/verificator/Verificator.java b/src/main/java/at/gv/egiz/pdfas/framework/verificator/Verificator.java deleted file mode 100644 index 78d6a2a..0000000 --- a/src/main/java/at/gv/egiz/pdfas/framework/verificator/Verificator.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * 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: Verificator.java,v 1.1 2006/08/25 17:07:21 wprinz Exp $ - */ -package at.gv.egiz.pdfas.framework.verificator; - -import java.util.List; - -import at.gv.egiz.pdfas.framework.input.PdfDataSource; -import at.knowcenter.wag.egov.egiz.exceptions.PresentableException; -import at.knowcenter.wag.exactparser.parsing.results.FooterParseResult; - - -/** - * Given an Incremental Update Block and the corresponding PDF, a verificator - * extracts all Signatures of its type and returns them as valitatable - * SignatureHolders. - * - * @author wprinz - */ -public interface Verificator -{ - /** - * Parses the given document/Block for signatures of this type. - * - * @param pdf - * The whole pdf document. A Verificator must only access the - * document up to its given block (block.next_index) and must not - * modify any byte in the pdf array. - * @param block - * The incremental update block. - * @param start_of_whole_block - * The start of the incremental update block (the end of the previous - * block) - If 0, this is the first block (the original Document). - * @return Returns the List of SignatureHolder objects found for this block. - */ - public List parseBlock(PdfDataSource pdfDataSource, byte [] pdf, final FooterParseResult block, - int start_of_whole_block) throws PresentableException; - -} diff --git a/src/main/java/at/gv/egiz/pdfas/framework/vfilter/VerificationFilter.java b/src/main/java/at/gv/egiz/pdfas/framework/vfilter/VerificationFilter.java deleted file mode 100644 index 58422d2..0000000 --- a/src/main/java/at/gv/egiz/pdfas/framework/vfilter/VerificationFilter.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * 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. - */ -package at.gv.egiz.pdfas.framework.vfilter; - -import java.util.List; - -import at.gv.egiz.pdfas.exceptions.framework.VerificationFilterException; -import at.gv.egiz.pdfas.framework.input.PdfDataSource; -import at.gv.egiz.pdfas.framework.input.TextDataSource; - -/** - * Extracts all signatures from a given PDF document or text. - * - * @see VerificationFilterParameters - * - * @author wprinz - */ -public interface VerificationFilter -{ - - /** - * Extracts the signatures from the given PDF. - * - * @param pdf - * The PDF. - * @param blocks - * The List of Incremental Update blocks. Usually this comes from a - * preprocessing step. - * @param parameters - * The algorithm parameters. - * @return Returns a List of SignatureHolders containing the signatures. May - * be empty in case no signatures have been found. - * @throws VerificationFilterException - * Thrown if something goes wrong. - */ - public List extractSignatureHolders(PdfDataSource pdf, List blocks, VerificationFilterParameters parameters) throws VerificationFilterException; - - /** - * Extracts the text signatures from the given free-text. - * - * @param text - * The free-text. - * @param parameters - * The algorithm parameters. - * @return Returns a List of SignatureHolders containing the signatures. May - * be empty in case no signatures have been found. - * @throws VerificationFilterException - * Thrown if something goes wrong. - */ - public List extractSignaturHolders(TextDataSource text, VerificationFilterParameters parameters) throws VerificationFilterException; -} diff --git a/src/main/java/at/gv/egiz/pdfas/framework/vfilter/VerificationFilterParameters.java b/src/main/java/at/gv/egiz/pdfas/framework/vfilter/VerificationFilterParameters.java deleted file mode 100644 index cf99086..0000000 --- a/src/main/java/at/gv/egiz/pdfas/framework/vfilter/VerificationFilterParameters.java +++ /dev/null @@ -1,105 +0,0 @@ -/** - * 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. - */ -package at.gv.egiz.pdfas.framework.vfilter; - -/** - * The parameters of the VerificationFilter algorithm. - * - * @author wprinz - */ -public interface VerificationFilterParameters -{ - - /** - * Tells the VerificationFilter to extract binary signatures only. - * - *

- * Not scanning for textual signatures allows the algorithm to skip text - * extraction and signature extraction, which are both time and memory - * intensive processes. - *

- * - * @return Returns true if the VerificationFilter should extract binary - * signatures only. - */ - public boolean extractBinarySignaturesOnly(); - - /** - * Tells the VerificationFilter to assume that there are only singatures (and - * their Incremental Update blocks) younger than the original document. - * - *

- * This is equivalent to saying that the document was not updated using an - * Incremental update block other than a signature after being singed. The - * incremental update blocks after the original document contain only - * signatures (either text or binary). - *

- *

- * This is equivalent to saying that there exists no Incremental Update block - * that would render a text signature before it invalid. - *

- *

- * Under this assumption, the process of finding all text signatures - * simplifies to one text extraction of the whole document and one signature - * extraction. This is of course a massive performance gain. - *

- *

- * Actually the algorithm performs a text extraction of the whole document not - * including trailing binary signature Incremental Update blocks. This means - * that if a the last n Incremental Update blocks of a document are binary, - * there is no use extract text from them. - *

- *

- * Note that if there are Incremental Update blocks with text after a - * signature thus this assumption does not hold the signatures older than this - * block will break. - *

- * - * @return Returns true if the Verification filter should assume that there - * are only signature blocks after the original document. - */ - public boolean assumeOnlySignatureUpdateBlocks(); - - /** - * Tells the VerificationFilter so scan for old signatures in the rest text. - * - *

- * The rest text is the text of the oldest text signature or the original - * document text if there is no text signature. - *

- * - * @return Returns true if the VerificationFilter should scan for old text - * signatures in the rest text. - */ - public boolean scanForOldSignatures(); - - /** - * Return value that tell if the document has been corrected before verification. - * - * @return - */ - public boolean hasBeenCorrected(); - - public void setBeenCorrected(boolean corrected); -} -- cgit v1.2.3