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 --- src/main/java/at/gv/egiz/pdfas/api/PdfAs.java | 285 --------------- .../egiz/pdfas/api/analyze/AnalyzeParameters.java | 107 ------ .../gv/egiz/pdfas/api/analyze/AnalyzeResult.java | 63 ---- .../egiz/pdfas/api/analyze/NonTextObjectInfo.java | 99 ------ .../at/gv/egiz/pdfas/api/commons/Constants.java | 185 ---------- .../api/commons/DynamicSignatureLifetimeEnum.java | 72 ---- .../pdfas/api/commons/DynamicSignatureProfile.java | 125 ------- .../api/commons/DynamicSignatureProfileImpl.java | 215 ----------- .../pdfas/api/commons/SignatureInformation.java | 129 ------- .../egiz/pdfas/api/commons/SignatureProfile.java | 76 ---- .../pdfas/api/exceptions/ConfigUtilsException.java | 122 ------- .../egiz/pdfas/api/exceptions/PdfAsException.java | 98 ----- .../gv/egiz/pdfas/api/internal/LocalBKUParams.java | 64 ---- .../gv/egiz/pdfas/api/internal/PdfAsInternal.java | 163 --------- .../gv/egiz/pdfas/api/internal/SignatureEntry.java | 137 ------- .../java/at/gv/egiz/pdfas/api/io/DataSink.java | 98 ----- .../java/at/gv/egiz/pdfas/api/io/DataSource.java | 94 ----- .../java/at/gv/egiz/pdfas/api/io/FileBased.java | 51 --- .../java/at/gv/egiz/pdfas/api/io/TextBased.java | 50 --- .../at/gv/egiz/pdfas/api/sign/SignParameters.java | 393 --------------------- .../java/at/gv/egiz/pdfas/api/sign/SignResult.java | 84 ----- .../pdfas/api/sign/SignatureDetailInformation.java | 147 -------- .../egiz/pdfas/api/sign/pos/SignaturePosition.java | 72 ---- .../pdfas/api/sign/pos/SignaturePositioning.java | 296 ---------------- .../api/sign/pos/axis/AbsoluteAxisAlgorithm.java | 62 ---- .../pdfas/api/sign/pos/axis/AutoAxisAlgorithm.java | 41 --- .../pdfas/api/sign/pos/axis/AxisAlgorithm.java | 41 --- .../api/sign/pos/page/AbsolutePageAlgorithm.java | 64 ---- .../pdfas/api/sign/pos/page/AutoPageAlgorithm.java | 47 --- .../pdfas/api/sign/pos/page/NewPageAlgorithm.java | 41 --- .../pdfas/api/sign/pos/page/PageAlgorithm.java | 41 --- .../egiz/pdfas/api/timestamp/DummyTimeStamper.java | 62 ---- .../gv/egiz/pdfas/api/timestamp/TimeStamper.java | 41 --- .../gv/egiz/pdfas/api/verify/SignatureCheck.java | 51 --- .../api/verify/VerifyAfterAnalysisParameters.java | 166 --------- .../VerifyAfterReconstructXMLDsigParameters.java | 169 --------- .../gv/egiz/pdfas/api/verify/VerifyParameters.java | 249 ------------- .../at/gv/egiz/pdfas/api/verify/VerifyResult.java | 179 ---------- .../at/gv/egiz/pdfas/api/verify/VerifyResults.java | 48 --- .../api/xmldsig/ExtendedSignatureInformation.java | 69 ---- .../ReconstructXMLDsigAfterAnalysisParameters.java | 86 ----- .../api/xmldsig/ReconstructXMLDsigParameters.java | 218 ------------ .../api/xmldsig/ReconstructXMLDsigResult.java | 74 ---- .../at/gv/egiz/pdfas/api/xmldsig/XMLDsigData.java | 83 ----- 44 files changed, 5057 deletions(-) delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/PdfAs.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/analyze/AnalyzeParameters.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/analyze/AnalyzeResult.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/analyze/NonTextObjectInfo.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/commons/Constants.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/commons/DynamicSignatureLifetimeEnum.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/commons/DynamicSignatureProfile.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/commons/DynamicSignatureProfileImpl.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/commons/SignatureInformation.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/commons/SignatureProfile.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/exceptions/ConfigUtilsException.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/exceptions/PdfAsException.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/internal/LocalBKUParams.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/internal/PdfAsInternal.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/internal/SignatureEntry.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/io/DataSink.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/io/DataSource.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/io/FileBased.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/io/TextBased.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/sign/SignParameters.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/sign/SignResult.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/sign/SignatureDetailInformation.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/sign/pos/SignaturePosition.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/sign/pos/SignaturePositioning.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/sign/pos/axis/AbsoluteAxisAlgorithm.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/sign/pos/axis/AutoAxisAlgorithm.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/sign/pos/axis/AxisAlgorithm.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/sign/pos/page/AbsolutePageAlgorithm.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/sign/pos/page/AutoPageAlgorithm.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/sign/pos/page/NewPageAlgorithm.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/sign/pos/page/PageAlgorithm.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/timestamp/DummyTimeStamper.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/timestamp/TimeStamper.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/verify/SignatureCheck.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/verify/VerifyAfterAnalysisParameters.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/verify/VerifyAfterReconstructXMLDsigParameters.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/verify/VerifyParameters.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResult.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResults.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/xmldsig/ExtendedSignatureInformation.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/xmldsig/ReconstructXMLDsigAfterAnalysisParameters.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/xmldsig/ReconstructXMLDsigParameters.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/xmldsig/ReconstructXMLDsigResult.java delete mode 100644 src/main/java/at/gv/egiz/pdfas/api/xmldsig/XMLDsigData.java (limited to 'src/main/java/at/gv/egiz/pdfas/api') diff --git a/src/main/java/at/gv/egiz/pdfas/api/PdfAs.java b/src/main/java/at/gv/egiz/pdfas/api/PdfAs.java deleted file mode 100644 index 3fda87c..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/PdfAs.java +++ /dev/null @@ -1,285 +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.api; - -import java.util.List; - -import at.gv.egiz.pdfas.api.analyze.AnalyzeParameters; -import at.gv.egiz.pdfas.api.analyze.AnalyzeResult; -import at.gv.egiz.pdfas.api.commons.DynamicSignatureLifetimeEnum; -import at.gv.egiz.pdfas.api.commons.DynamicSignatureProfile; -import at.gv.egiz.pdfas.api.commons.SignatureProfile; -import at.gv.egiz.pdfas.api.exceptions.PdfAsException; -import at.gv.egiz.pdfas.api.sign.SignParameters; -import at.gv.egiz.pdfas.api.sign.SignResult; -import at.gv.egiz.pdfas.api.sign.SignatureDetailInformation; -import at.gv.egiz.pdfas.api.verify.VerifyAfterAnalysisParameters; -import at.gv.egiz.pdfas.api.verify.VerifyAfterReconstructXMLDsigParameters; -import at.gv.egiz.pdfas.api.verify.VerifyParameters; -import at.gv.egiz.pdfas.api.verify.VerifyResult; -import at.gv.egiz.pdfas.api.verify.VerifyResults; -import at.gv.egiz.pdfas.api.xmldsig.ReconstructXMLDsigAfterAnalysisParameters; -import at.gv.egiz.pdfas.api.xmldsig.ReconstructXMLDsigParameters; -import at.gv.egiz.pdfas.api.xmldsig.ReconstructXMLDsigResult; -import at.gv.egiz.pdfas.framework.signator.SignatorInformation; - -/** - * The PDF-AS API main interface. - * - *

- * Create an Object implementing this interface using the proper factory. - *

- * - * @author wprinz - * @author exthex - */ -public interface PdfAs -{ -// 23.11.2010 changed by exthex - added: -// reconstructXMLDSIG(ReconstructXMLDsigParameters reconstructXMLDsigParameters) -// reconstructXMLDSIG(ReconstructXMLDsigAfterAnalysisParameters reconstructXMLDsigParameters) -// verify(VerifyAfterReconstructXMLDsigParameters verifyAfterReconstructXMLDsigParameters) - -// 16.12.2010 changed by exthex - added: -// prepareSign(SignParameters signParameters) -// sign(SignParameters signParameters, SignatureDetailInformation signatureDetailInformation) -// finishSign(SignParameters signParameters, SignatureDetailInformation signatureDetailInformation) - - /** - * Signs a PDF document using PDF-AS. - * - * @param signParameters - * The sign parameters. - * @return Returns the signed document plus additional information. - * @throws PdfAsException - * Thrown, if an error occurs. - * - * @see SignParameters - * @see SignResult - */ - public SignResult sign(SignParameters signParameters) throws PdfAsException; - - /** - * Signs a PDF document using PDF-AS.
- * This uses the {@link SignatorInformation} which was obtained by a call to {@link PdfAs#prepareSign(SignParameters)} - * - * @param signParameters - * The sign parameters. - * @param signatureDetailInformation - * The signature information which was previously obtained by a call to {@link PdfAs#prepareSign(SignParameters)} - * @return Returns the signed document plus additional information. - * @throws PdfAsException - * Thrown, if an error occurs. - * - * @see SignParameters - * @see SignResult - */ - public SignResult sign(SignParameters signParameters, SignatureDetailInformation signatureDetailInformation) throws PdfAsException; - - /** - * Verifies a document with (potentially multiple) PDF-AS signatures. - * - * @param verifyParameters - * The verify parameters. - * @return Returns the verification results. - * @throws PdfAsException - * Thrown, if an error occurs. - * - * @see VerifyParameters - * @see VerifyResults - * @see VerifyResult - */ - public VerifyResults verify(VerifyParameters verifyParameters) throws PdfAsException; - - /** - * Analyzes a document for signatures and returns a verify-able list of such. - * - * @param analyzeParameters - * The analyzation parameters. - * @return Returns a list of verify-able signatures that were found in the - * document. - * @throws PdfAsException - * Thrown on error. - * - * @see AnalyzeParameters - * @see AnalyzeResult - * @see {@link #verify(AnalyzeResult)} - */ - public AnalyzeResult analyze(AnalyzeParameters analyzeParameters) throws PdfAsException; - - /** - * Reconstruct the from the given parameters. - * - * @param reconstructXMLDsigParameters - * The data from which to reconstruct the xmldsig - * @return a list of xmldsigs, one for each signature in the document - * @throws PdfAsException if the reconstruction fails - */ - public ReconstructXMLDsigResult reconstructXMLDSIG(ReconstructXMLDsigParameters reconstructXMLDsigParameters) throws PdfAsException; - - /** - * Reconstruct the from the given parameters. - * - * @param reconstructXMLDsigParameters - * The data from which to reconstruct the xmldsigs - * @return a list of xmldsigs, one for each signature in the document - * @throws PdfAsException - */ - public ReconstructXMLDsigResult reconstructXMLDSIG(ReconstructXMLDsigAfterAnalysisParameters reconstructXMLDsigParameters) throws PdfAsException; - - /** - * Verifies a list of signatures that have been analyzed previously. - * - * @param verifyAfterAnalysisParameters The parameters. - * - * @return Returns the verification results. - * @throws PdfAsException - * Thrown on error. - * - * @see AnalyzeResult - * @see VerifyAfterAnalysisParameters - * @see VerifyResults - * @see VerifyResult - * @see {@link #analyze(AnalyzeParameters)} - */ - public VerifyResults verify(VerifyAfterAnalysisParameters verifyAfterAnalysisParameters) throws PdfAsException; - - /** - * Verifies a list of signatures that have been analyzed previously and the xmldsigs have been reconstructed. - * - * @param verifyAfterReconstructXMLDsigParameters - * The parameters. - * @return the verification results. - * @throws PdfAsException - * Thrown on error. - */ - public VerifyResults verify(VerifyAfterReconstructXMLDsigParameters verifyAfterReconstructXMLDsigParameters) throws PdfAsException; - - /** - * Reloads the configuration from the work directory. - * - * @throws PdfAsException - * Thrown, if an error occurs. - */ - public void reloadConfig() throws PdfAsException; - - /** - * Returns the list of information objects about activated profiles available in the - * configuration. - * - *

- * Note: Currently the profile information consists of the profile Id and the - * MOA Key Id only. - *

- *

- * Note: In near future the profile management will be moved out of the config - * file into an API class representation of the profiles which may render this - * (and related) methods obsolete. - *

- * - * @return Returns the list of {@link SignatureProfile} objects with - * information about active profiles available in the configuration. - * @throws PdfAsException - * Thrown on error. - * - * @see SignatureProfile - */ - public List getProfileInformation() throws PdfAsException; - - /** - * Create a signature profile dynamically. You have do apply() it for usage. See {@link SignatureProfile}. - * @param parentProfile a parent profile id to inherit all properties - * @param mode lifetime mode - * @return the created signature profile to work with. - */ - public DynamicSignatureProfile createDynamicSignatureProfile(String parentProfile, DynamicSignatureLifetimeEnum mode); - - /** - * Create a signature profile dynamically. You have to provide a unique name and have do apply() it for usage. See {@link SignatureProfile}. - * It is recommended to use {@link #createDynamicSignatureProfile(String, DynamicSignatureLifetimeEnum)} that generates - * a unique name on its own. - * @see DynamicSignatureProfile - * @param parentProfile a parent profile id to inherit all properties - * @param myUniqueName a unique name for the profile - * @param mode lifetime mode - * @return the created signature profile to work with. - */ - public DynamicSignatureProfile createDynamicSignatureProfile(String myUniqueName, String parentProfile, DynamicSignatureLifetimeEnum mode); - - /** - * Create a signature profile dynamically. You have fill it with properties and apply() it for usage. See {@link SignatureProfile}. - *
- * It is recommended to use {@link #createDynamicSignatureProfile(String, DynamicSignatureLifetimeEnum)} that inherits from an - * existing profile saving you a lot of work. - * @param mode lifetime mode - * @return the created signature profile to work with. - * @see DynamicSignatureProfile - */ - public DynamicSignatureProfile createEmptyDynamicSignatureProfile(DynamicSignatureLifetimeEnum mode); - - /** - * Create a signature profile dynamically. You have fill it with properties and apply() it for usage. See {@link SignatureProfile}. - *
- * It is recommended to use {@link #createDynamicSignatureProfile(String, DynamicSignatureLifetimeEnum)} that inherits from an - * existing profile saving you a lot of work. - * @param myUniqueName a unique name for the profile - * @param mode lifetime mode - * @return the created signature profile to work with. - */ - public DynamicSignatureProfile createEmptyDynamicSignatureProfile(String myUniqueName, DynamicSignatureLifetimeEnum mode); - - /** - * Loads an existing dynamic signature profile by its name. Profiles are saved when they are applied - * and it has {@link DynamicSignatureLifetimeEnum#MANUAL} - * @param profileName - * @return the signature profile or null if not found. - * @see DynamicSignatureProfile - */ - public DynamicSignatureProfile loadDynamicSignatureProfile(String profileName); - - /** - * Prepares the signature of the given PDF document. The table for the signature data is placed but not filled.
- * Usually used for preview. - * - * @param signParameters - * The sign parameters. - * @return Only the {@link SignatureDetailInformation#getSignaturePosition()}, {@link SignatureDetailInformation#getNonTextualObjects()}, {@link SignatureDetailInformation#getSignatureData()} are filled. - * @throws PdfAsException if something goes wrong during the process - */ - public SignatureDetailInformation prepareSign(SignParameters signParameters) throws PdfAsException; - - /** - * Finish the signature process. The PDF is filled with the signature data.
- * Usually used if some steps like the actual signing are to be performed externally. - * - * @param signParameters - * The sign parameters. - * @param signatureDetailInformation - * The signature detail information. - * @return - * @throws PdfAsException - */ - public SignResult finishSign(SignParameters signParameters, SignatureDetailInformation signatureDetailInformation) throws PdfAsException; - -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/analyze/AnalyzeParameters.java b/src/main/java/at/gv/egiz/pdfas/api/analyze/AnalyzeParameters.java deleted file mode 100644 index 1ce7057..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/analyze/AnalyzeParameters.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.api.analyze; - -import at.gv.egiz.pdfas.api.commons.Constants; -import at.gv.egiz.pdfas.api.io.DataSource; - -/** - * Parameter object that holds the analyze parameters. - * - * @author wprinz - */ -public class AnalyzeParameters -{ - - /** - * The document to be analyzed. - */ - protected DataSource document = null; - - /** - * The mode of operation how the document is analyzed. - * - *

- * May be {@link Constants#VERIFY_MODE_BINARY_ONLY} to check the document for - * binary signatures only (very fast). Or may be - * {@link Constants#VERIFY_MODE_SEMI_CONSERVATIVE} to perform a semi - * conservative (optimized) text and binary verification (slow). Or may be - * {@link Constants#VERIFY_MODE_FULL_CONSERVATIVE} to perform a full - * conservative text and binary verification (very slow). - *

- */ - protected String verifyMode = Constants.VERIFY_MODE_FULL_CONSERVATIVE; - - protected boolean returnNonTextualObjects = false; - - protected boolean hasBeenCorrected = false; - - /** - * @return the document - */ - public DataSource getDocument() - { - return this.document; - } - - /** - * @param document the document to set - */ - public void setDocument(DataSource document) - { - this.document = document; - } - - /** - * @return the verifyMode - */ - public String getVerifyMode() - { - return this.verifyMode; - } - - /** - * @param verifyMode the verifyMode to set - */ - public void setVerifyMode(String verifyMode) - { - this.verifyMode = verifyMode; - } - - public boolean isReturnNonTextualObjects() { - return this.returnNonTextualObjects; - } - - /** - * Tells if non text object of the signed pdf should be extracted and returned. - * One should show this to the user, especially in case of textual signature. - * Defaults to false - * - * @param returnNonTextualObjects - */ - public void setReturnNonTextualObjects(boolean returnNonTextualObjects) { - this.returnNonTextualObjects = returnNonTextualObjects; - } - -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/analyze/AnalyzeResult.java b/src/main/java/at/gv/egiz/pdfas/api/analyze/AnalyzeResult.java deleted file mode 100644 index 9b913ae..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/analyze/AnalyzeResult.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.api.analyze; - -import java.util.List; - -import at.gv.egiz.pdfas.api.commons.SignatureInformation; -import at.gv.egiz.pdfas.api.exceptions.PdfAsException; - -/** - * The result of an analyze operation, which is a list of verifyable signatures. - * - * @author wprinz - * - */ -public interface AnalyzeResult -{ - /** - * Returns the list of found signatures. - * - * @return Returns a list of {@link SignatureInformation} objects representing all - * found signatures. - * @throws PdfAsException - * Thrown on error. - * - * @see SignatureInformation - */ - public List getSignatures() throws PdfAsException; - - public List getNoSignatures(); - - /** - * Tells if the document has been corrected before verification. The correction maybe done - * after a first failing parse to repair a document (if enabled in the configuration - * correct_document_on_verify_if_necessary). The correction can only work for textual - * signatures. Binary signatures are lost anyhow. - * @return - */ - public boolean hasBeenCorrected(); - - -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/analyze/NonTextObjectInfo.java b/src/main/java/at/gv/egiz/pdfas/api/analyze/NonTextObjectInfo.java deleted file mode 100644 index 08297b7..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/analyze/NonTextObjectInfo.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.api.analyze; - -/** - * Encapsulates information about non textual objects in a pdf document. - * - * @author dferbas - * - */ -public class NonTextObjectInfo { - public static final String TYPE_IMAGE = "image"; - public static final String TYPE_ANNOTATION = "annotation"; - - private String objectType; - private String subType; - private String name; - private int pageNr; - private double width; - private double height; - - public String getObjectType() { - return this.objectType; - } - - public void setObjectType(String objectType) { - this.objectType = objectType; - } - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.name = name; - } - - public int getPageNr() { - return this.pageNr; - } - - public void setPageNr(int pageNr) { - this.pageNr = pageNr; - } - - public double getWidth() { - return this.width; - } - - public void setWidth(double width) { - this.width = width; - } - - public double getHeight() { - return this.height; - } - - public void setHeight(double height) { - this.height = height; - } - - public String getSubType() { - return this.subType; - } - - public void setSubType(String subType) { - this.subType = subType; - } - - - - public String toString() { - return "NonTextObjectInfo [height=" + this.height + ", name=" + this.name + ", objectType=" - + this.objectType + ", pageNr=" + this.pageNr + ", subType=" + this.subType - + ", width=" + this.width + "]"; - } - -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/commons/Constants.java b/src/main/java/at/gv/egiz/pdfas/api/commons/Constants.java deleted file mode 100644 index b351d50..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/commons/Constants.java +++ /dev/null @@ -1,185 +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.api.commons; - -import at.knowcenter.wag.egov.egiz.pdf.AdobeSignatureHelper; - -/** - * Contains commonly used constants. - * - * @author wprinz - */ -public final class Constants -{ - - /** - * Hidden default constructor. - */ - private Constants() - { - // empty - } - - /** - * A binary signature. - * This value should not be modified due to external dependencies! - */ - public static final String SIGNATURE_TYPE_BINARY = "binary"; - - /** - * A textual signature. - * This value should not be modified due to external dependencies! - */ - public static final String SIGNATURE_TYPE_TEXTUAL = "textual"; - - /** - * The default signature type (one of "textual", "binary", "detachedtextual"). - */ - public static final String DEFAULT_SIGNATURE_TYPE = SIGNATURE_TYPE_BINARY; - - /** - * A "detached" textual signature. - * - *

- * The document text is signed, but instead of returning the pdf with the signature block, - * the sign result XML of the connector is returned. - *

- */ - public static final String SIGNATURE_TYPE_DETACHEDTEXTUAL = "detachedtextual"; - - /** - * The signature device moa. - * This value should not be modified due to external dependencies! - */ - public static final String SIGNATURE_DEVICE_MOA = "moa"; - - /** - * The signature device bku. - * This value should not be modified due to external dependencies! - */ - public static final String SIGNATURE_DEVICE_BKU = "bku"; - - /** - * The signature device a1. - * This value should not be modified due to external dependencies! - */ - public static final String SIGNATURE_DEVICE_A1 = "a1"; - - /** - * The signature device MOCCA (online bku). - * This value should not be modified due to external dependencies! - */ - public static final String SIGNATURE_DEVICE_MOC = "moc"; - - /** - * Added by rpiazzi - * The signature device MOBILE. - * This value should not be modified due to external dependencies! - */ - public static final String SIGNATURE_DEVICE_MOBILE = "mobile"; - - /** - * Added by rpiazzi - * The signature device MOBILETEST for the test version of the MOBILE CCS. - * This value should not be modified due to external dependencies! - */ - public static final String SIGNATURE_DEVICE_MOBILETEST = "mobiletest"; - - /** - * Only binary signatures are verified. - */ - public static final String VERIFY_MODE_BINARY_ONLY = "binaryOnly"; - - /** - * Binary and textual signatures are verified with time optimization. - * - *

- * This mode of operation tries to minimize the numbers of text extractions, - * which are very time intensive, at the cost of some rare cases, in which some - * signatures may not be found. - *

- */ - public static final String VERIFY_MODE_SEMI_CONSERVATIVE = "semiConservative"; - - /** - * Binary and textual signatures are verified. - */ - public static final String VERIFY_MODE_FULL_CONSERVATIVE = "fullConservative"; - - /** - * All signatures are verified. - */ - public static final int VERIFY_ALL = -1; - - /** - * The system property that may be used to declare the pdf-as configuration folder. - */ - public static final String CONFIG_DIR_SYSTEM_PROPERTY = "pdf-as.work-dir"; - - /** - * The zip file containing the default configuration. - */ - public static final String DEFAULT_CONFIGURATION_ZIP_RESOURCE = "DefaultConfiguration.zip"; - - /** - * The configuration folder for pdf-as within the user's home folder. - */ - public static final String USERHOME_CONFIG_FOLDER = "PDF-AS"; - - /** - * The name of the directory, where temporary files are stored. - */ - public static final String TEMP_DIR_NAME = "pdfastmp"; - - public static final String BKU_HEADER_SIGNATURE_LAYOUT = "SignatureLayout"; - - public static final String ADOBE_SIG_FILTER = AdobeSignatureHelper.ADOBE_SIG_FILTER; - - /** - * Strict matching mode for placeholder extraction.
- * If the placeholder with the given id is not found in the document, an exception will be thrown. - */ - public static final int PLACEHOLDER_MATCH_MODE_STRICT = 0; - - /** - * A moderate matching mode for placeholder extraction.
- * If the placeholder with the given id is not found in the document, the first placeholder without an id will be taken.
- * If there is no such placeholder, the signature will be placed as usual, according to the pos parameter of the signature profile used. - */ - public static final int PLACEHOLDER_MATCH_MODE_MODERATE = 1; - - /** - * A more lenient matching mode for placeholder extraction.
- * If the placeholder with the given id is not found in the document, the first found placeholder will be taken, regardless if it has an id set, or not.
- * If there is no placeholder at all, the signature will be placed as usual, according to the pos parameter of the signature profile used. - */ - public static final int PLACEHOLDER_MATCH_MODE_LENIENT = 2; - - /** - * Identifier for QR based placeholders. - */ - public static final String QR_PLACEHOLDER_IDENTIFIER = "PDF-AS-POS"; - -} - diff --git a/src/main/java/at/gv/egiz/pdfas/api/commons/DynamicSignatureLifetimeEnum.java b/src/main/java/at/gv/egiz/pdfas/api/commons/DynamicSignatureLifetimeEnum.java deleted file mode 100644 index 7b3d17b..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/commons/DynamicSignatureLifetimeEnum.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.api.commons; - -import java.io.Serializable; - -/** - * Pseudo enum defining lifetime models for {@link DynamicSignatureProfile}s. - * - * @author exthex - * - */ -public final class DynamicSignatureLifetimeEnum implements Serializable { - private static final long serialVersionUID = 1L; - - private int value; - - /** - * Automatic lifetime bound to one sign process - */ - public static final DynamicSignatureLifetimeEnum AUTO = new DynamicSignatureLifetimeEnum(1); - - /** - * Manual lifetime making YOU responsible for calling {@link DynamicSignatureProfile#dispose()}. - */ - public static final DynamicSignatureLifetimeEnum MANUAL = new DynamicSignatureLifetimeEnum(2); - - private DynamicSignatureLifetimeEnum(int val) { - this.value = val; - } - - public int hashCode() { - return value; - } - - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - DynamicSignatureLifetimeEnum other = (DynamicSignatureLifetimeEnum) obj; - if (value != other.value) - return false; - return true; - } - - - -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/commons/DynamicSignatureProfile.java b/src/main/java/at/gv/egiz/pdfas/api/commons/DynamicSignatureProfile.java deleted file mode 100644 index 7418f4d..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/commons/DynamicSignatureProfile.java +++ /dev/null @@ -1,125 +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.api.commons; - -import at.gv.egiz.pdfas.api.PdfAs; -import at.gv.egiz.pdfas.api.sign.SignParameters; - -/** - * A dynamic signature profile. It is used to define a signature profile like the ones from pdf-as/config.properties at runtime. - * After creation via {@link PdfAs} you can set properties via {@link #setPropertyRaw(String, String)} - * or {@link #setFieldValue(String, String)}.
- * You have to call {@link #apply()} to use the profile. The identifying name (e.g. for {@link SignParameters#setSignatureProfileId(String)} - * can be obtained via {@link #getName()}.
- * Depending on the {@link DynamicSignatureLifetimeEnum} the profile can be alive and usable till you {@link #dispose()} it manually. - *

- * Sample usage:
- *

-      SignParameters sp = new SignParameters();
-      . . .           
-      sp.setSignatureType(Constants.SIGNATURE_TYPE_TEXTUAL);
-      sp.setSignatureDevice(Constants.SIGNATURE_DEVICE_MOA);
-
-      // create a new dynamic profile based on SIGNATURBLOCK_DE (every property is copied) with manual lifetime
-      DynamicSignatureProfile dsp = pdfAs.createDynamicSignatureProfile("myUniqueName", "SIGNATURBLOCK_DE", 
-            DynamicSignatureLifetimeEnum.MANUAL);  
-            
-      // set something
-      dsp.setPropertyRaw("key.SIG_META", "Statement");
-      dsp.setPropertyRaw("value.SIG_META", "respect to the man in the icecream van ${subject.EMAIL}");
-      dsp.setPropertyRaw("value.SIG_LABEL", "./images/signatur-logo_en.png");
-      dsp.setPropertyRaw("table.main.Style.halign", "right");
-      
-      // mandatory: apply the profile, you have to apply again after changes (overriding your previous setting)
-      dsp.apply();                 
-      sp.setSignatureProfileId(dsp.getName());            
-      
-      // execute PDF-AS
-      pdfAs.sign(sp);              
-      
-      . . .
-                       
-     // your profile is saved and you can obtain it again anytime later:
-      dsp = pdfAs.loadDynamicSignatureProfile("myUniqueName");
-      // use it for another sign.
-      // dont forget to dispose() sometimes because it was manual lifetime
-      System.out.println(dsp.getName());
- *  
- *

- * - * @author exthex - * - */ -public interface DynamicSignatureProfile { - - /** - * Get the name of the dynamic signature profile. Equals the SignatureProfileId - * @return - */ - public abstract String getName(); - - /** - * Set a field value for the profile. Use {@link #setPropertyRaw(String, String)} for setting any property.
- * For example to set sig_obj.MEIN_DYN_SIGNATURBLOCK.value.SIG_META just use SIG_META as fieldName. - * @param fieldName the name of the field - * @param value the value to set - */ - public abstract void setFieldValue(String fieldName, String value); - - /** - * Get a field value from the profile. See {@link #setFieldValue(String, String)} - * @param fieldName - * @return - */ - public abstract String getFieldValue(String fieldName); - - /** - * Set any property for the signature profile. - * Uses the same keys as the property file without the "prefix" for the profile. - * For example to set sig_obj.MEIN_DYN_SIGNATURBLOCK.key.SIG_META use key.SIG_META - * @param key property key - * @param val property value - */ - public void setPropertyRaw(String key, String val); - - /** - * Get any property from the signature profile. See {@link #setPropertyRaw(String, String)} for details. - * @param key - * @return - */ - public String getPropertyRaw(String key); - - /** - * Apply the signature profile. Call this after all properties are set and you want to use the profile. It is then added - * to the globally available signature profiles. Depending on the lifetime model {@link DynamicSignatureLifetimeEnum} you - * have to {@link #dispose()} it manually when not needed anymore. - */ - public abstract void apply(); - - /** - * Disposes the signature profile from the global store. Call this for {@link DynamicSignatureLifetimeEnum#MANUAL} only. - */ - public abstract void dispose(); - -} \ No newline at end of file diff --git a/src/main/java/at/gv/egiz/pdfas/api/commons/DynamicSignatureProfileImpl.java b/src/main/java/at/gv/egiz/pdfas/api/commons/DynamicSignatureProfileImpl.java deleted file mode 100644 index 7e1672a..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/commons/DynamicSignatureProfileImpl.java +++ /dev/null @@ -1,215 +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.api.commons; - -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; - -import org.apache.commons.lang.StringUtils; - -import at.gv.egiz.pdfas.api.PdfAs; -import at.knowcenter.wag.egov.egiz.cfg.PropertyTree; -import at.knowcenter.wag.egov.egiz.cfg.SettingsReader; -import at.knowcenter.wag.egov.egiz.sig.SignatureTypes; - -// TODO exception types? -/** - * Implementation class of the {@link DynamicSignatureProfile}. Don't use this class directly. Use {@link PdfAs} to create and the - * {@link DynamicSignatureProfile} interface for manipulation. - * @author exthex - * - */ -public class DynamicSignatureProfileImpl implements DynamicSignatureProfile { - private String name; - private Properties newProps = new Properties(); - private int dynamicTypeCounter = 0; - private static Map profiles = new HashMap(); - private static ThreadLocal localProfiles = new ThreadLocal(); - private DynamicSignatureLifetimeEnum lifeMode; - - - private DynamicSignatureProfileImpl(DynamicSignatureLifetimeEnum mode, String name) { - if (name != null) { - this.name = name; - } else { - this.name = createDynamicTypeName(); - } - this.lifeMode = mode; - } - - public static DynamicSignatureProfileImpl createFromParent(String myUniqueName, String parentProfile, DynamicSignatureLifetimeEnum mode) { - DynamicSignatureProfileImpl res = new DynamicSignatureProfileImpl(mode, myUniqueName); - res.initFromParent(parentProfile); - return res; - } - - private void store() { - if (lifeMode.equals(DynamicSignatureLifetimeEnum.MANUAL)) { - profiles.put(this.getName(), this); - } else if (lifeMode.equals(DynamicSignatureLifetimeEnum.AUTO)) { - localProfiles.set(this); - } - } - - private void remove() { - if (lifeMode.equals(DynamicSignatureLifetimeEnum.MANUAL)) { - profiles.remove(this); - } else if (lifeMode.equals(DynamicSignatureLifetimeEnum.AUTO)) { - localProfiles.set(null); - } - } - - public static void disposeLocalProfile() { - DynamicSignatureProfileImpl profile = (DynamicSignatureProfileImpl) localProfiles.get(); - if (profile != null) { - profile.dispose(); - } - } - - public static DynamicSignatureProfileImpl createEmptyProfile(String myUniqueName, DynamicSignatureLifetimeEnum mode) { - return new DynamicSignatureProfileImpl(mode, myUniqueName); - } - - public static DynamicSignatureProfileImpl loadProfile(String name) { - return (DynamicSignatureProfileImpl) profiles.get(name); - } - - private synchronized String createDynamicTypeName() { - return "dynprofile__#" + this.dynamicTypeCounter++; - } - - /* (non-Javadoc) - * @see at.gv.egiz.pdfas.api.commons.DynamicSignatureProfile#getName() - */ - public String getName() { - return name; - } - - /* (non-Javadoc) - * @see at.gv.egiz.pdfas.api.commons.DynamicSignatureProfile#setName(String) - */ - public void setName(String uniqueName) { - this.name = uniqueName; - } - - public void setPropertyRaw(String key, String val) { - this.newProps.setProperty(localPropName(key), val); - } - - public String getPropertyRaw(String key) { - return this.newProps.getProperty(localPropName(key)); - } - - private void assertPropExists(String key) { - if (!this.newProps.containsKey(localPropName(key))) { - throw new RuntimeException("property '" + key + "'not existing, cannot add one"); - } - } - - private String localPropName(String key) { - return "sig_obj." + this.name + "." + key; - } - - /* (non-Javadoc) - * @see at.gv.egiz.pdfas.api.commons.DynamicSignatureProfile#setFieldValue(java.lang.String, java.lang.String) - */ - public void setFieldValue(String fieldName, String value) { - if (SignatureTypes.isRequredSigTypeKey(fieldName)) { - throw new RuntimeException("cannot set value for pre defined signature field names"); - } - - String key = "value." +fieldName; - assertPropExists(key); - setPropertyRaw(key, value); - } - - /* (non-Javadoc) - * @see at.gv.egiz.pdfas.api.commons.DynamicSignatureProfile#getFieldValue(java.lang.String) - */ - public String getFieldValue(String fieldName) { - return getPropertyRaw("value."+fieldName); - } - - private void initFromParent(String parentProfile) { - try { - SettingsReader cfg = null; - - cfg = SettingsReader.getInstance(); - - Properties props = cfg.getProperties(); - for (Enumeration e = props.keys(); e.hasMoreElements();) { - String oldKey = (String) e.nextElement(); - if (oldKey.startsWith("sig_obj." + parentProfile + ".")) { - String newKey = StringUtils.replace(oldKey, parentProfile, name); - String val = props.getProperty(oldKey); - this.newProps.put(newKey, val); - } - } - this.newProps.put("sig_obj.types." + name, "on"); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - /* (non-Javadoc) - * @see at.gv.egiz.pdfas.api.commons.DynamicSignatureProfile#register() - */ - public synchronized void apply() { - try { - SettingsReader settings = SettingsReader.getInstance(); - - settings.getProperties().putAll(this.newProps); - - for (Enumeration e = newProps.keys(); e.hasMoreElements();) { - String key = (String) e.nextElement(); - settings.getPTree().setKeyValue(key, newProps.getProperty(key)); - } - - SignatureTypes.getInstance().addSignatureType(this.name); - store(); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - /* (non-Javadoc) - * @see at.gv.egiz.pdfas.api.commons.DynamicSignatureProfile#dispose() - */ - public synchronized void dispose() { - try { - SettingsReader.getInstance().getProperties().keySet().removeAll(newProps.keySet()); - - PropertyTree root = SettingsReader.getInstance().getPTree(); - root.getSubTree("sig_obj").removeEntry(this.name); - - SignatureTypes.getInstance().removeSignatureType(this.name); - remove(); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/commons/SignatureInformation.java b/src/main/java/at/gv/egiz/pdfas/api/commons/SignatureInformation.java deleted file mode 100644 index 7315af6..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/commons/SignatureInformation.java +++ /dev/null @@ -1,129 +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: SignatureHolder.java,v 1.3 2006/10/11 07:57:58 wprinz Exp $ - */ -package at.gv.egiz.pdfas.api.commons; - -import java.security.cert.X509Certificate; -import java.util.Date; -import java.util.List; - -import at.gv.egiz.pdfas.api.analyze.NonTextObjectInfo; -import at.gv.egiz.pdfas.api.io.DataSource; - -/** - * Holds the information of one found signature block, which is the signed data - * and the corresponding signature information. - * - * @author wprinz - */ -public interface SignatureInformation -{ - /** - * Returns the type of this signature (binary/textual). - * - *

- * May be {@link Constants#SIGNATURE_TYPE_BINARY} or - * {@link Constants#SIGNATURE_TYPE_TEXTUAL}. - *

- * - * @return Returns the type of this signature (binary/textual). - */ - public String getSignatureType(); - - /** - * Returns the DataSource providing the data that was signed. - * - *

- * Note that this is the signed data as sent to the verification device by - * PDF-AS. The verification device (e.g. MOA) may perform several other - * transformations on the data before feeding it to the signature hash - * function. To get the actual hashed data use the ReturnHashInputData mechanism (which is very slow). - *

- * - * @return Returns the DataSource providing the data that was signed. - * - * @see at.gv.egiz.pdfas.api.verify.VerifyParameters#setReturnHashInputData(boolean) - * @see at.gv.egiz.pdfas.api.verify.VerifyResult#getHashInputData() - * - */ - public DataSource getSignedData(); - - /** - * Returns the certificate of the signer. - * - *

- * Information like subject name, issuer name or serial number can be - * retrieved form this certificate. - *

- * - * @return Returns the certificate of the signer. - */ - public X509Certificate getSignerCertificate(); - - /** - * Returns the signing time, which is the time when the signature was created. - * - * @return Returns the signing time, which is the time when the signature was - * created. - */ - public Date getSigningTime(); - - /** - * Returns additional, internal information about the found signature. - * - *

- * Note that this provides a way for developers to gather core information - * about the signature. What information is returned strongly depends on the - * core implementation. - *

- * - * @return Returns additional, internal information about the signature. Null - * means that no additional information is available. - */ - public Object getInternalSignatureInformation(); - - /** - * Returns the embedded /TimeStamp value (b64 encoded) from the signature if available. - * @return - */ - public String getTimeStampValue(); - - /** - * 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(); - - public void setNonTextualObjects(List nonTextualObjects); - - /** - * Returns true if non textual objects have been found, false if not. - * @return true if non textual objects have been found, false if not. - */ - public boolean hasNonTextualObjects(); - - -} \ No newline at end of file diff --git a/src/main/java/at/gv/egiz/pdfas/api/commons/SignatureProfile.java b/src/main/java/at/gv/egiz/pdfas/api/commons/SignatureProfile.java deleted file mode 100644 index 8cd3108..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/commons/SignatureProfile.java +++ /dev/null @@ -1,76 +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.api.commons; - -import java.util.Properties; - -/** - * Definition of a signature profile. - * - * @author wprinz - */ -public interface SignatureProfile { - - // TODO: implement full profile support - - /** - * Returns the profile id. - * - * @return Returns the profile id. - */ - public String getProfileId(); - - /** - * Returns the MOA KeyIdentifier. - * - * @return Returns the MOA KeyIdentifier. - */ - public String getMOAKeyIdentifier(); - - /** - * Returns the entries relevant to the search algorithm for signature blocks.
- * e.g. properties starting with sig_obj.PROFILE.key. and - * properties of the form sig_obj.PROFILE.table.TABLENAME.NUMBER - * where PROFILE is the name of the current profile, - * TABLENAME is the name of a table and NUMBER - * is the number of the specific row within the table TABLENAME. - * - * @return The entries relevant to the signature block search algorithm as - * Java properties. - */ - public Properties getSignatureBlockEntries(); - - /** - * Returns the profile description. - * - * @return The profile description. - */ - public String getProfileDescription(); - - /** - * True only if this is the default profile according to config. - * @return - */ - public boolean isDefault(); -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/exceptions/ConfigUtilsException.java b/src/main/java/at/gv/egiz/pdfas/api/exceptions/ConfigUtilsException.java deleted file mode 100644 index 644f74e..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/exceptions/ConfigUtilsException.java +++ /dev/null @@ -1,122 +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.api.exceptions; - -/** - * @author Thomas Knall - */ -public class ConfigUtilsException extends Exception { - - /** - * Marker for serialization. - */ - private static final long serialVersionUID = 1L; - - /** - * The underlying exception. - */ - private Exception wrappedException; - - /** - * Returns the underlying exception. - * - * @return The underlying exception. - */ - public Exception getException() { - return this.wrappedException; - } - - /** - * Returns the message of the wrapped exception. - * - * @return The message of the wrapped exception. - */ - public String getMessage() { - String message = super.getMessage(); - if (message == null && this.wrappedException != null) { - return this.wrappedException.getMessage(); - } else { - return message; - } - } - - /** - * Instantiation of a new exception based on a message and another (wrapped) - * exception. - * - * @param message - * The exception message. - * @param exception - * Another exception. - */ - public ConfigUtilsException(final String message, final Exception exception) { - super(message); - this.wrappedException = exception; - } - - /** - * Instantiated a new exception based on a message. - * - * @param message - * The message of the new exception. - */ - public ConfigUtilsException(final String message) { - super(message); - this.wrappedException = null; - } - - /** - * Instantiates a new exception based on another (wrapped) exception. - * - * @param exception - * The wrapped exception. - */ - public ConfigUtilsException(final Exception exception) { - super(); - this.wrappedException = exception; - } - - /** - * Instantiates a new (unspecified) exception. - */ - public ConfigUtilsException() { - super(); - this.wrappedException = null; - - } - - /** - * Returns the text representation of this instance. - * - * @return The text representation of this instance. - */ - public String toString() { - if (this.wrappedException != null) { - return this.wrappedException.toString(); - } else { - return super.toString(); - } - } - -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/exceptions/PdfAsException.java b/src/main/java/at/gv/egiz/pdfas/api/exceptions/PdfAsException.java deleted file mode 100644 index a050543..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/exceptions/PdfAsException.java +++ /dev/null @@ -1,98 +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.api.exceptions; - -/** - * This exception is the base for all PDF-AS exceptions. - * - *

- * Every PDF-AS Exception has an error code. - *

- * - * @author wprinz - */ -public abstract class PdfAsException extends Exception -{ - /** - * The error code. - */ - protected int errorCode = -1; - - /** - * Constructor. - * - * @param errorCode - * The error code. - * @param message - * The detail message. - */ - public PdfAsException(int errorCode, String message) - { - super(message); - - this.errorCode = errorCode; - } - - /** - * Constructor. - * - * @param errorCode - * The error code. - * @param message - * The detail message. - * @param cause - * The cause. - */ - public PdfAsException(int errorCode, String message, Throwable cause) - { - super(message, cause); - - this.errorCode = errorCode; - } - - /** - * Constructor. - * - * @param errorCode - * The error code. - * @param cause - * The cause. - */ - public PdfAsException(int errorCode, Throwable cause) - { - super(cause); - - this.errorCode = errorCode; - } - - /** - * Returns the error code of this exception. - * - * @return Returns the error code of this exception. - */ - public int getErrorCode() - { - return this.errorCode; - } -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/internal/LocalBKUParams.java b/src/main/java/at/gv/egiz/pdfas/api/internal/LocalBKUParams.java deleted file mode 100644 index b798903..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/internal/LocalBKUParams.java +++ /dev/null @@ -1,64 +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.api.internal; - - -/** - * Parameter container for local BKUs. (BKU, Mocca) - * - * @author exthex - * - */ -public class LocalBKUParams { - - private String server; - private String userAgent; - private String signatureLayout; - - public LocalBKUParams(String server, String userAgent, String signatureLayout) { - this.server = server; - this.userAgent = userAgent; - this.signatureLayout = signatureLayout; - } - - public String getServer() { - return server; - } - public void setServer(String server) { - this.server = server; - } - public String getUserAgent() { - return userAgent; - } - public void setUserAgent(String userAgent) { - this.userAgent = userAgent; - } - public String getSignatureLayout() { - return signatureLayout; - } - public void setSignatureLayout(String signatureLayout) { - this.signatureLayout = signatureLayout; - } - -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/internal/PdfAsInternal.java b/src/main/java/at/gv/egiz/pdfas/api/internal/PdfAsInternal.java deleted file mode 100644 index a77051d..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/internal/PdfAsInternal.java +++ /dev/null @@ -1,163 +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.api.internal; - -import java.util.Map; - -import at.gv.egiz.pdfas.api.PdfAs; -import at.gv.egiz.pdfas.api.analyze.AnalyzeResult; -import at.gv.egiz.pdfas.api.commons.SignatureInformation; -import at.gv.egiz.pdfas.api.exceptions.PdfAsException; -import at.gv.egiz.pdfas.api.sign.SignParameters; -import at.gv.egiz.pdfas.api.sign.SignResult; -import at.gv.egiz.pdfas.api.sign.SignatureDetailInformation; -import at.gv.egiz.pdfas.api.verify.VerifyResult; -import at.knowcenter.wag.egov.egiz.exceptions.ConnectorException; -import at.knowcenter.wag.egov.egiz.exceptions.ConnectorFactoryException; -import at.knowcenter.wag.egov.egiz.exceptions.NormalizeException; -import at.knowcenter.wag.egov.egiz.exceptions.SettingsException; -import at.knowcenter.wag.egov.egiz.exceptions.SignatureException; -import at.knowcenter.wag.egov.egiz.exceptions.SignatureTypesException; - -/** - * The methods of this interface are used by the pdf-as-web project and are not for external use.
- * Using this API is inadvisable as its functionality might change without notice from release to release. - * - * @author exthex - * - */ -public interface PdfAsInternal { - - /** - * Check if a BKU with the given parameters is supported. - * - * @param bkuParams - * @throws ConnectorException if the BKU is not supported - * @throws SettingsException if the BKU is not supported - */ - public void verifyBKUSupport(LocalBKUParams bkuParams) throws ConnectorException, SettingsException; - - /** - * Finish the sign process. - * - * @param pdfAs - * @param signParameters - * @param sdi This info will most likely come from a {@link PdfAs#prepareSign(SignParameters)} call - * @param bkuParams - * @param xmlResponse the SecurityLayer response from the BKU - * @return the signed document + additional info - * @throws PdfAsException - */ - public SignResult finishLocalSign(PdfAs pdfAs, SignParameters signParameters, SignatureDetailInformation sdi, LocalBKUParams bkuParams, boolean multipart, String xmlResponse) throws PdfAsException; - - /** - * Get the security layer address for the given connector. (zB: http://127.0.0.1:3495/http-security-layer-request) - * - * @param profile - * @param device - * @return - * @throws SettingsException - */ - public String getLocalServiceAddress(String profile, String device) throws SettingsException; - - /** - * Get the CreateXMLSignatureRequest for the given parameters. - * The request will use the given callback address to retrieve the data to sign. - * - * @param signParameters the sign parameters. {@link SignParameters#getSignatureDevice()} determines the connector to use. - * @param multipart true to select a {@link at.knowcenter.wag.egov.egiz.sig.connectors.LocalConnector} that uses multipart requests - * @param loc_ref_url the URL where to retrieve the PDF to sign - * @param sdi {@link SignatureDetailInformation#getSignatureData()} provides the data to be signed. - * @return - * @throws ConnectorException - */ - public String prepareLocalSignRequest(SignParameters signParameters, boolean multipart, String loc_ref_url, SignatureDetailInformation sdi) throws ConnectorException; - - /** - * Create an AnalyzeResult from raw text, instead of a PDF. - * - * @param rawText - * @param sigValues the signature values - * @return - * @throws SignatureException - * @throws SettingsException - * @throws SignatureTypesException - * @throws NormalizeException - */ - public AnalyzeResult analyzeFromRawText(String rawText, Map sigValues) throws SignatureException, SettingsException, SignatureTypesException, NormalizeException; - - /** - * Create the SecurityLayer VerifyXMLSignatureRequest for the given parameters. - * - * @param sigInfo - * @param connector - * @param profile - * @param loc_ref_url - * @return - * @throws SignatureException - * @throws ConnectorException - */ - public String prepareLocalVerifyRequest(SignatureInformation sigInfo, String connector, String profile, String loc_ref_url) throws SignatureException, ConnectorException; - - /** - * Parse the given xml_response - must be a VerifyXMLSignatureResponse - from the BKU or Mocca and generates a VerifyResult from it. - * - * @param sigInfo - * @param connector - * @param profile - * @param loc_ref_url - * @param xmlResponse - * @return - * @throws SignatureException - * @throws ConnectorException - */ - public VerifyResult finishLocalVerify(SignatureInformation sigInfo, String connector, String profile, String loc_ref_url, String xmlResponse) throws SignatureException, ConnectorException; - - /** - * Get the {@link SignatureEntry} corresponding to a given {@link SignatureInformation} - * - * @param key - * @param sigInfo - * @return - */ - public SignatureEntry getSignatureEntryFromSignatureInformation(String key, SignatureInformation sigInfo); - - /** - * Get the signed text for a given sigInfo.
- * If this signature is not text based this method will return null. - * - * @param sigInfo - * @return - */ - public String getSignedText(SignatureInformation sigInfo); - - /** - * Get a map of all connectors available for web. - * The key is the connector id, the value is the description. - * - * @return - * @throws ConnectorFactoryException - */ - public Map getConnectorsAvailableForWeb() throws ConnectorFactoryException; -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/internal/SignatureEntry.java b/src/main/java/at/gv/egiz/pdfas/api/internal/SignatureEntry.java deleted file mode 100644 index a3d77b8..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/internal/SignatureEntry.java +++ /dev/null @@ -1,137 +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: SignatureEntry.java,v 1.3 2006/08/25 17:09:41 wprinz Exp $ - */ -package at.gv.egiz.pdfas.api.internal; - -import java.io.Serializable; - -/** - * A container for signature entries. - * Copied to internal api from {@link at.knowcenter.wag.egov.egiz.sig.SignatureEntry} - * - * @author exthex - * @see at.knowcenter.wag.egov.egiz.sig.SignatureEntry - */ -public class SignatureEntry implements Serializable { - - /** - * SVUID. - */ - private static final long serialVersionUID = -1L; - - /** - * The signature key. - */ - private String key_ = null; - /** - * The signature caption for the key found or set in the signature text. - */ - private String caption_ = null; - /** - * The signature value for the key found or set in the signature text. - */ - private String value_ = null; - - /** - * The empty constructor. - */ - public SignatureEntry() { - } - - /** - * A new SignatureEntry init with the key. - * - * @param key - */ - public SignatureEntry(String key) { - key_ = key; - } - - /** - * Returns the caption off the current key. - * - * @return Returns the caption. - */ - public String getCaption() { - return caption_; - } - - /** - * Set the caption of the current key. - * - * @param caption The caption to set. - */ - public void setCaption(String caption) { - caption_ = caption; - } - - /** - * Return the current key. - * - * @return Returns the key. - */ - public String getKey() { - return key_; - } - - /** - * Set the current key. - * - * @param key The key to set. - */ - public void setKey(String key) { - key_ = key; - } - - /** - * Return the value of the current key. - * - * @return Returns the value. - */ - public String getValue() { - return value_; - } - - /** - * Set the value of the current key. - * - * @param value The value to set. - */ - public void setValue(String value) { - value_ = value; - } - - /** - * The toString method, used for tests or debugging. - */ - public String toString() { - String the_string = ""; - the_string += "\n Key:" + key_; - the_string += "\nCaption:" + caption_; - the_string += "\n Value:" + value_; -// the_string += "\nStart I:" + startIndex_; - return the_string; - } -} \ No newline at end of file diff --git a/src/main/java/at/gv/egiz/pdfas/api/io/DataSink.java b/src/main/java/at/gv/egiz/pdfas/api/io/DataSink.java deleted file mode 100644 index a539ce0..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/io/DataSink.java +++ /dev/null @@ -1,98 +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.api.io; - -import java.io.IOException; -import java.io.OutputStream; - -/** - * Output document data sink. - * - *

- * Actually, the DataSink can be seen as a factory for creating OutputStreams - * with mime type and character encoding provided. This allows the API user to - * decide how data is to be stored (e.g. in a file, in a byte array, etc.). - *

- * - * @author wprinz - */ -public interface DataSink -{ - /** - * Creates an OutputStream for binary data. - * - *

- * Note that the stream may be written only once. Creating another stream - * overwrites the existing one. - *

- * - * @param mimeType - * The mime type of the output data. - * @return Returns the created output stream. - * @throws IOException - * Thrown if the stream cannot be created. - */ - public OutputStream createOutputStream(String mimeType) throws IOException; - - /** - * Creates an OutputStream for character data. - * - *

- * This is basically the same as {@link #createOutputStream(String)}, but - * allows to specify the character encoding. - *

- * - * @param mimeType - * The mime type of the output data. - * @param characterEncoding - * The character encoding of the data. - * @return Returns the created output stream. - * @throws IOException - * Thrown if the stream cannot be created. - */ - public OutputStream createOutputStream(String mimeType, String characterEncoding) throws IOException; - - /** - * Returns the mime type of the data stream. - * - *

- * This is only valid after a stream has been created. - *

- * - * @return Returns the mime type of the data stream. - */ - public String getMimeType(); - - /** - * Returns the character encoding of the data stream. - * - *

- * This is only valid after a stream has been created. Null means that no - * character encoding was specified for the data (e.g. if the data is binary). - *

- * - * @return Returns the character encoding of the data stream. - */ - public String getCharacterEncoding(); -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/io/DataSource.java b/src/main/java/at/gv/egiz/pdfas/api/io/DataSource.java deleted file mode 100644 index 4150255..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/io/DataSource.java +++ /dev/null @@ -1,94 +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.api.io; - -import java.io.InputStream; - -/** - * Input document data source. - * - *

- * This allows the holder of the data to decide how the data is to be stored (e.g. in a File or in a byte array). - *

- * - * @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 for random read only access. - * - *

- * Calling this method indicates that you need a byte array for random - * read only 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. - *

- *

- * Never write to this byte array! - *

- * - * @return Returns the data of this DataSource as a byte array for random read only access. - */ - public byte[] getAsByteArray(); - - /** - * Returns the mime type of the data. - * - * @return Returns the mime type of the data. - */ - public String getMimeType(); - - /** - * Returns the character encoding of the data. - * - *

- * This makes only sense for character based mime types. - *

- * - * @return Returns the character encoding of the data or null if no encoding - * is applicable (e.g. if the data is binary). - */ - public String getCharacterEncoding(); - -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/io/FileBased.java b/src/main/java/at/gv/egiz/pdfas/api/io/FileBased.java deleted file mode 100644 index f3d0d0e..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/io/FileBased.java +++ /dev/null @@ -1,51 +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.api.io; - -import java.io.File; - -/** - * Tells that the IO element (DataSink or DataSource) is backed by a file in the local file system. - * - *

- * This is a hint that may be used by PDF-AS to optimize data access. - *

- * - * @author wprinz - */ -public interface FileBased -{ - - /** - * Returns the File "behind" this io element. - * - *

- * This is usually used to determine the file name itself. - *

- * - * @return Returns the File "behind" this io element. - */ - public File getFile (); - -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/io/TextBased.java b/src/main/java/at/gv/egiz/pdfas/api/io/TextBased.java deleted file mode 100644 index 39602ff..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/io/TextBased.java +++ /dev/null @@ -1,50 +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.api.io; - -/** - * Tells, that the IO Element (DataSink - but mostly DataSource) is based upon - * character data. - * - *

- * This can be used to retrieve the character text directly with the correct - * encoding etc. - *

- *

- * This makes most sense for text DataSources. - *

- * - * @author wprinz - */ -public interface TextBased -{ - - /** - * Returns the text. - * - * @return Returns the text. - */ - public String getText(); - -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/sign/SignParameters.java b/src/main/java/at/gv/egiz/pdfas/api/sign/SignParameters.java deleted file mode 100644 index 8834481..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/sign/SignParameters.java +++ /dev/null @@ -1,393 +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.api.sign; - -import java.util.Properties; - -import at.gv.egiz.pdfas.api.commons.Constants; -import at.gv.egiz.pdfas.api.io.DataSink; -import at.gv.egiz.pdfas.api.io.DataSource; -import at.gv.egiz.pdfas.api.sign.pos.SignaturePositioning; -import at.gv.egiz.pdfas.api.timestamp.TimeStamper; -import at.knowcenter.wag.egov.egiz.sig.SignatureTypes; - -/** - * Parameter object that holds the sign parameters. - * - * @author wprinz - */ -public class SignParameters -{ -// 23.11.2010 changed by exthex - added parameters for placeholder handling - - /** - * The document to be signed. - * - *

- * The DataSource implementation encapsulates the actual representaion of the - * data. E.g. the DataSource may be File based or byte array based. See - * package at.gv.egiz.pdfas.framework.input and at.gv.pdfas.impl.input - *

- */ - protected DataSource document = null; - - /** - * The type of the signature. - * - *

- * May be {@link Constants#SIGNATURE_TYPE_BINARY} or - * {@link Constants#SIGNATURE_TYPE_TEXTUAL}. - *

- */ - protected String signatureType = Constants.DEFAULT_SIGNATURE_TYPE; - - /** - * The signature device to perform the actual signature. - * - *

- * May be {@link Constants#SIGNATURE_DEVICE_MOA} or - * {@link Constants#SIGNATURE_DEVICE_BKU}. - *

- */ - protected String signatureDevice = Constants.SIGNATURE_DEVICE_MOA; - - /** - * The signature profile identifier identifying the profile to be used in the - * config file. - * - *

- * Note: In near future it will be possible to provide a full specified - * profile here instead of the profile id. - *

- */ - protected String signatureProfileId = null; - - /** - * The signature key identifier specifying which signature key should be used - * by the signature device to perform the signature. - * - *

- * Providing a null value (default) means that no explicit signature key - * identifier is provided. The selected signature device will then use its - * default mechanism for retrieving this information (which is usually to read - * the key from the provided signature profile). - *

- *

- * Note that not all signature devices may support this parameter. - * If a signature device doesn't support this parameter the value should be null. - *

- *

- * This key is usually passed straight through to the signature device and - * thereby has to contain an appropriate value for the signature device - * chosen. - *

- *

- * Currently, only the {@link Constants#SIGNATURE_DEVICE_MOA} signature device - * evaluates this parameter and passes the provided String to MOA as the MOA - * key group identifier. If null is provided, the MOA signature device will - * determine the signature key identifier to be used from the provided profile - * and, if not specified there either, from the MOA default configuration. - *

- */ - protected String signatureKeyIdentifier = null; - - /** - * The signature position. Consult the PDF-AS documentation section - * Commandline. - */ - protected SignaturePositioning signaturePositioning = null; - - /** - * The output DataSink that will receive the signed document. - */ - protected DataSink output = null; - - protected TimeStamper timeStamperImpl; - - /** - * The flag to de-/activate placeholder search - */ - protected Boolean checkForPlaceholder = null; - - /** - * The id of the placeholder which should be replaced. - */ - protected String placeholderId; - - /** - * The matching mode for placeholder extraction.
- * If a {@link SignParameters#placeholderId} is set, the match mode determines what is to be done, if no matching placeholder is found in the document. - *
- * Defaults to {@link Constants#PLACEHOLDER_MATCH_MODE_MODERATE}. - */ - protected int placeholderMatchMode = Constants.PLACEHOLDER_MATCH_MODE_MODERATE; - - protected Properties overrideProps = new Properties(); - - - - - - /** - * {@link #setTimeStamperImpl(TimeStamper)} - * @return - */ - public TimeStamper getTimeStamperImpl() { - return this.timeStamperImpl; - } - - /** - * Set a {@link TimeStamper} to create a timestamp on the signature value. Will be - * called after sign. For binary signatures only. Timestamp will be embedded in egiz dict /TimeStamp. - * @param timeStamperImpl - */ - public void setTimeStamperImpl(TimeStamper timeStamperImpl) { - this.timeStamperImpl = timeStamperImpl; - } - -/** - * @return the document - */ - public DataSource getDocument() - { - return document; - } - - /** - * @param document - * the document to set - */ - public void setDocument(DataSource document) - { - this.document = document; - } - - /** - * @return the signatureType - */ - public String getSignatureType() - { - return signatureType; - } - - /** - * @param signatureType - * the signatureType to set - */ - public void setSignatureType(String signatureType) - { - this.signatureType = signatureType; - } - - /** - * @return the signatureDevice - */ - public String getSignatureDevice() - { - return signatureDevice; - } - - /** - * @param signatureDevice - * the signatureDevice to set - */ - public void setSignatureDevice(String signatureDevice) - { - this.signatureDevice = signatureDevice; - } - - /** - * @return the signatureProfileId - */ - public String getSignatureProfileId() - { - return signatureProfileId; - } - - /** - * @param signatureProfileId - * the signatureProfileId to set - */ - public void setSignatureProfileId(String signatureProfileId) - { - this.signatureProfileId = signatureProfileId; - } - - /** - * @return the signaturePositioning - */ - public SignaturePositioning getSignaturePositioning() - { - return this.signaturePositioning; - } - - /** - * @param signaturePositioning - * the signaturePositioning to set - */ - public void setSignaturePositioning(SignaturePositioning signaturePositioning) - { - this.signaturePositioning = signaturePositioning; - } - - /** - * @return the output - */ - public DataSink getOutput() - { - return output; - } - - /** - * @param output - * the output to set - */ - public void setOutput(DataSink output) - { - this.output = output; - } - - /** - * @return the signatureKeyIdentifier - */ - public String getSignatureKeyIdentifier() - { - return this.signatureKeyIdentifier; - } - - /** - * @param signatureKeyIdentifier the signatureKeyIdentifier to set - */ - public void setSignatureKeyIdentifier(String signatureKeyIdentifier) - { - this.signatureKeyIdentifier = signatureKeyIdentifier; - } - - /** - * Override user defined values from the used signature profile like "value.SIG_META". - * You cannot override pre defined values like SIG_VALUE, SIG_DATE {@link SignatureTypes#REQUIRED_SIG_KEYS}. - * The override values are bound to the {@link SignParameters} instance. - *

- * Sample usage: - *

-      SignParameters sp = new SignParameters();
-      . . .
-      
-      sp.setSignatureProfileId("SIGNATURBLOCK_DE");  
-      
-      // expressions do not work on binary signature fields without phlength setting!!
-      sp.setProfileOverrideValue("SIG_META", "It's nice to be important, but it is more important to be nice ${subject.L}");;
-      sp.setProfileOverrideValue("SIG_LABEL", "./images/signatur-logo_en.png");                  
-      
-      // execute sign using the overrides
-      pdfAs.sign(sp);
-  
- *

- * @param key the name of the setting to override e.g. "SIG_META" - * @param value The new value - */ - public void setProfileOverrideValue(String key, String value) { - if (SignatureTypes.isRequredSigTypeKey(key)) { - throw new RuntimeException("cannot set value for pre defined signature field names"); - } - this.overrideProps.put(key, value); - } - - /** - * Get override values created via {@link #setProfileOverrideValue(String, String)} - * @return - */ - public Properties getProfileOverrideProperties() { - return this.overrideProps; - - } - - /** - * Get the value of the checkForPlaceholder flag. - * - * @return - */ - public Boolean isCheckForPlaceholder() { - return this.checkForPlaceholder; - } - - /** - * Set this to true, if you want a search for placeholder images to be performed and - * appropriate images to be replaced. - * If this is not set, a search will only be performed if the configuration property "enable_placeholder_search" is set to true. - * - * @param check - */ - public void setCheckForPlaceholder(boolean check) { - this.checkForPlaceholder = Boolean.valueOf(check); - } - - /** - * Set an explicit placeholder id. - * Only placeholder images that have a matching ID property embedded will be considered for replacement. - * - * @param placeholderId - */ - public void setPlaceholderId(String placeholderId) { - this.placeholderId = placeholderId; - } - - /** - * The id of the placeholder to replace. - * - * @return the placeholderId - */ - public String getPlaceholderId() { - return placeholderId; - } - - /** - * Set the behavior if no exactly matching placeholder could be found.
- * Exactly matching meaning:
- *
  • If a placeholderId is set: a placeholder which has exactly this id embedded
  • - *
  • If no placeholderId is set: a placeholder without an embedded id is found
- * - * @see Constants#PLACEHOLDER_MATCH_MODE_LENIENT - * @see Constants#PLACEHOLDER_MATCH_MODE_MODERATE - * @see Constants#PLACEHOLDER_MATCH_MODE_STRICT - * - * Defaults to {@link Constants#PLACEHOLDER_MATCH_MODE_MODERATE}. - * - * @param placeholderMatchMode - */ - public void setPlaceholderMatchMode(int placeholderMatchMode) { - this.placeholderMatchMode = placeholderMatchMode; - } - - /** - * Get the placeholder matching mode. - * - * @see SignParameters#getPlaceholderMatchMode() - * @return the placeholderMatchMode - */ - public int getPlaceholderMatchMode() { - return this.placeholderMatchMode; - } - -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/sign/SignResult.java b/src/main/java/at/gv/egiz/pdfas/api/sign/SignResult.java deleted file mode 100644 index fa0282f..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/sign/SignResult.java +++ /dev/null @@ -1,84 +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.api.sign; - -import java.security.cert.X509Certificate; -import java.util.List; - -import at.gv.egiz.pdfas.api.analyze.NonTextObjectInfo; -import at.gv.egiz.pdfas.api.io.DataSink; -import at.gv.egiz.pdfas.api.sign.pos.SignaturePosition; - -/** - * The result of a sign operation. - * - * @author wprinz - */ -public interface SignResult -{ - - /** - * Returns the filled output data sink. - * - * @return Returns the filled output data sink. - */ - public DataSink getOutputDocument(); - - /** - * Returns the certificate of the signer. - * - * @return Returns the certificate of the signer. - */ - public X509Certificate getSignerCertificate(); - - /** - * Returns the position where the signature is finally placed. - * - *

- * This information can be useful for post-processing the document. - *

- * - *

- * Consult the PDF-AS documentation section Commandline for further - * information about positioning. - *

- * - * @return Returns the position where the signature is finally placed. May - * return null if no position information is available. - */ - public SignaturePosition getSignaturePosition(); - - /** - * 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(); - - /** - * Returns if pdf has non textual objects (only for textual signature available). - * @return - */ - public boolean hasNonTextualObjects(); -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/sign/SignatureDetailInformation.java b/src/main/java/at/gv/egiz/pdfas/api/sign/SignatureDetailInformation.java deleted file mode 100644 index c5a0263..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/sign/SignatureDetailInformation.java +++ /dev/null @@ -1,147 +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.api.sign; - -import java.security.cert.X509Certificate; -import java.util.Date; -import java.util.List; -import java.util.Map; - -import at.gv.egiz.pdfas.api.analyze.NonTextObjectInfo; -import at.gv.egiz.pdfas.api.io.DataSource; -import at.gv.egiz.pdfas.api.sign.pos.SignaturePosition; - -/** - * A container for all relevant signature related data. - * - * @author exthex - */ -public interface SignatureDetailInformation -{ - public DataSource getSignatureData(); - - /** - * Returns the position where the signature table was actually placed. - * - * @return Returns the position where the signature table was actually placed. - */ - public SignaturePosition getSignaturePosition(); - - /** - * 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(); - - /** - * Returns the date of signature extracted from the signature. - * @return - */ - public Date getSignDate(); - - /** - * Get the name of the issuer. - * Short for {@link SignatureDetailInformation#getX509Certificate()#getIssuer()#getName()} - * - * @return - */ - public String getIssuer(); - - /** - * Short for {@link SignatureDetailInformation#getX509Certificate()#getIssuerDNMap()} - * - * @return - */ - public Map getIssuerDNMap(); - - /** - * Short for {@link SignatureDetailInformation#getX509Certificate()#getSubjectName()#toString()} - * - * @return - */ - public String getSubjectName(); - - /** - * Short for {@link SignatureDetailInformation#getX509Certificate()#getSerialNumber()#toString()} - * - * @return - */ - public String getSerialNumber(); - - /** - * Get the algorithm the signature was created with. - * @return - */ - public String getSigAlgorithm(); - - /** - * - * @return the signature id. - */ - public String getSigID(); - - /** - * - * @return the signature method. - */ - public String getSigKZ(); - - /** - * - * @return the signature value. - */ - public String getSignatureValue(); - - /** - * - * @return the signature time stamp. - */ - public String getSigTimeStamp(); - - /** - * Short for {@link SignatureDetailInformation#getX509Certificate()#getSubjectDNMap()} - * - * @return - */ - public Map getSubjectDNMap(); - - /** - * - * @return the certificate used for signature. - */ - public X509Certificate getX509Certificate(); - - /** - * - * @return true if the signature is textual, false otherwise. - */ - public boolean isTextual(); - - /** - * - * @return true if this signature is binary, false otherwise. - */ - public boolean isBinary(); -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/sign/pos/SignaturePosition.java b/src/main/java/at/gv/egiz/pdfas/api/sign/pos/SignaturePosition.java deleted file mode 100644 index eee62cd..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/sign/pos/SignaturePosition.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.api.sign.pos; - -/** - * Holds the actual, absolute signature position where a signature was placed. - * - *

- * This is usually returned after signing. - *

- * - * @author wprinz - */ -public interface SignaturePosition -{ - /** - * Returns the page on which the signature was placed. - * - * @return Returns the page on which the signature was placed. - */ - public int getPage(); - - /** - * Returns the x position. - * - * @return Returns the x position. - */ - public float getX(); - - /** - * Returns the y position. - * - * @return Returns the y position. - */ - public float getY(); - - /** - * Returns the width of the signature. - * - * @return Returns the width of the signature. - */ - public float getWidth(); - - /** - * Returns the height of the signature. - * - * @return Returns the height of the signature. - */ - public float getHeight(); - -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/sign/pos/SignaturePositioning.java b/src/main/java/at/gv/egiz/pdfas/api/sign/pos/SignaturePositioning.java deleted file mode 100644 index d46c3f2..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/sign/pos/SignaturePositioning.java +++ /dev/null @@ -1,296 +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.api.sign.pos; - -import java.io.Serializable; -import java.util.StringTokenizer; - -import at.gv.egiz.pdfas.api.sign.pos.axis.AbsoluteAxisAlgorithm; -import at.gv.egiz.pdfas.api.sign.pos.axis.AutoAxisAlgorithm; -import at.gv.egiz.pdfas.api.sign.pos.axis.AxisAlgorithm; -import at.gv.egiz.pdfas.api.sign.pos.page.AbsolutePageAlgorithm; -import at.gv.egiz.pdfas.api.sign.pos.page.AutoPageAlgorithm; -import at.gv.egiz.pdfas.api.sign.pos.page.NewPageAlgorithm; -import at.gv.egiz.pdfas.api.sign.pos.page.PageAlgorithm; -import at.gv.egiz.pdfas.exceptions.ErrorCode; -import at.knowcenter.wag.egov.egiz.exceptions.PDFDocumentException; - -/** - * Defines how the signature positioning is to be performed. - * - *

- * This positioning allows to select the location where the signature block is - * placed in the document. - *

- * - * @author wprinz - */ -public class SignaturePositioning implements Serializable -{ - - /** - * - */ - private static final long serialVersionUID = 1L; - - /** - * The x axis algorithm. - * - *

- * May be {@link AutoAxisAlgorithm} or {@link AbsoluteAxisAlgorithm} - *

- */ - protected AxisAlgorithm xAlgorithm = new AutoAxisAlgorithm(); - - /** - * The y axis algorithm. - * - *

- * May be {@link AutoAxisAlgorithm} or {@link AbsoluteAxisAlgorithm} - *

- */ - protected AxisAlgorithm yAlgorithm = new AutoAxisAlgorithm(); - - /** - * The width algorithm. - * - *

- * May be {@link AutoAxisAlgorithm} or {@link AbsoluteAxisAlgorithm} - *

- */ - protected AxisAlgorithm widthAlgorithm = new AutoAxisAlgorithm(); - - /** - * The page algorithm. - * - *

- * May be {@link AutoPageAlgorithm}, {@link AbsolutePageAlgorithm} or - * {@link NewPageAlgorithm} - *

- */ - protected PageAlgorithm pageAlgorithm = new AutoPageAlgorithm(); - - /** - * Provides the position of the footline. - * - *

- * Only used if the pageAlgorithm is {@link AutoPageAlgorithm} and the - * yAlgorithm is {@link AutoAxisAlgorithm} - *

- */ - protected float footerLine = 0.0f; - - protected void checkAxisAlgorithm(AxisAlgorithm algorithm) - { - if (algorithm == null) - { - throw new IllegalArgumentException("The algorithm must not be null."); - } - if (!(algorithm instanceof AutoAxisAlgorithm) && !(algorithm instanceof AbsoluteAxisAlgorithm)) - { - throw new IllegalArgumentException("The algorithm must be either Auto or Absolute."); - } - } - - protected void checkPageAlgorithm(PageAlgorithm algorithm) - { - if (algorithm == null) - { - throw new IllegalArgumentException("The algorithm must not be null."); - } - if (!(algorithm instanceof AutoPageAlgorithm) && !(algorithm instanceof AbsolutePageAlgorithm) && !(algorithm instanceof NewPageAlgorithm)) - { - throw new IllegalArgumentException("The algorithm must be either Auto or Absolute."); - } - - } - - /** - * @return the xAlgorithm - */ - public AxisAlgorithm getXAlgorithm() - { - return this.xAlgorithm; - } - - /** - * @param algorithm - * the xAlgorithm to set - */ - public void setXAlgorithm(AxisAlgorithm algorithm) - { - checkAxisAlgorithm(algorithm); - xAlgorithm = algorithm; - } - - /** - * @return the yAlgorithm - */ - public AxisAlgorithm getYAlgorithm() - { - return this.yAlgorithm; - } - - /** - * @param algorithm - * the yAlgorithm to set - */ - public void setYAlgorithm(AxisAlgorithm algorithm) - { - checkAxisAlgorithm(algorithm); - - yAlgorithm = algorithm; - } - - /** - * @return the widthAlgorithm - */ - public AxisAlgorithm getWidthAlgorithm() - { - return this.widthAlgorithm; - } - - /** - * @param widthAlgorithm - * the widthAlgorithm to set - */ - public void setWidthAlgorithm(AxisAlgorithm widthAlgorithm) - { - checkAxisAlgorithm(widthAlgorithm); - - this.widthAlgorithm = widthAlgorithm; - } - - /** - * @return the pageAlgorithm - */ - public PageAlgorithm getPageAlgorithm() - { - return this.pageAlgorithm; - } - - /** - * @param pageAlgorithm - * the pageAlgorithm to set - */ - public void setPageAlgorithm(PageAlgorithm pageAlgorithm) - { - checkPageAlgorithm(pageAlgorithm); - this.pageAlgorithm = pageAlgorithm; - } - - /** - * @return the footerLine - */ - public float getFooterLine() - { - return this.footerLine; - } - - /** - * @param footerLine - * the footerLine to set - */ - public void setFooterLine(float footerLine) - { - this.footerLine = footerLine; - } - - public SignaturePositioning() { - } - - public SignaturePositioning(String position) throws PDFDocumentException { - if (position != null) { - StringTokenizer tokenizer = new StringTokenizer(position, ";"); - while (tokenizer.hasMoreTokens()) { - String token = tokenizer.nextToken().replaceAll(" ", ""); - String[] sToken = token.split(":"); - if (sToken == null || sToken.length != 2 || sToken[0].length() != 1) { - throw new PDFDocumentException(ErrorCode.INVALID_SIGNATURE_POSITION, "Invalid signature position element: " + token); - } - char cmd = sToken[0].toLowerCase().charAt(0); - String value = sToken[1]; - switch (cmd) { - case 'x': - if ("auto".equalsIgnoreCase(value)) { - this.setXAlgorithm(new AutoAxisAlgorithm()); - } else { - try { - this.setXAlgorithm(new AbsoluteAxisAlgorithm(Float.parseFloat(value))); - } catch (NumberFormatException e) { - throw new PDFDocumentException(ErrorCode.INVALID_SIGNATURE_POSITION, "Invalid signature position element: " + token); - } - } - break; - case 'y': - if ("auto".equalsIgnoreCase(value)) { - this.setYAlgorithm(new AutoAxisAlgorithm()); - } else { - try { - this.setYAlgorithm(new AbsoluteAxisAlgorithm(Float.parseFloat(value))); - } catch (NumberFormatException e) { - throw new PDFDocumentException(ErrorCode.INVALID_SIGNATURE_POSITION, "Invalid signature position element: " + token); - } - } - break; - case 'w': - if ("auto".equalsIgnoreCase(value)) { - this.setWidthAlgorithm(new AutoAxisAlgorithm()); - } else { - try { - this.setWidthAlgorithm(new AbsoluteAxisAlgorithm(Float.parseFloat(value))); - } catch (NumberFormatException e) { - throw new PDFDocumentException(ErrorCode.INVALID_SIGNATURE_POSITION, "Invalid signature position element: " + token); - } - } - break; - case 'p': - if ("auto".equalsIgnoreCase(value)) { - this.setPageAlgorithm(new AutoPageAlgorithm()); - } else if ("new".equalsIgnoreCase(value)) { - this.setPageAlgorithm(new NewPageAlgorithm()); - } else { - try { - this.setPageAlgorithm(new AbsolutePageAlgorithm(Integer.parseInt(value))); - } catch (NumberFormatException e) { - throw new PDFDocumentException(ErrorCode.INVALID_SIGNATURE_POSITION, "Invalid signature position element: " + token); - } - } - break; - case 'f': - try { - this.setFooterLine(Float.parseFloat(value)); - } catch (NumberFormatException e) { - throw new PDFDocumentException(ErrorCode.INVALID_SIGNATURE_POSITION, "Invalid signature position element: " + token); - } - break; - default: - throw new PDFDocumentException(ErrorCode.INVALID_SIGNATURE_POSITION, "Invalid signature position element: " + token); - } - } - } - } - - -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/sign/pos/axis/AbsoluteAxisAlgorithm.java b/src/main/java/at/gv/egiz/pdfas/api/sign/pos/axis/AbsoluteAxisAlgorithm.java deleted file mode 100644 index ea2143d..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/sign/pos/axis/AbsoluteAxisAlgorithm.java +++ /dev/null @@ -1,62 +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.api.sign.pos.axis; - -import java.io.Serializable; - -/** - * An absolute positioned element. - * @author wprinz - */ -public class AbsoluteAxisAlgorithm extends AxisAlgorithm implements Serializable -{ - - /** - * - */ - private static final long serialVersionUID = 1L; - - /** - * The absolute positioning value on the axis. - */ - protected float absoluteValue = 0.0f; - - /** - * Constructor. - * @param absoluteValue The absolute positioning value on the axis. - */ - public AbsoluteAxisAlgorithm (float absoluteValue) - { - this.absoluteValue = absoluteValue; - } - - /** - * Returns absolute positioning value on the axis. - * @return the absoluteValue Returns absolute positioning value on the axis. - */ - public float getAbsoluteValue() - { - return this.absoluteValue; - } -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/sign/pos/axis/AutoAxisAlgorithm.java b/src/main/java/at/gv/egiz/pdfas/api/sign/pos/axis/AutoAxisAlgorithm.java deleted file mode 100644 index a9857b4..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/sign/pos/axis/AutoAxisAlgorithm.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.api.sign.pos.axis; - -import java.io.Serializable; - -/** - * Auto positioning for this element. - * - * @author wprinz - */ -public class AutoAxisAlgorithm extends AxisAlgorithm implements Serializable -{ - - /** - * - */ - private static final long serialVersionUID = 1L; -// empty -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/sign/pos/axis/AxisAlgorithm.java b/src/main/java/at/gv/egiz/pdfas/api/sign/pos/axis/AxisAlgorithm.java deleted file mode 100644 index dd1d170..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/sign/pos/axis/AxisAlgorithm.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.api.sign.pos.axis; - -import java.io.Serializable; - -/** - * Determines how a certain position is chosen on the axis (x, y, width). - * - * @author wprinz - */ -public abstract class AxisAlgorithm implements Serializable -{ - - /** - * - */ - private static final long serialVersionUID = 1L; -// base class -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/sign/pos/page/AbsolutePageAlgorithm.java b/src/main/java/at/gv/egiz/pdfas/api/sign/pos/page/AbsolutePageAlgorithm.java deleted file mode 100644 index 434c20c..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/sign/pos/page/AbsolutePageAlgorithm.java +++ /dev/null @@ -1,64 +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.api.sign.pos.page; - -import java.io.Serializable; - -/** - * The page is selected absolutely by giving the page number directly. - * - * @author wprinz - */ -public class AbsolutePageAlgorithm extends PageAlgorithm implements Serializable -{ - /** - * - */ - private static final long serialVersionUID = 1L; - - /** - * The page. - */ - protected int page = -1; - - /** - * Constructor. - * - * @param page - * The page. - */ - public AbsolutePageAlgorithm(int page) - { - this.page = page; - } - - /** - * @return the page - */ - public int getPage() - { - return this.page; - } - -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/sign/pos/page/AutoPageAlgorithm.java b/src/main/java/at/gv/egiz/pdfas/api/sign/pos/page/AutoPageAlgorithm.java deleted file mode 100644 index fffcbad..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/sign/pos/page/AutoPageAlgorithm.java +++ /dev/null @@ -1,47 +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.api.sign.pos.page; - -import java.io.Serializable; - -/** - * The page for placing the signature is selected automatically. - * - *

- * The algorithm first tries to place the signature on the free space of the - * last page (considering the footer). If there is not enough space on the last - * page, a new page is appended and the signature is placed there. - *

- * - * @author wprinz - */ -public class AutoPageAlgorithm extends PageAlgorithm implements Serializable -{ - - /** - * - */ - private static final long serialVersionUID = 1L; -// empty -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/sign/pos/page/NewPageAlgorithm.java b/src/main/java/at/gv/egiz/pdfas/api/sign/pos/page/NewPageAlgorithm.java deleted file mode 100644 index ded9f61..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/sign/pos/page/NewPageAlgorithm.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.api.sign.pos.page; - -import java.io.Serializable; - -/** - * Places the signature on a new Page. - * - * @author wprinz - */ -public class NewPageAlgorithm extends PageAlgorithm implements Serializable -{ - - /** - * - */ - private static final long serialVersionUID = 1L; - // empty block -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/sign/pos/page/PageAlgorithm.java b/src/main/java/at/gv/egiz/pdfas/api/sign/pos/page/PageAlgorithm.java deleted file mode 100644 index 16aa72c..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/sign/pos/page/PageAlgorithm.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.api.sign.pos.page; - -import java.io.Serializable; - -/** - * Determines how the page on which the signature is to be placed is selected. - * - * @author wprinz - */ -public abstract class PageAlgorithm implements Serializable -{ - - /** - * - */ - private static final long serialVersionUID = 1L; - // empty -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/timestamp/DummyTimeStamper.java b/src/main/java/at/gv/egiz/pdfas/api/timestamp/DummyTimeStamper.java deleted file mode 100644 index f3944da..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/timestamp/DummyTimeStamper.java +++ /dev/null @@ -1,62 +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.api.timestamp; - -import java.util.Date; - -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.lang.time.DateFormatUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * Dummy/test implementation of the timestamper. Logs and stores test-timestamp for assertion {@link #getLastTimeStamp()} - * - * @author dferbas - * - */ -public class DummyTimeStamper implements TimeStamper { - private static Log log = LogFactory.getLog(DummyTimeStamper.class); - - private String lastTimeStamp; - - public String applyTimeStamp(String b64SignatureValue) { - log.debug("Applying dummy timestamp on signature value: " + b64SignatureValue); - String ts = DateFormatUtils.format(new Date(), "yyyy-MM-dd'T'hh:mm:ss.SSSZ"); - log.debug("Timestamp: " + ts); - ts = new String(Base64.encodeBase64(ts.getBytes())); - log.debug("Timestamp value (base64): " + ts); - this.lastTimeStamp = ts; - return ts; - } - - public String getLastTimeStamp() { - return this.lastTimeStamp; - } - - public void setLastTimeStamp(String lastTimeStamp) { - this.lastTimeStamp = lastTimeStamp; - } - -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/timestamp/TimeStamper.java b/src/main/java/at/gv/egiz/pdfas/api/timestamp/TimeStamper.java deleted file mode 100644 index 99bda3a..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/timestamp/TimeStamper.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.api.timestamp; - -/** - * Interface for timestamper implementations/handlers - * - * @author dferbas - * - */ -public interface TimeStamper { - - /** - * Implement timestamp in this method. - * @param b64SignatureValue signature value, base64 encoded - * @return timestamp to be embedded in egiz dictionary base64 encoded (following RFC3161). - */ - public String applyTimeStamp(String b64SignatureValue); - -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/verify/SignatureCheck.java b/src/main/java/at/gv/egiz/pdfas/api/verify/SignatureCheck.java deleted file mode 100644 index c169077..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/verify/SignatureCheck.java +++ /dev/null @@ -1,51 +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.api.verify; - -/** - * The result of a signature check performed by a verification device. - * - * @see VerifyResult - * - * @author wprinz - */ -public interface SignatureCheck -{ - /** - * Returns the response code of the check. - * - * @return Returns the response code of the check. - */ - public int getCode(); - - /** - * Returns the textual response message of the check (corresponding to the - * code). - * - * @return Returns the textual response message of the check (corresponding to - * the code). - */ - public String getMessage(); - -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyAfterAnalysisParameters.java b/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyAfterAnalysisParameters.java deleted file mode 100644 index 8b9e2c6..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyAfterAnalysisParameters.java +++ /dev/null @@ -1,166 +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.api.verify; - -import java.util.Date; - -import at.gv.egiz.pdfas.api.analyze.AnalyzeResult; -import at.gv.egiz.pdfas.api.commons.Constants; - -/** - * Parameter object that holds the verify after analysis parameters. - * - * @author wprinz - */ -public class VerifyAfterAnalysisParameters -{ - - /** - * The list of signatures to be verified. - */ - protected AnalyzeResult analyzeResult = null; - - /** - * The signature device to perform the actual signature. - * - *

- * May be {@link Constants#SIGNATURE_DEVICE_MOA} or - * {@link Constants#SIGNATURE_DEVICE_BKU}. - *

- */ - protected String signatureDevice = Constants.SIGNATURE_DEVICE_MOA; - - /** - * Allows to pass a VerificationTime to the signature device. - */ - protected Date verificationTime = null; - - /** - * Tells the signature device (e.g. MOA) to return the signature hash input - * data (which is the probably transformed signed data). - * - *

- * Note that this forces MOA to return the potentially large signature data to - * be returned in the result XML, which may result in very bad performance. - *

- */ - protected boolean returnHashInputData = false; - - /** - * The index of the signature to be verified. A value < 0 indicates to verify all signatures. - */ - protected int verifySignatureIndex = -1; - - /** - * @return the analyzeResult - */ - public AnalyzeResult getAnalyzeResult() - { - return this.analyzeResult; - } - - /** - * @param analyzeResult - * the analyzeResult to set - */ - public void setAnalyzeResult(AnalyzeResult analyzeResult) - { - this.analyzeResult = analyzeResult; - } - - /** - * @return the signatureDevice - */ - public String getSignatureDevice() - { - return this.signatureDevice; - } - - /** - * @param signatureDevice - * the signatureDevice to set - */ - public void setSignatureDevice(String signatureDevice) - { - this.signatureDevice = signatureDevice; - } - - /** - * @return the verificationTime - */ - public Date getVerificationTime() - { - return this.verificationTime; - } - - /** - * @param verificationTime the verificationTime to set - */ - public void setVerificationTime(Date verificationTime) - { - this.verificationTime = verificationTime; - } - - /** - * @return the returnHashInputData - */ - public boolean isReturnHashInputData() - { - return this.returnHashInputData; - } - - /** - * @param returnHashInputData - * the returnHashInputData to set - */ - public void setReturnHashInputData(boolean returnHashInputData) - { - this.returnHashInputData = returnHashInputData; - } - - /** - * Set the index of the signature to verify (index starting at 0). A value < 0 indicates to verify all values. - * @param verify_which - */ - public void setVerifySignatureIndex(int verify_which) { - this.verifySignatureIndex = verify_which; - } - - public int getVerifySignatureIndex() { - return verifySignatureIndex; - } - - /** - * @see VerifyParameters#setSuppressVerifyExceptions(boolean) - * @param suppress - */ - public void setSuppressVerifyExceptions(boolean suppress) { - VerifyParameters.setSuppressVerify(suppress); - } - - public boolean isSuppressVerifyExceptions() { - return VerifyParameters.isSuppressVerifyExceptions(); - } - -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyAfterReconstructXMLDsigParameters.java b/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyAfterReconstructXMLDsigParameters.java deleted file mode 100644 index 8f8d17c..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyAfterReconstructXMLDsigParameters.java +++ /dev/null @@ -1,169 +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.api.verify; - -import java.util.Date; - -import at.gv.egiz.pdfas.api.commons.Constants; -import at.gv.egiz.pdfas.api.xmldsig.ReconstructXMLDsigResult; - -/** - * This class represents the parameters needed for verify after reconstructXMLDsig has already been executed. - * - * @author exthex - * - */ -public class VerifyAfterReconstructXMLDsigParameters { - - /** - * The list of signatures to be verified. - */ - protected ReconstructXMLDsigResult reconstructXMLDsigResult = null; - - /** - * The signature device to perform the actual signature. - * - *

- * May be {@link Constants#SIGNATURE_DEVICE_MOA} or - * {@link Constants#SIGNATURE_DEVICE_BKU}. - *

- */ - protected String signatureDevice; - - /** - * Allows to pass a VerificationTime to the signature device. - */ - protected Date verificationTime = null; - - /** - * Tells the signature device (e.g. MOA) to return the signature hash input - * data (which is the probably transformed signed data). - * - *

- * Note that this forces MOA to return the potentially large signature data to - * be returned in the result XML, which may result in very bad performance. - *

- */ - protected boolean returnHashInputData = false; - - /** - * The index of the signature to be verified. A value < 0 indicates to verify all signatures. - */ - protected int verifySignatureIndex = -1; - - /** - * @return the reconstructXMLDsigResult - */ - public ReconstructXMLDsigResult getReconstructXMLDsigResult() - { - return this.reconstructXMLDsigResult; - } - - /** - * @param reconstructXMLDsigResult - * the reconstructXMLDsigResult to set - */ - public void setReconstructXMLDsigResult(ReconstructXMLDsigResult reconstructXMLDsigResult) - { - this.reconstructXMLDsigResult = reconstructXMLDsigResult; - } - - /** - * @return the signatureDevice - */ - public String getSignatureDevice() - { - return this.signatureDevice; - } - - /** - * Set the signature device to use for verification. - * If none is set here, the signature device that was used for reconstructXMLDsig will be used. - * - * @param signatureDevice - * the signatureDevice to set - */ - public void setSignatureDevice(String signatureDevice) - { - this.signatureDevice = signatureDevice; - } - - /** - * @return the verificationTime - */ - public Date getVerificationTime() - { - return this.verificationTime; - } - - /** - * @param verificationTime the verificationTime to set - */ - public void setVerificationTime(Date verificationTime) - { - this.verificationTime = verificationTime; - } - - /** - * @return the returnHashInputData - */ - public boolean isReturnHashInputData() - { - return this.returnHashInputData; - } - - /** - * @param returnHashInputData - * the returnHashInputData to set - */ - public void setReturnHashInputData(boolean returnHashInputData) - { - this.returnHashInputData = returnHashInputData; - } - - /** - * Set the index of the signature to verify (index starting at 0). A value < 0 indicates to verify all values. - * @param verify_which - */ - public void setVerifySignatureIndex(int verify_which) { - this.verifySignatureIndex = verify_which; - } - - public int getVerifySignatureIndex() { - return verifySignatureIndex; - } - - /** - * @see VerifyParameters#setSuppressVerifyExceptions(boolean) - * @param suppress - */ - public void setSuppressVerifyExceptions(boolean suppress) { - VerifyParameters.setSuppressVerify(suppress); - } - - public boolean isSuppressVerifyExceptions() { - return VerifyParameters.isSuppressVerifyExceptions(); - } - -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyParameters.java b/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyParameters.java deleted file mode 100644 index e7301dc..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyParameters.java +++ /dev/null @@ -1,249 +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.api.verify; - -import java.util.Date; - -import at.gv.egiz.pdfas.api.commons.Constants; -import at.gv.egiz.pdfas.api.io.DataSource; - -/** - * Parameter object that holds the verify parameters. - * - * @author wprinz - */ -public class VerifyParameters -{ - // This would be a perfect point for multiple inheritance in Java. - // VerifyParameters extends AnalyzeParameters, VerifyAfterAnalysisParameters - // Then a lot of code could be easily reused in the PdfAsObject's check*Parameters methods. - - /** - * The document to be verified. - */ - protected DataSource document = null; - - /** - * The signature device to perform the actual signature. - * - *

- * May be {@link Constants#SIGNATURE_DEVICE_MOA} or - * {@link Constants#SIGNATURE_DEVICE_BKU}. - *

- */ - protected String signatureDevice = Constants.SIGNATURE_DEVICE_MOA; - - /** - * The mode of operation how the document is analyzed. - * - *

- * May be {@link Constants#VERIFY_MODE_BINARY_ONLY} to check the document for - * binary signatures only (very fast). Or may be - * {@link Constants#VERIFY_MODE_SEMI_CONSERVATIVE} to perform a semi - * conservative (optimized) text and binary verification (slow). Or may be - * {@link Constants#VERIFY_MODE_FULL_CONSERVATIVE} to perform a full - * conservative text and binary verification (very slow). - *

- */ - protected String verifyMode = Constants.VERIFY_MODE_FULL_CONSERVATIVE; - - /** - * The (zero based) index of the signature to verify. - * - *

- * This allows to verify only one found signature instead of all. {@link Constants#VERIFY_ALL} means to - * verify all found signatures. - *

- */ - protected int signatureToVerify = Constants.VERIFY_ALL; - - /** - * Allows to pass a VerificationTime to the verification device. - * - *

- * Note that the actual usage of this parameter depends on the verification device. - *

- */ - protected Date verificationTime = null; - - /** - * Tells the signature device (e.g. MOA) to return the signature hash input - * data (which is the probably transformed signed data). - * - *

- * Note that this forces MOA to return the potentially large signature data to - * be returned in the result XML, which may result in very bad performance. - *

- */ - protected boolean returnHashInputData = false; - - protected boolean returnNonTextualObjects = false; - - private static ThreadLocal suppressVerifyExceptions = new ThreadLocal(); - - - public VerifyParameters() { - suppressVerifyExceptions.set(Boolean.FALSE); - } - /** - * @return the document - */ - public DataSource getDocument() - { - return this.document; - } - - /** - * @param document - * the document to set - */ - public void setDocument(DataSource document) - { - this.document = document; - } - - /** - * @return the signatureDevice - */ - public String getSignatureDevice() - { - return this.signatureDevice; - } - - /** - * @param signatureDevice - * the signatureDevice to set - */ - public void setSignatureDevice(String signatureDevice) - { - this.signatureDevice = signatureDevice; - } - - /** - * @return the verifyMode - */ - public String getVerifyMode() - { - return this.verifyMode; - } - - /** - * @param verifyMode - * the verifyMode to set - */ - public void setVerifyMode(String verifyMode) - { - this.verifyMode = verifyMode; - } - - /** - * @return the signatureToVerify - */ - public int getSignatureToVerify() - { - return this.signatureToVerify; - } - - /** - * @param signatureToVerify - * the signatureToVerify to set - */ - public void setSignatureToVerify(int signatureToVerify) - { - this.signatureToVerify = signatureToVerify; - } - - /** - * @return the verificationTime - */ - public Date getVerificationTime() - { - return this.verificationTime; - } - - /** - * @param verificationTime - * the verificationTime to set - */ - public void setVerificationTime(Date verificationTime) - { - this.verificationTime = verificationTime; - } - - /** - * @return the returnHashInputData - */ - public boolean isReturnHashInputData() - { - return this.returnHashInputData; - } - - /** - * @param returnHashInputData - * the returnHashInputData to set - */ - public void setReturnHashInputData(boolean returnHashInputData) - { - this.returnHashInputData = returnHashInputData; - } - - public boolean isReturnNonTextualObjects() { - return this.returnNonTextualObjects; - } - - /** - * Tells if non text object of the signed pdf should be extracted and returned. - * One should show this to the user, especially in case of textual signature. - * Defaults to false - * - * @param returnNonTextualObjects - */ - public void setReturnNonTextualObjects(boolean returnNonTextualObjects) { - this.returnNonTextualObjects = returnNonTextualObjects; - } - - /** - * Set if verify exceptions (because of unknown signatures) are suppressed or not (default). - * Suppressing can be helpful for multiple signatures if you want to verify the working rest. Unsupported - * Signatures are reported without throwing an exception via {@link VerifyResult#getVerificationException()} - * @param suppress - */ - public void setSuppressVerifyExceptions(boolean suppress) { - setSuppressVerify(suppress); - } - - /** - * See {@link #setSuppressVerifyExceptions(boolean)} - * @return - */ - public static boolean isSuppressVerifyExceptions() { - if (suppressVerifyExceptions.get() == null) return false; - return ((Boolean) suppressVerifyExceptions.get()).booleanValue(); - } - - static void setSuppressVerify(boolean suppress) { - suppressVerifyExceptions.set(new Boolean(suppress)); - } - -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResult.java b/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResult.java deleted file mode 100644 index fb48e5e..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResult.java +++ /dev/null @@ -1,179 +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.api.verify; - -import java.util.Date; -import java.util.List; - -import at.gv.egiz.pdfas.api.PdfAs; -import at.gv.egiz.pdfas.api.analyze.NonTextObjectInfo; -import at.gv.egiz.pdfas.api.commons.SignatureInformation; -import at.gv.egiz.pdfas.api.exceptions.PdfAsException; -import at.gv.egiz.pdfas.api.xmldsig.XMLDsigData; - -/** - * Encapsulates the data of a verification of one signature. - * - * @author wprinz - */ -public interface VerifyResult extends SignatureInformation -{ - /** - * Returns if the verification was possible or could not even be startet. see {@link #getVerificationException()} for details. - * @return - */ - public boolean isVerificationDone(); - - /** - * Returns a verification exception if any. Shows that the verification could not be started. See {@link #isVerificationDone()}. - * @return - */ - public PdfAsException getVerificationException(); - - /** - * Returns the result of the certificate check. - * - * @return Returns the result of the certificate check. - */ - public SignatureCheck getCertificateCheck(); - - /** - * Returns the result of the value (and hash) check. - * - * @return Returns the result of the value (and hash) check. - */ - public SignatureCheck getValueCheckCode(); - - /** - * Returns the result of the manifest check. - * - * @return Returns the result of the manifest check. - */ - public SignatureCheck getManifestCheckCode(); - - /** - * Returns true, if the signer's certificate is a qualified certificate. - * - * @return Returns true, if the signer's certificate is a qualified - * certificate. - */ - public boolean isQualifiedCertificate(); - - /** - * Returns {@code true} if public authority is indicated. - * @return {@code true} if public authority. - */ - public boolean isPublicAuthority(); - - /** - * Returns the public authority code or {@code null}. - * @return The public authority code or {@code null}. - */ - public String getPublicAuthorityCode(); - - /** - * Returns a list of Strings each stating one public property of the - * certificate. - * - *

- * Such public properties are certificate extensions each being assigned an - * own OID. For example the public property "Verwaltungseigenschaft" has the - * OID "1.2.40.0.10.1.1.1". - *

- * - * @return Returns the list of Strings representing the public properties of - * this certificate, if any. - */ - public List getPublicProperties(); - - /** - * Returns the verification time, which is the time when the signature was - * verified. - * - *

- * Note that this is actually the Date passed to the verify methods over - * {@link VerifyParameters#setVerificationTime(Date)} or - * {@link VerifyAfterAnalysisParameters#setVerificationTime(Date)}. The - * signature devices don't respond the actual verification time so there is no - * guarantee that the set verification time was actually used as time of - * verification. Please consult the device's documentation for more - * information. - *

- *

- * If the verification device does not return a verification time and no - * verification time was set in the - * {@link VerifyParameters#setVerificationTime(Date)} or - * {@link VerifyAfterAnalysisParameters#setVerificationTime(Date)}, the time - * returned by this method will be equal to the signing time ( - * {@link SignatureInformation#getSigningTime()}). - *

- * - * @return Returns the verification time, which is the time when the signature - * was verified. - */ - public Date getVerificationTime(); - - /** - * Returns the hash input data as returned by MOA as Base64-encoded String. - * - *

- * This will only return a value other than null if the corresponding - * {@link VerifyParameters} has been set to true. - *

- *

- * Note that the HashInputData does not necessarily have to be exactly the - * same as the signed data return by the - * {@link SignatureInformation#getSignedData()} method. - *

- * - * @return Returns the base64 encoded hash input data as returned by MOA. - * - * @see SignatureInformation#getSignedData() - */ - public String getHashInputData(); - - /** - * 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(); - - - /** - * Returns true if non textual objects have been found, false if not. - * @return true if non textual objects have been found, false if not. - */ - public boolean hasNonTextualObjects(); - - /** - * Get the reconstructed xmldsig XML data. The reconstruction is done during the verification process. - * - * @see PdfAs#reconstructXMLDSIG(at.gv.egiz.pdfas.api.xmldsig.ReconstructXMLDsigParameters) - * @see PdfAs#reconstructXMLDSIG(at.gv.egiz.pdfas.api.xmldsig.ReconstructXMLDsigAfterAnalysisParameters) - * @return - */ - public XMLDsigData getReconstructedXMLDsig(); - -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResults.java b/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResults.java deleted file mode 100644 index 44b62a7..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResults.java +++ /dev/null @@ -1,48 +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.api.verify; - -import java.util.List; - -/** - * The result of the verification of a document. - * - *

- * Currently, this is not more than a list of VerifyResult objects, one for each - * verified signature. There may be additional items in future PDF-AS versions. - *

- * - * @author wprinz - */ -public interface VerifyResults -{ - /** - * Returns the List of VerifyResult objects, one for each verified signature. - * - * @return Returns the List of VerifyResult objects, one for each verified - * signature. - */ - public List getResults(); - -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/xmldsig/ExtendedSignatureInformation.java b/src/main/java/at/gv/egiz/pdfas/api/xmldsig/ExtendedSignatureInformation.java deleted file mode 100644 index df12b52..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/xmldsig/ExtendedSignatureInformation.java +++ /dev/null @@ -1,69 +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.api.xmldsig; - -import at.gv.egiz.pdfas.api.commons.SignatureInformation; - -/** - * A wrapper to combine {@link SignatureInformation} and {@link XMLDsigData} - * - * @author exthex - * - */ -public class ExtendedSignatureInformation { - - private final SignatureInformation signatureInformation; - - private final XMLDsigData xmlDsigData; - - /** - * Constructor. - * - * @param siginfo - * The signature information - * @param dsigData - * The matching xmldsig to the signature information. - */ - public ExtendedSignatureInformation(SignatureInformation siginfo, XMLDsigData dsigData) { - this.signatureInformation = siginfo; - this.xmlDsigData = dsigData; - } - - /** - * - * @return the signatureInformation - */ - public SignatureInformation getSignatureInformation() { - return signatureInformation; - } - - /** - * - * @return the xmlDsigData - */ - public XMLDsigData getXmlDsigData() { - return xmlDsigData; - } - -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/xmldsig/ReconstructXMLDsigAfterAnalysisParameters.java b/src/main/java/at/gv/egiz/pdfas/api/xmldsig/ReconstructXMLDsigAfterAnalysisParameters.java deleted file mode 100644 index 229fba0..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/xmldsig/ReconstructXMLDsigAfterAnalysisParameters.java +++ /dev/null @@ -1,86 +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.api.xmldsig; - -import at.gv.egiz.pdfas.api.analyze.AnalyzeResult; -import at.gv.egiz.pdfas.api.commons.Constants; - -/** - * Parameters for the reconstructXMLDsig method which is to be called after a analyze call. - * - * @author exthex - * - */ -public class ReconstructXMLDsigAfterAnalysisParameters { - - - /** - * The list of signatures to be verified. - */ - protected AnalyzeResult analyzeResult = null; - - /** - * The signature device to perform the actual signature. - * - *

- * May be {@link Constants#SIGNATURE_DEVICE_MOA} or - * {@link Constants#SIGNATURE_DEVICE_BKU}. - *

- */ - protected String signatureDevice = Constants.SIGNATURE_DEVICE_MOA; - - /** - * @return the analyzeResult - */ - public AnalyzeResult getAnalyzeResult() - { - return this.analyzeResult; - } - - /** - * @param analyzeResult - * the analyzeResult to set - */ - public void setAnalyzeResult(AnalyzeResult analyzeResult) - { - this.analyzeResult = analyzeResult; - } - - /** - * @return the signatureDevice - */ - public String getSignatureDevice() - { - return this.signatureDevice; - } - - /** - * @param signatureDevice - * the signatureDevice to set - */ - public void setSignatureDevice(String signatureDevice) - { - this.signatureDevice = signatureDevice; - } -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/xmldsig/ReconstructXMLDsigParameters.java b/src/main/java/at/gv/egiz/pdfas/api/xmldsig/ReconstructXMLDsigParameters.java deleted file mode 100644 index 445d7ae..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/xmldsig/ReconstructXMLDsigParameters.java +++ /dev/null @@ -1,218 +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.api.xmldsig; - -import java.util.Date; - -import at.gv.egiz.pdfas.api.PdfAs; -import at.gv.egiz.pdfas.api.commons.Constants; -import at.gv.egiz.pdfas.api.io.DataSource; - -/** - * Parameters for the {@link PdfAs#reconstructXMLDSIG(ReconstructXMLDsigParameters)} method. - * No need to call analyze before calling this method. - * - * @author exthex - * - */ -public class ReconstructXMLDsigParameters { - - /** - * The document to be verified. - */ - protected DataSource document = null; - - /** - * The signature device to perform the actual signature. - * - *

- * May be {@link Constants#SIGNATURE_DEVICE_MOA} or - * {@link Constants#SIGNATURE_DEVICE_BKU}. - *

- */ - protected String signatureDevice = Constants.SIGNATURE_DEVICE_MOA; - - /** - * The mode of operation how the document is analyzed. - * - *

- * May be {@link Constants#VERIFY_MODE_BINARY_ONLY} to check the document for - * binary signatures only (very fast). Or may be - * {@link Constants#VERIFY_MODE_SEMI_CONSERVATIVE} to perform a semi - * conservative (optimized) text and binary verification (slow). Or may be - * {@link Constants#VERIFY_MODE_FULL_CONSERVATIVE} to perform a full - * conservative text and binary verification (very slow). - *

- */ - protected String verifyMode = Constants.VERIFY_MODE_FULL_CONSERVATIVE; - - /** - * The (zero based) index of the signature to verify. - * - *

- * This allows to verify only one found signature instead of all. {@link Constants#VERIFY_ALL} means to - * verify all found signatures. - *

- */ - protected int signatureToVerify = Constants.VERIFY_ALL; - - /** - * Allows to pass a VerificationTime to the verification device. - * - *

- * Note that the actual usage of this parameter depends on the verification device. - *

- */ - protected Date verificationTime = null; - - /** - * Tells the signature device (e.g. MOA) to return the signature hash input - * data (which is the probably transformed signed data). - * - *

- * Note that this forces MOA to return the potentially large signature data to - * be returned in the result XML, which may result in very bad performance. - *

- */ - protected boolean returnHashInputData = false; - - protected boolean returnNonTextualObjects = false; - - /** - * @return the document - */ - public DataSource getDocument() - { - return this.document; - } - - /** - * @param document - * the document to set - */ - public void setDocument(DataSource document) - { - this.document = document; - } - - /** - * @return the signatureDevice - */ - public String getSignatureDevice() - { - return this.signatureDevice; - } - - /** - * @param signatureDevice - * the signatureDevice to set - */ - public void setSignatureDevice(String signatureDevice) - { - this.signatureDevice = signatureDevice; - } - - /** - * @return the verifyMode - */ - public String getVerifyMode() - { - return this.verifyMode; - } - - /** - * @param verifyMode - * the verifyMode to set - */ - public void setVerifyMode(String verifyMode) - { - this.verifyMode = verifyMode; - } - - /** - * @return the signatureToVerify - */ - public int getSignatureToVerify() - { - return this.signatureToVerify; - } - - /** - * @param signatureToVerify - * the signatureToVerify to set - */ - public void setSignatureToVerify(int signatureToVerify) - { - this.signatureToVerify = signatureToVerify; - } - - /** - * @return the verificationTime - */ - public Date getVerificationTime() - { - return this.verificationTime; - } - - /** - * @param verificationTime - * the verificationTime to set - */ - public void setVerificationTime(Date verificationTime) - { - this.verificationTime = verificationTime; - } - - /** - * @return the returnHashInputData - */ - public boolean isReturnHashInputData() - { - return this.returnHashInputData; - } - - /** - * @param returnHashInputData - * the returnHashInputData to set - */ - public void setReturnHashInputData(boolean returnHashInputData) - { - this.returnHashInputData = returnHashInputData; - } - - public boolean isReturnNonTextualObjects() { - return this.returnNonTextualObjects; - } - - /** - * Tells if non text object of the signed pdf should be extracted and returned. - * One should show this to the user, especially in case of textual signature. - * Defaults to false - * - * @param returnNonTextualObjects - */ - public void setReturnNonTextualObjects(boolean returnNonTextualObjects) { - this.returnNonTextualObjects = returnNonTextualObjects; - } -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/xmldsig/ReconstructXMLDsigResult.java b/src/main/java/at/gv/egiz/pdfas/api/xmldsig/ReconstructXMLDsigResult.java deleted file mode 100644 index 580f3af..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/xmldsig/ReconstructXMLDsigResult.java +++ /dev/null @@ -1,74 +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.api.xmldsig; - -import java.util.List; - -import at.gv.egiz.pdfas.api.commons.Constants; -import at.gv.egiz.pdfas.api.commons.SignatureInformation; - -/** - * The result of a reconstructXMLDsig call.
- * This is just a wrapper for a list of {@link ExtendedSignatureInformation}s - * - * - * @author exthex - */ -public class ReconstructXMLDsigResult { - - private List extendedSignatures; - - private String device; - - /** - * - * @param extendedSignatureInfos - * @param signatureDevice - */ - public ReconstructXMLDsigResult(List extendedSignatureInfos, String signatureDevice) { - this.extendedSignatures = extendedSignatureInfos; - this.device = signatureDevice; - } - - /** - * Get the signature device that was used to create this result. - * - * @return {@link Constants#SIGNATURE_DEVICE_MOA} or {@link Constants#SIGNATURE_DEVICE_BKU} - */ - public String getDevice() { - return device; - } - - /** - * Returns the list of found signatures. - * - * @return Returns a list of {@link ExtendedSignatureInformation} objects representing all - * found signatures + {@link XMLDsigData}. - * @see SignatureInformation - */ - public List getExtendedSignatures() { - return this.extendedSignatures; - } - -} diff --git a/src/main/java/at/gv/egiz/pdfas/api/xmldsig/XMLDsigData.java b/src/main/java/at/gv/egiz/pdfas/api/xmldsig/XMLDsigData.java deleted file mode 100644 index 0449cfa..0000000 --- a/src/main/java/at/gv/egiz/pdfas/api/xmldsig/XMLDsigData.java +++ /dev/null @@ -1,83 +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.api.xmldsig; - -/** - * A container for XMLDsig data. - * - * @author exthex - * - */ -public class XMLDsigData { - - private String xmlDsig; - - private boolean detached; - - /** - * Constructor. - * - * @param xmldsig the xml string of the xmldsig. - * @param detached true if detached, false otherwise - */ - public XMLDsigData(String xmldsig, boolean detached) { - this.xmlDsig = xmldsig; - this.detached = detached; - } - - /** - * Get the xmldsig string - * @return - */ - public String getXmlDsig() { - return xmlDsig; - } - - /** - * Set the xmldsig string. - * - * @param xmlDsig - */ - public void setXmlDsig(String xmlDsig) { - this.xmlDsig = xmlDsig; - } - - /** - * - * @return true if detached, false otherwise - */ - public boolean isDetached() { - return detached; - } - - /** - * Set the detached. - * - * @param detached - */ - public void setDetached(boolean detached) { - this.detached = detached; - } - -} -- cgit v1.2.3