diff options
| author | Jakob Heher <jakob.heher@iaik.tugraz.at> | 2026-04-15 13:49:22 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-04-15 13:49:22 +0200 |
| commit | 77dd3fcc4d85088b15ab859c4438521d9cd6ed10 (patch) | |
| tree | aefedc8d2ef77e6819b46a948459d6016dfe5b62 /pdf-as-legacy/src/main/java | |
| parent | 88930540361a88ff56e07fed31004b583f2e729f (diff) | |
| download | pdf-as-4-77dd3fcc4d85088b15ab859c4438521d9cd6ed10.tar.gz pdf-as-4-77dd3fcc4d85088b15ab859c4438521d9cd6ed10.tar.bz2 pdf-as-4-77dd3fcc4d85088b15ab859c4438521d9cd6ed10.zip | |
pdf-as-5 (#82)
- JDK 17
- PDFBox 3
- PDF-AS Web moved to Spring Boot
- MOA Integration tests w/ new error code
---------
Co-authored-by: Gerald Palfinger <gerald.palfinger@a-sit.at>
Co-authored-by: kathrin.resek <kathrin.resek@a-sit.at>
Diffstat (limited to 'pdf-as-legacy/src/main/java')
64 files changed, 0 insertions, 7707 deletions
diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/PdfAsFactory.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/PdfAsFactory.java deleted file mode 100644 index 431e5db2..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/PdfAsFactory.java +++ /dev/null @@ -1,154 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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; - -import java.io.File; - -import at.gv.egiz.pdfas.api.PdfAs; -import at.gv.egiz.pdfas.api.exceptions.PdfAsException; -import at.gv.egiz.pdfas.wrapper.PdfAsObject; - -/** - * Main factory for creating a PDF-AS API Instance (PdfAs Interface). - * - * @see PdfAs - * - * @author wprinz - */ -@Deprecated -public class PdfAsFactory -{ - /** - * Creates a PDF-AS API instance for the given work directory. - * - * @param workDirectory - * The work directory. If <code>null</code> the configuration is assumed to be located - * within the user's home directory. Note: IAIK JCE and IAIK ECC security provders are - * automatically registered. - * - * @return Returns an instance of the PDF-AS API. - * @throws IllegalArgumentException - * Thrown, if the workDirectory doesn't exist. - * @throws PdfAsException - * Thrown, if the work directory does not meet its requirements, or - * if the config file is invalid. - * @see PdfAS#USERHOME_CONFIG_FOLDER - */ - @Deprecated - public static PdfAs createPdfAs(File workDirectory) throws PdfAsException - { - return new PdfAsObject(workDirectory); - } - - /** - * Creates a PDF-AS API instance for the given work directory. - * - * WARNING registerProvider is IGNORED as ov Version 4.0 - * - * @param workDirectory - * The work directory. If <code>null</code> the configuration is assumed to be located - * within the user's home directory. - * - * @param registerProvider <code>true</code>: automatically registers IAIK JCE and ECC Provider; - * <code>false</code>: providers will NOT be automatically registered, providers - * needed have to be registered by the API user - * @return Returns an instance of the PDF-AS API. - * @throws IllegalArgumentException - * Thrown, if the workDirectory doesn't exist. - * @throws PdfAsException - * Thrown, if the work directory does not meet its requirements, or - * if the config file is invalid. - * @see PdfAS#USERHOME_CONFIG_FOLDER - */ - @Deprecated - public static PdfAs createPdfAs(File workDirectory, boolean registerProvider) throws PdfAsException - { - return new PdfAsObject(workDirectory); - } - - /** - * Creates a PDF-AS API instance assuming that the configuration is located within the user's - * home directory. Note: IAIK JCE and IAIK ECC security providers are automatically registered. - * - * @return Returns an instance of the PDF-AS API. - * @throws IllegalArgumentException - * Thrown, if the work directory doesn't exist within the user's home directory. - * @throws PdfAsException - * Thrown, if the work directory does not meet its requirements, or - * if the config file is invalid. - * @see PdfAS#USERHOME_CONFIG_FOLDER - */ - @Deprecated - public static PdfAs createPdfAs() throws PdfAsException - { - return createPdfAs(new File(System.getProperty("user.home") + "/.pdfas/")); - } - - /** - * Creates a PDF-AS API instance assuming that the configuration is located within the user's - * home directory. - * - * WARNING registerProvider is IGNORED as ov Version 4.0 - * - * @return Returns an instance of the PDF-AS API. - * @param registerProvider <code>true</code>: automatically registers IAIK JCE and ECC Provider; - * <code>false</code>: providers will NOT be automatically registered, providers - * needed have to be registered by the API user - * @throws IllegalArgumentException - * Thrown, if the work directory doesn't exist within the user's home directory. - * @throws PdfAsException - * Thrown, if the work directory does not meet its requirements, or - * if the config file is invalid. - * @see PdfAS#USERHOME_CONFIG_FOLDER - */ - @Deprecated - public static PdfAs createPdfAs(boolean registerProvider) throws PdfAsException - { - return createPdfAs(null, registerProvider); - } - -} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/PdfAs.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/PdfAs.java deleted file mode 100644 index f876a80a..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/PdfAs.java +++ /dev/null @@ -1,325 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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; - -/** - * The PDF-AS API main interface. - * - * <p> - * Create an Object implementing this interface using the proper factory. - * </p> - * - * @author wprinz - * @author exthex - */ -@Deprecated -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 - */ - @Deprecated - public SignResult sign(SignParameters signParameters) throws PdfAsException; - - /** - * Signs a PDF document using PDF-AS.<br/> - * 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 - */ - @Deprecated - 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 - */ - @Deprecated - 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)} - */ - @Deprecated - public AnalyzeResult analyze(AnalyzeParameters analyzeParameters) throws PdfAsException; - - /** - * Reconstruct the <xmldsig:Signature> 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 - */ - @Deprecated - public ReconstructXMLDsigResult reconstructXMLDSIG(ReconstructXMLDsigParameters reconstructXMLDsigParameters) throws PdfAsException; - - /** - * Reconstruct the <xmldsig:Signature> 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 - */ - @Deprecated - 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)} - */ - @Deprecated - 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. - */ - @Deprecated - public VerifyResults verify(VerifyAfterReconstructXMLDsigParameters verifyAfterReconstructXMLDsigParameters) throws PdfAsException; - - /** - * Reloads the configuration from the work directory. - * - * @throws PdfAsException - * Thrown, if an error occurs. - */ - @Deprecated - public void reloadConfig() throws PdfAsException; - - /** - * Returns the list of information objects about activated profiles available in the - * configuration. - * - * <p> - * Note: Currently the profile information consists of the profile Id and the - * MOA Key Id only. - * </p> - * <p> - * 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. - * </p> - * - * @return Returns the list of {@link SignatureProfile} objects with - * information about active profiles available in the configuration. - * @throws PdfAsException - * Thrown on error. - * - * @see SignatureProfile - */ - @Deprecated - 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. - */ - @Deprecated - 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. - */ - @Deprecated - 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}. - * <br> - * 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 - */ - @Deprecated - public DynamicSignatureProfile createEmptyDynamicSignatureProfile(DynamicSignatureLifetimeEnum mode); - - /** - * Create a signature profile dynamically. You have fill it with properties and apply() it for usage. See {@link SignatureProfile}. - * <br> - * 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. - */ - @Deprecated - 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 <code>null</code> if not found. - * @see DynamicSignatureProfile - */ - @Deprecated - public DynamicSignatureProfile loadDynamicSignatureProfile(String profileName); - - /** - * Prepares the signature of the given PDF document. The table for the signature data is placed but not filled.<br/> - * 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 - */ - @Deprecated - public SignatureDetailInformation prepareSign(SignParameters signParameters) throws PdfAsException; - - /** - * Finish the signature process. The PDF is filled with the signature data.<br/> - * 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 - */ - @Deprecated - public SignResult finishSign(SignParameters signParameters, SignatureDetailInformation signatureDetailInformation) throws PdfAsException; - -} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/analyze/AnalyzeParameters.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/analyze/AnalyzeParameters.java deleted file mode 100644 index ca782f81..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/analyze/AnalyzeParameters.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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 - */ -@Deprecated -public class AnalyzeParameters -{ - - /** - * The document to be analyzed. - */ - protected DataSource document = null; - - /** - * The mode of operation how the document is analyzed. - * - * <p> - * 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). - * </p> - */ - 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 <tt>false</tt> - * - * @param returnNonTextualObjects - */ - public void setReturnNonTextualObjects(boolean returnNonTextualObjects) { - this.returnNonTextualObjects = returnNonTextualObjects; - } - -} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/analyze/AnalyzeResult.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/analyze/AnalyzeResult.java deleted file mode 100644 index a371c21b..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/analyze/AnalyzeResult.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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 - * - */ -@Deprecated -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 - * <code>correct_document_on_verify_if_necessary</code>). The correction can only work for textual - * signatures. Binary signatures are lost anyhow. - * @return - */ - public boolean hasBeenCorrected(); - - -} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/analyze/NonTextObjectInfo.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/analyze/NonTextObjectInfo.java deleted file mode 100644 index fdc5880b..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/analyze/NonTextObjectInfo.java +++ /dev/null @@ -1,123 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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 - * - */ -@Deprecated -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/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/commons/Constants.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/commons/Constants.java deleted file mode 100644 index 136e0d70..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/commons/Constants.java +++ /dev/null @@ -1,213 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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; - - -/** - * Contains commonly used constants. - * - * @author wprinz - */ -@Deprecated -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. - * - * <p> - * The document text is signed, but instead of returning the pdf with the signature block, - * the sign result XML of the connector is returned. - * </p> - */ - 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. - * - * <p> - * 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. - * </p> - */ - 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 = "Adobe.PDF-AS"; - - /** - * Strict matching mode for placeholder extraction.<br/> - * 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.<br/> - * If the placeholder with the given id is not found in the document, the first placeholder without an id will be taken.<br/> - * 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.<br/> - * 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.<br/> - * 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"; - - /** - * The name of a logger used for statistical logging. - */ - public static final String STATISTIC_LOGGER_NAME = "statistic"; - -} - diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/commons/DynamicSignatureLifetimeEnum.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/commons/DynamicSignatureLifetimeEnum.java deleted file mode 100644 index ff967077..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/commons/DynamicSignatureLifetimeEnum.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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 - * - */ -@Deprecated -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/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/commons/DynamicSignatureProfile.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/commons/DynamicSignatureProfile.java deleted file mode 100644 index 535ea18c..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/commons/DynamicSignatureProfile.java +++ /dev/null @@ -1,149 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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)}.<br> - * 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()}.<br> - * Depending on the {@link DynamicSignatureLifetimeEnum} the profile can be alive and usable till you {@link #dispose()} it manually. - * <p> - * Sample usage:<br> - * <pre> - 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()); - * </pre> - * </p> - * - * @author exthex - * - */ -@Deprecated -public interface DynamicSignatureProfile { - - /** - * Get the name of the dynamic signature profile. Equals the <b>SignatureProfileId</b> - * @return - */ - public abstract String getName(); - - /** - * Set a field value for the profile. Use {@link #setPropertyRaw(String, String)} for setting any property.<br> - * For example to set <code>sig_obj.MEIN_DYN_SIGNATURBLOCK.value.SIG_META</code> just use <code>SIG_META</code> 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 <code>sig_obj.MEIN_DYN_SIGNATURBLOCK.key.SIG_META</code> use <code>key.SIG_META</code> - * @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(); - -} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/commons/DynamicSignatureProfileImpl.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/commons/DynamicSignatureProfileImpl.java deleted file mode 100644 index ce36fb9f..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/commons/DynamicSignatureProfileImpl.java +++ /dev/null @@ -1,238 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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.Iterator; -import java.util.Map; -import java.util.Properties; - -import at.gv.egiz.pdfas.api.PdfAs; -import at.gv.egiz.pdfas.common.settings.ISettings; -import at.gv.egiz.pdfas.lib.api.Configuration; -import at.knowcenter.wag.egov.egiz.sig.SignatureTypes; - -/** - * 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 - * - */ -@Deprecated -public class DynamicSignatureProfileImpl implements DynamicSignatureProfile { - private String name; - private Properties newProps = new Properties(); - private int dynamicTypeCounter = 0; - private static Map<String, DynamicSignatureProfile> profiles = - new HashMap<String, DynamicSignatureProfile>(); - private static ThreadLocal<DynamicSignatureProfile> localProfiles = new ThreadLocal<DynamicSignatureProfile>(); - private DynamicSignatureLifetimeEnum lifeMode; - private Configuration configuration; - - private DynamicSignatureProfileImpl(DynamicSignatureLifetimeEnum mode, String name, - Configuration configuration) { - if (name != null) { - this.name = name; - } else { - this.name = createDynamicTypeName(); - } - this.configuration = configuration; - this.lifeMode = mode; - } - - public static DynamicSignatureProfileImpl createFromParent(String myUniqueName, String parentProfile, - DynamicSignatureLifetimeEnum mode, Configuration configuration) { - DynamicSignatureProfileImpl res = new DynamicSignatureProfileImpl(mode, myUniqueName, configuration); - 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, - Configuration configuration) { - return new DynamicSignatureProfileImpl(mode, myUniqueName, configuration); - } - - 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 { - ISettings cfg = null; - - cfg = (ISettings)configuration; - String parentKey = "sig_obj." + parentProfile + "."; - Map<String, String> properties = cfg.getValuesPrefix(parentKey); - Iterator<String> keyIt = properties.keySet().iterator(); - - while(keyIt.hasNext()) { - String oldKey = keyIt.next(); - String newKey = oldKey.replaceAll(parentProfile, name); - String val = properties.get(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 { - Configuration cfg = this.configuration; - for (Enumeration<Object> e = newProps.keys(); e.hasMoreElements();) { - String key = (String) e.nextElement(); - cfg.setValue(key, newProps.getProperty(key)); - } - - store(); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - /* (non-Javadoc) - * @see at.gv.egiz.pdfas.api.commons.DynamicSignatureProfile#dispose() - */ - public synchronized void dispose() { - try { - Configuration cfg = this.configuration; - for (Enumeration<Object> e = newProps.keys(); e.hasMoreElements();) { - String key = (String) e.nextElement(); - cfg.setValue(key, null); - } - remove(); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - -} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/commons/SignatureInformation.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/commons/SignatureInformation.java deleted file mode 100644 index 413be0ad..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/commons/SignatureInformation.java +++ /dev/null @@ -1,153 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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 - */ -@Deprecated -public interface SignatureInformation -{ - /** - * Returns the type of this signature (binary/textual). - * - * <p> - * May be {@link Constants#SIGNATURE_TYPE_BINARY} or - * {@link Constants#SIGNATURE_TYPE_TEXTUAL}. - * </p> - * - * @return Returns the type of this signature (binary/textual). - */ - public String getSignatureType(); - - /** - * Returns the DataSource providing the data that was signed. - * - * <p> - * 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). - * </p> - * - * @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. - * - * <p> - * Information like subject name, issuer name or serial number can be - * retrieved form this certificate. - * </p> - * - * @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. - * - * <p> - * 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. - * </p> - * - * @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 <tt>null</tt> of not available (binary signature) - */ - public List getNonTextualObjects(); - - public void setNonTextualObjects(List nonTextualObjects); - - /** - * Returns <code>true</code> if non textual objects have been found, <code>false</code> if not. - * @return <code>true</code> if non textual objects have been found, <code>false</code> if not. - */ - public boolean hasNonTextualObjects(); - - -} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/commons/SignatureProfile.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/commons/SignatureProfile.java deleted file mode 100644 index f23ce5a0..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/commons/SignatureProfile.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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; - -import at.knowcenter.wag.egov.egiz.sig.SignatureTypes.State; - -/** - * Definition of a signature profile. - * - * @author wprinz - */ -@Deprecated -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.<br/> - * e.g. properties starting with <code>sig_obj.PROFILE.key.</code> and - * properties of the form <code>sig_obj.PROFILE.table.TABLENAME.NUMBER</code> - * where <code>PROFILE</code> is the name of the current profile, - * <code>TABLENAME</code> is the name of a table and <code>NUMBER</code> - * is the number of the specific row within the table <code>TABLENAME</code>. - * - * @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(); - - /** - * Returns the state of the signature profile. Signature profiles may be restricted to signature ( - * {@link State#SIGN_ONLY}) or to verification ({@link State#VERIFY_ONLY}). - * - * @return The state of the profile. - */ - public State getState(); - -} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/exceptions/ConfigUtilsException.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/exceptions/ConfigUtilsException.java deleted file mode 100644 index d130c354..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/exceptions/ConfigUtilsException.java +++ /dev/null @@ -1,146 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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 <a href="mailto:thomas.knall@egiz.gv.at">Thomas Knall</a> - */ -@Deprecated -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/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/exceptions/ErrorCode.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/exceptions/ErrorCode.java deleted file mode 100644 index 557b33dc..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/exceptions/ErrorCode.java +++ /dev/null @@ -1,139 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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; - -/** - * Contains constants for the error codes. - * - * <p> - * In Java 1.5 this would be an enum. - * </p> - * - * @author wprinz - */ -@Deprecated -public final class ErrorCode -{ - public static final int EXTERNAL_ERROR = 0; - public static final int UNKNOWN_ERROR = 6; - public static final int OUT_OF_MEMORY_ERROR = 7; - - public static final int SETTING_NOT_FOUND = 100; - public static final int SETTINGS_EXCEPTION = 101; - public static final int KZ_SETTING_NOT_FOUND = 102; - public static final int NO_EMBEDABLE_TTF_CONFIGURED_FOR_PDFA = 103; - public static final int INVALID_SIGNATURE_LAYOUT_IMPL_CONFIGURED = 104; - public static final int MISSING_HEADER_SERVER_USER_AGENT = 105; - public static final int CIRCULAR_INCLUDE_INSTRUCTION_DETECTED = 106; - public static final int UNABLE_TO_LOAD_DEFAULT_CONFIG = 107; - - public static final int DOCUMENT_CANNOT_BE_READ = 201; - public static final int TEXT_EXTRACTION_EXCEPTION = 202; - public static final int CANNOT_WRITE_PDF = 205; - public static final int DOCUMENT_NOT_SIGNED = 206; - public static final int SIGNATURE_TYPES_EXCEPTION = 223; - public static final int FONT_NOT_FOUND = 230; - public static final int DOCUMENT_IS_PROTECTED = 231; - public static final int INVALID_SIGNATURE_DICTIONARY = 232; -//23.11.2010 changed by exthex - added error code for failed extraction - public static final int SIGNATURE_PLACEHOLDER_EXTRACTION_FAILED = 233; - - /** - * Error code for {@code SignatureException}s occurring when trying to sign with a certain signature profile that - * is not allowed to be used for signature, e.g. because ist has been set to - * <p/> - * {@code sig_obj.types.<PROFILE_ID> = verify_only} - * @author Datentechnik Innovation GmbH - */ - public static final int SIGNATURE_PROFILE_IS_NOT_ALLOWED_FOR_SIGNATURE = 234; - - public static final int INVALID_SIGNATURE_POSITION = 224; - public static final int NO_TEXTUAL_CONTENT = 251; - - public static final int SIGNATURE_COULDNT_BE_CREATED = 300; - public static final int SIGNED_TEXT_EMPTY = 301; - public static final int PROFILE_NOT_DEFINED = 302; - public static final int SERIAL_NUMBER_INVALID = 303; - public static final int SIG_CERTIFICATE_CANNOT_BE_READ = 304; - public static final int PROFILE_NOT_USABLE_FOR_TEXT = 305; - - public static final int COULDNT_VERIFY = 310; - - public static final int CERTIFICATE_NOT_FOUND = 313; - public static final int NOT_SEMANTICALLY_EQUAL = 314; - - public static final int MODIFIED_AFTER_SIGNATION = 316; - public static final int NON_BINARY_SIGNATURES_PRESENT = 317; - - public static final int UNSUPPORTED_REPLACES_NAME = 318; - public static final int UNSUPPORTED_SIGNATURE = 319; - - public static final int DETACHED_SIGNATURE_NOT_SUPPORTED = 370; - - public static final int SIGNATURE_VERIFICATION_NOT_SUPPORTED = 371; - public static final int INVALID_SIGNING_TIME = 372; - - public static final int BKU_NOT_SUPPORTED = 373; - - public static final int WEB_EXCEPTION = 330; - public static final int UNABLE_TO_RECEIVE_SUITABLE_RESPONSE = 340; - - - public static final int NORMALIZER_EXCEPTION = 400; - - public static final int SESSION_EXPIRED = 600; - - public static final int PLACEHOLDER_EXCEPTION = 700; - public static final int CAPTION_NOT_FOUND_EXCEPTION = 701; - - public static final int UNABLE_TO_PARSE_ID = 800; - public static final int CORRECTOR_EXCEPTION = 801; - public static final int EXTERNAL_CORRECTOR_TIMEOUT_REACHED = 802; - - public static final int WRAPPED_ERROR_CODE = 998; - public static final int FUNCTION_NOT_AVAILABLE = 999; -} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/exceptions/PdfAsException.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/exceptions/PdfAsException.java deleted file mode 100644 index e20301e5..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/exceptions/PdfAsException.java +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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. - * - * <p> - * Every PDF-AS Exception has an error code. - * </p> - * - * @author wprinz - */ -@Deprecated -public 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/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/exceptions/PdfAsWrappedException.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/exceptions/PdfAsWrappedException.java deleted file mode 100644 index d8ea2825..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/exceptions/PdfAsWrappedException.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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; - -@Deprecated -public class PdfAsWrappedException extends PdfAsException { - - /** - * - */ - private static final long serialVersionUID = -3947240372353864753L; - - public PdfAsWrappedException(Throwable e) { - super(ErrorCode.WRAPPED_ERROR_CODE, e.getMessage(), e); - } - -} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/io/DataSink.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/io/DataSink.java deleted file mode 100644 index 9c0b6b09..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/io/DataSink.java +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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. - * - * <p> - * 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.). - * </p> - * - * @author wprinz - */ -@Deprecated -public interface DataSink -{ - /** - * Creates an OutputStream for binary data. - * - * <p> - * Note that the stream may be written only once. Creating another stream - * overwrites the existing one. - * </p> - * - * @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. - * - * <p> - * This is basically the same as {@link #createOutputStream(String)}, but - * allows to specify the character encoding. - * </p> - * - * @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. - * - * <p> - * This is only valid after a stream has been created. - * </p> - * - * @return Returns the mime type of the data stream. - */ - public String getMimeType(); - - /** - * Returns the character encoding of the data stream. - * - * <p> - * 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). - * </p> - * - * @return Returns the character encoding of the data stream. - */ - public String getCharacterEncoding(); -} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/io/DataSource.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/io/DataSource.java deleted file mode 100644 index 0bd8966a..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/io/DataSource.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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. - * - * <p> - * 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). - * </p> - * - * @author wprinz - * - */ -@Deprecated -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. - * - * <p> - * Calling this method indicates that you need a byte array for random - * <strong>read only</strong> access. The DataSource implementation should of - * course cache this byte array to avoid too much memory usage. - * </p> - * <p> - * Performance analysis has shown that the libraries internally convert the - * streams to byte arrays and that file system access is very slow. - * </p> - * <p> - * Never write to this byte array! - * </p> - * - * @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. - * - * <p> - * This makes only sense for character based mime types. - * </p> - * - * @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/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/io/FileBased.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/io/FileBased.java deleted file mode 100644 index c2a7b25f..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/io/FileBased.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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. - * - * <p> - * This is a hint that may be used by PDF-AS to optimize data access. - * </p> - * - * @author wprinz - */ -@Deprecated -public interface FileBased -{ - - /** - * Returns the File "behind" this io element. - * - * <p> - * This is usually used to determine the file name itself. - * </p> - * - * @return Returns the File "behind" this io element. - */ - public File getFile (); - -} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/io/TextBased.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/io/TextBased.java deleted file mode 100644 index fadd8bbf..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/io/TextBased.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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. - * - * <p> - * This can be used to retrieve the character text directly with the correct - * encoding etc. - * </p> - * <p> - * This makes most sense for text DataSources. - * </p> - * - * @author wprinz - */ -@Deprecated -public interface TextBased -{ - - /** - * Returns the text. - * - * @return Returns the text. - */ - public String getText(); - -} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/SignParameters.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/SignParameters.java deleted file mode 100644 index 5466d596..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/SignParameters.java +++ /dev/null @@ -1,417 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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 - */ -@Deprecated -public class SignParameters -{ -// 23.11.2010 changed by exthex - added parameters for placeholder handling - - /** - * The document to be signed. - * - * <p> - * 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 - * </p> - */ - protected DataSource document = null; - - /** - * The type of the signature. - * - * <p> - * May be {@link Constants#SIGNATURE_TYPE_BINARY} or - * {@link Constants#SIGNATURE_TYPE_TEXTUAL}. - * </p> - */ - protected String signatureType = Constants.DEFAULT_SIGNATURE_TYPE; - - /** - * The signature device to perform the actual signature. - * - * <p> - * May be {@link Constants#SIGNATURE_DEVICE_MOA} or - * {@link Constants#SIGNATURE_DEVICE_BKU}. - * </p> - */ - protected String signatureDevice = Constants.SIGNATURE_DEVICE_MOA; - - /** - * The signature profile identifier identifying the profile to be used in the - * config file. - * - * <p> - * Note: In near future it will be possible to provide a full specified - * profile here instead of the profile id. - * </p> - */ - protected String signatureProfileId = null; - - /** - * The signature key identifier specifying which signature key should be used - * by the signature device to perform the signature. - * - * <p> - * 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). - * </p> - * <p> - * Note that not all signature devices may support this parameter. - * If a signature device doesn't support this parameter the value should be null. - * </p> - * <p> - * This key is usually passed straight through to the signature device and - * thereby has to contain an appropriate value for the signature device - * chosen. - * </p> - * <p> - * 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. - * </p> - */ - 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.<br/> - * 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. - * <br/> - * 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. - * <p> - * Sample usage: - * <pre> - 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); - </pre> - * </p> - * @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 searchForPlaceHolder) { - this.checkForPlaceholder = searchForPlaceHolder; - } - - /** - * 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.<br/> - * Exactly matching meaning:<br/> - * <ul><li>If a placeholderId is set: a placeholder which has exactly this id embedded</li> - * <li>If no placeholderId is set: a placeholder without an embedded id is found</li></ul> - * - * @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/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/SignResult.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/SignResult.java deleted file mode 100644 index e18d8105..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/SignResult.java +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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 - */ -@Deprecated -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. - * - * <p> - * This information can be useful for post-processing the document. - * </p> - * - * <p> - * Consult the PDF-AS documentation section Commandline for further - * information about positioning. - * </p> - * - * @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 <tt>null</tt> 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/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/SignatureDetailInformation.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/SignatureDetailInformation.java deleted file mode 100644 index 11b063ed..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/SignatureDetailInformation.java +++ /dev/null @@ -1,171 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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 - */ -@Deprecated -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 <tt>null</tt> 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/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/SignaturePosition.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/SignaturePosition.java deleted file mode 100644 index ce73039f..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/SignaturePosition.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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. - * - * <p> - * This is usually returned after signing. - * </p> - * - * @author wprinz - */ -@Deprecated -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/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/SignaturePositioning.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/SignaturePositioning.java deleted file mode 100644 index ab5bb652..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/SignaturePositioning.java +++ /dev/null @@ -1,360 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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.exceptions.ErrorCode; -import at.gv.egiz.pdfas.api.exceptions.PdfAsException; -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; - -/** - * Defines how the signature positioning is to be performed. - * - * <p> - * This positioning allows to select the location where the signature block is - * placed in the document. - * </p> - * - * @author wprinz - */ -public class SignaturePositioning implements Serializable -{ - - /** - * - */ - private static final long serialVersionUID = 1L; - - /** - * The x axis algorithm. - * - * <p> - * May be {@link AutoAxisAlgorithm} or {@link AbsoluteAxisAlgorithm} - * </p> - */ - protected AxisAlgorithm xAlgorithm = new AutoAxisAlgorithm(); - - /** - * The y axis algorithm. - * - * <p> - * May be {@link AutoAxisAlgorithm} or {@link AbsoluteAxisAlgorithm} - * </p> - */ - protected AxisAlgorithm yAlgorithm = new AutoAxisAlgorithm(); - - /** - * The width algorithm. - * - * <p> - * May be {@link AutoAxisAlgorithm} or {@link AbsoluteAxisAlgorithm} - * </p> - */ - protected AxisAlgorithm widthAlgorithm = new AutoAxisAlgorithm(); - - /** - * The page algorithm. - * - * <p> - * May be {@link AutoPageAlgorithm}, {@link AbsolutePageAlgorithm} or - * {@link NewPageAlgorithm} - * </p> - */ - protected PageAlgorithm pageAlgorithm = new AutoPageAlgorithm(); - - /** - * Provides the position of the footline. - * - * <p> - * Only used if the pageAlgorithm is {@link AutoPageAlgorithm} and the - * yAlgorithm is {@link AutoAxisAlgorithm} - * </p> - */ - 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 PdfAsException { - 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 PdfAsException(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 PdfAsException(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 PdfAsException(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 PdfAsException(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 PdfAsException(ErrorCode.INVALID_SIGNATURE_POSITION, "Invalid signature position element: " + token); - } - } - break; - case 'f': - try { - this.setFooterLine(Float.parseFloat(value)); - } catch (NumberFormatException e) { - throw new PdfAsException(ErrorCode.INVALID_SIGNATURE_POSITION, "Invalid signature position element: " + token); - } - break; - default: - throw new PdfAsException(ErrorCode.INVALID_SIGNATURE_POSITION, "Invalid signature position element: " + token); - } - } - } - } - - public String getPositionString() { - StringBuilder sb = new StringBuilder(); - AxisAlgorithm xAlgo = getXAlgorithm(); - - if(xAlgo instanceof AutoAxisAlgorithm) { - sb.append("x:auto;"); - } else if(xAlgo instanceof AbsoluteAxisAlgorithm) { - sb.append("x:" + ((AbsoluteAxisAlgorithm)xAlgo).getAbsoluteValue() + ";"); - } - - AxisAlgorithm yAlgo = getXAlgorithm(); - - if(yAlgo instanceof AutoAxisAlgorithm) { - sb.append("y:auto;"); - } else if(yAlgo instanceof AbsoluteAxisAlgorithm) { - sb.append("y:" + ((AbsoluteAxisAlgorithm)yAlgo).getAbsoluteValue() + ";"); - } - - AxisAlgorithm wAlgo = getWidthAlgorithm(); - - if(wAlgo instanceof AutoAxisAlgorithm) { - sb.append("w:auto;"); - } else if(wAlgo instanceof AbsoluteAxisAlgorithm) { - sb.append("w:" + ((AbsoluteAxisAlgorithm)wAlgo).getAbsoluteValue() + ";"); - } - - PageAlgorithm pAlgo = getPageAlgorithm(); - - if(pAlgo instanceof AutoPageAlgorithm) { - sb.append("p:auto;"); - } else if(pAlgo instanceof NewPageAlgorithm) { - sb.append("p:new;"); - } - - float footerLine = getFooterLine(); - - sb.append("f:" + + footerLine); - - return sb.toString(); - } - - -} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/axis/AbsoluteAxisAlgorithm.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/axis/AbsoluteAxisAlgorithm.java deleted file mode 100644 index 7d550ddc..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/axis/AbsoluteAxisAlgorithm.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/axis/AutoAxisAlgorithm.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/axis/AutoAxisAlgorithm.java deleted file mode 100644 index e0fa101d..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/axis/AutoAxisAlgorithm.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/axis/AxisAlgorithm.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/axis/AxisAlgorithm.java deleted file mode 100644 index c43bca89..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/axis/AxisAlgorithm.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/axis/package-info.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/axis/package-info.java deleted file mode 100644 index 8703b27d..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/axis/package-info.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * - */ -/** - * @author afitzek - * - */ -package at.gv.egiz.pdfas.api.sign.pos.axis; diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/package-info.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/package-info.java deleted file mode 100644 index 1dbd22eb..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/package-info.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * - */ -/** - * @author afitzek - * - */ -package at.gv.egiz.pdfas.api.sign.pos; diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/page/AbsolutePageAlgorithm.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/page/AbsolutePageAlgorithm.java deleted file mode 100644 index ed17954f..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/page/AbsolutePageAlgorithm.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/page/AutoPageAlgorithm.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/page/AutoPageAlgorithm.java deleted file mode 100644 index 54365613..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/page/AutoPageAlgorithm.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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. - * - * <p> - * 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. - * </p> - * - * @author wprinz - */ -public class AutoPageAlgorithm extends PageAlgorithm implements Serializable -{ - - /** - * - */ - private static final long serialVersionUID = 1L; -// empty -} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/page/NewPageAlgorithm.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/page/NewPageAlgorithm.java deleted file mode 100644 index e3f4b9cc..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/page/NewPageAlgorithm.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/page/PageAlgorithm.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/page/PageAlgorithm.java deleted file mode 100644 index 64840d90..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/page/PageAlgorithm.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/page/package-info.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/page/package-info.java deleted file mode 100644 index 9ac906ec..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/sign/pos/page/package-info.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * - */ -/** - * @author afitzek - * - */ -package at.gv.egiz.pdfas.api.sign.pos.page; diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/timestamp/DummyTimeStamper.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/timestamp/DummyTimeStamper.java deleted file mode 100644 index ffad7790..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/timestamp/DummyTimeStamper.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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.text.SimpleDateFormat; -import java.util.Date; - -import org.apache.commons.codec.binary.Base64; -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); - SimpleDateFormat formater = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss.SSSZ"); - String ts = formater.format(new Date()); - 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/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/timestamp/TimeStamper.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/timestamp/TimeStamper.java deleted file mode 100644 index b8cb3974..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/timestamp/TimeStamper.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/timestamp/package-info.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/timestamp/package-info.java deleted file mode 100644 index 32c3fe67..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/timestamp/package-info.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * - */ -/** - * @author afitzek - * - */ -package at.gv.egiz.pdfas.api.timestamp; diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/SignatureCheck.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/SignatureCheck.java deleted file mode 100644 index 2b38819a..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/SignatureCheck.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyAfterAnalysisParameters.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyAfterAnalysisParameters.java deleted file mode 100644 index 62b7e7e4..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyAfterAnalysisParameters.java +++ /dev/null @@ -1,189 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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. - * - * <p> - * May be {@link Constants#SIGNATURE_DEVICE_MOA} or - * {@link Constants#SIGNATURE_DEVICE_BKU}. - * </p> - */ - 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). - * - * <p> - * 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. - * </p> - */ - 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/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyAfterReconstructXMLDsigParameters.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyAfterReconstructXMLDsigParameters.java deleted file mode 100644 index d5b04e43..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyAfterReconstructXMLDsigParameters.java +++ /dev/null @@ -1,192 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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. - * - * <p> - * May be {@link Constants#SIGNATURE_DEVICE_MOA} or - * {@link Constants#SIGNATURE_DEVICE_BKU}. - * </p> - */ - 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). - * - * <p> - * 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. - * </p> - */ - 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/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyParameters.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyParameters.java deleted file mode 100644 index 56e11ca1..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyParameters.java +++ /dev/null @@ -1,272 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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. - * - * <p> - * May be {@link Constants#SIGNATURE_DEVICE_MOA} or - * {@link Constants#SIGNATURE_DEVICE_BKU}. - * </p> - */ - protected String signatureDevice = Constants.SIGNATURE_DEVICE_MOA; - - /** - * The mode of operation how the document is analyzed. - * - * <p> - * 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). - * </p> - */ - protected String verifyMode = Constants.VERIFY_MODE_FULL_CONSERVATIVE; - - /** - * The (zero based) index of the signature to verify. - * - * <p> - * This allows to verify only one found signature instead of all. {@link Constants#VERIFY_ALL} means to - * verify all found signatures. - * </p> - */ - protected int signatureToVerify = Constants.VERIFY_ALL; - - /** - * Allows to pass a VerificationTime to the verification device. - * - * <p> - * Note that the actual usage of this parameter depends on the verification device. - * </p> - */ - 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). - * - * <p> - * 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. - * </p> - */ - 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 <tt>false</tt> - * - * @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/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResult.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResult.java deleted file mode 100644 index ca8ee7c4..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResult.java +++ /dev/null @@ -1,202 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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. - * - * <p> - * 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". - * </p> - * - * @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. - * - * <p> - * 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. - * </p> - * <p> - * 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()}). - * </p> - * - * @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. - * - * <p> - * This will only return a value other than null if the corresponding - * {@link VerifyParameters} has been set to true. - * </p> - * <p> - * Note that the HashInputData does not necessarily have to be exactly the - * same as the signed data return by the - * {@link SignatureInformation#getSignedData()} method. - * </p> - * - * @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 <tt>null</tt> of not available (binary signature) - */ - public List getNonTextualObjects(); - - - /** - * Returns <code>true</code> if non textual objects have been found, <code>false</code> if not. - * @return <code>true</code> if non textual objects have been found, <code>false</code> 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/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResults.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResults.java deleted file mode 100644 index 3e0f4ee0..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResults.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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. - * - * <p> - * 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. - * </p> - * - * @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/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/package-info.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/package-info.java deleted file mode 100644 index e18d1b92..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/package-info.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * - */ -/** - * @author afitzek - * - */ -package at.gv.egiz.pdfas.api.verify; diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/xmldsig/ExtendedSignatureInformation.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/xmldsig/ExtendedSignatureInformation.java deleted file mode 100644 index f2cd3598..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/xmldsig/ExtendedSignatureInformation.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/xmldsig/ReconstructXMLDsigAfterAnalysisParameters.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/xmldsig/ReconstructXMLDsigAfterAnalysisParameters.java deleted file mode 100644 index 62815fb8..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/xmldsig/ReconstructXMLDsigAfterAnalysisParameters.java +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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. - * - * <p> - * May be {@link Constants#SIGNATURE_DEVICE_MOA} or - * {@link Constants#SIGNATURE_DEVICE_BKU}. - * </p> - */ - 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/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/xmldsig/ReconstructXMLDsigParameters.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/xmldsig/ReconstructXMLDsigParameters.java deleted file mode 100644 index 03b77f1c..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/xmldsig/ReconstructXMLDsigParameters.java +++ /dev/null @@ -1,241 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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. - * - * <p> - * May be {@link Constants#SIGNATURE_DEVICE_MOA} or - * {@link Constants#SIGNATURE_DEVICE_BKU}. - * </p> - */ - protected String signatureDevice = Constants.SIGNATURE_DEVICE_MOA; - - /** - * The mode of operation how the document is analyzed. - * - * <p> - * 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). - * </p> - */ - protected String verifyMode = Constants.VERIFY_MODE_FULL_CONSERVATIVE; - - /** - * The (zero based) index of the signature to verify. - * - * <p> - * This allows to verify only one found signature instead of all. {@link Constants#VERIFY_ALL} means to - * verify all found signatures. - * </p> - */ - protected int signatureToVerify = Constants.VERIFY_ALL; - - /** - * Allows to pass a VerificationTime to the verification device. - * - * <p> - * Note that the actual usage of this parameter depends on the verification device. - * </p> - */ - 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). - * - * <p> - * 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. - * </p> - */ - 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 <tt>false</tt> - * - * @param returnNonTextualObjects - */ - public void setReturnNonTextualObjects(boolean returnNonTextualObjects) { - this.returnNonTextualObjects = returnNonTextualObjects; - } -} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/xmldsig/ReconstructXMLDsigResult.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/xmldsig/ReconstructXMLDsigResult.java deleted file mode 100644 index 01156143..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/xmldsig/ReconstructXMLDsigResult.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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.<br/> - * 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/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/xmldsig/XMLDsigData.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/xmldsig/XMLDsigData.java deleted file mode 100644 index 4f39b599..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/xmldsig/XMLDsigData.java +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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; - } - -} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/xmldsig/package-info.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/xmldsig/package-info.java deleted file mode 100644 index 7ea150ff..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/xmldsig/package-info.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * - */ -/** - * @author afitzek - * - */ -package at.gv.egiz.pdfas.api.xmldsig; diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/ByteArrayDataSink_OLD.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/ByteArrayDataSink_OLD.java deleted file mode 100644 index 95316937..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/ByteArrayDataSink_OLD.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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.wrapper; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.OutputStream; - -import at.gv.egiz.pdfas.api.io.DataSink; - -public class ByteArrayDataSink_OLD implements DataSink { - - private ByteArrayOutputStream baos = new ByteArrayOutputStream(); - - public ByteArrayOutputStream getBAOS() { - return baos; - } - - public OutputStream createOutputStream(String mimeType) throws IOException { - return baos; - } - - public OutputStream createOutputStream(String mimeType, - String characterEncoding) throws IOException { - return baos; - } - - public String getMimeType() { - return "application/pdf"; - } - - public String getCharacterEncoding() { - return "UTF-8"; - } - -} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/ByteArrayDataSource_OLD.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/ByteArrayDataSource_OLD.java deleted file mode 100644 index 152f4053..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/ByteArrayDataSource_OLD.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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.wrapper; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; - -import at.gv.egiz.pdfas.api.io.DataSource; - -public class ByteArrayDataSource_OLD implements DataSource { - - private InputStream is; - private int length; - private byte[] data; - - public ByteArrayDataSource_OLD(byte[] data) { - this.length = data.length; - this.is = new ByteArrayInputStream(data); - this.data = data; - } - - public InputStream createInputStream() { - return is; - } - - public int getLength() { - return length; - } - - public byte[] getAsByteArray() { - return this.data; - } - - public String getMimeType() { - return "application/pdf"; - } - - public String getCharacterEncoding() { - return "UTF-8"; - } - -} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/FileDataSource.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/FileDataSource.java deleted file mode 100644 index fa64f7bd..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/FileDataSource.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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.wrapper; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; - -import javax.management.RuntimeErrorException; - -import at.gv.egiz.pdfas.api.io.DataSource; -import at.gv.egiz.pdfas.common.utils.StreamUtils; - -public class FileDataSource implements DataSource { - - private byte[] data; - - public FileDataSource(File file) throws FileNotFoundException, IOException { - data = StreamUtils.inputStreamToByteArray(new FileInputStream(file)); - } - - public InputStream createInputStream() { - return new ByteArrayInputStream(data); - } - - public int getLength() { - return data.length; - } - - public byte[] getAsByteArray() { - return data; - } - - public String getMimeType() { - return "application/pdf"; - } - - public String getCharacterEncoding() { - return "UTF-8"; - } - -} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/LegacyMainTest.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/LegacyMainTest.java deleted file mode 100644 index 8838834e..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/LegacyMainTest.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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.wrapper; - -import java.io.File; -import java.io.FileOutputStream; -import java.util.Iterator; - -import at.gv.egiz.pdfas.PdfAsFactory; -import at.gv.egiz.pdfas.api.PdfAs; -import at.gv.egiz.pdfas.api.sign.SignParameters; -import at.gv.egiz.pdfas.api.verify.VerifyParameters; -import at.gv.egiz.pdfas.api.verify.VerifyResult; -import at.gv.egiz.pdfas.api.verify.VerifyResults; - -public class LegacyMainTest { - public static void main(String[] args) { - try { - PdfAs pdfAsOld = PdfAsFactory.createPdfAs(); - SignParameters signParameters = new SignParameters(); - signParameters.setSignatureProfileId("SIGNATURBLOCK_DE"); - signParameters.setSignatureDevice("bku"); - signParameters.setSignatureType("binary"); - - FileDataSource dataSource = new FileDataSource(new File("/home/afitzek/simple.pdf")); - signParameters.setDocument(dataSource); - ByteArrayDataSink_OLD dataSink = new ByteArrayDataSink_OLD(); - signParameters.setOutput(dataSink); - pdfAsOld.sign(signParameters); - - FileOutputStream fos = new FileOutputStream(new File("/home/afitzek/simple_osigned.pdf")); - fos.write(dataSink.getBAOS().toByteArray()); - fos.close(); - - VerifyParameters parameters = new VerifyParameters(); - parameters.setDocument(new FileDataSource(new File("/home/afitzek/simple_osigned.pdf"))); - parameters.setSignatureDevice("bku"); - - VerifyResults verifyResults = pdfAsOld.verify(parameters); - - Iterator<Object> verifyIt = verifyResults.getResults().iterator(); - - while(verifyIt.hasNext()) { - Object obj = verifyIt.next(); - VerifyResult verify = (VerifyResult)obj; - System.out.println("Verify Code: " + verify.getValueCheckCode().getCode()); - } - - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/PdfAsObject.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/PdfAsObject.java deleted file mode 100644 index 798fcd6f..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/PdfAsObject.java +++ /dev/null @@ -1,299 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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.wrapper; - -import iaik.x509.X509Certificate; - -import java.io.File; -import java.io.IOException; -import java.security.cert.CertificateEncodingException; -import java.security.cert.CertificateException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import at.gv.egiz.pdfas.api.PdfAs; -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.DynamicSignatureProfileImpl; -import at.gv.egiz.pdfas.api.exceptions.ErrorCode; -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.sign.pos.SignaturePosition; -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.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.lib.api.ByteArrayDataSource; -import at.gv.egiz.pdfas.lib.api.Configuration; -import at.gv.egiz.pdfas.lib.api.PdfAsFactory; -import at.gv.egiz.pdfas.lib.api.StatusRequest; -import at.gv.egiz.pdfas.lib.api.sign.SignParameter; -import at.gv.egiz.pdfas.lib.api.verify.VerifyParameter; -import at.gv.egiz.pdfas.lib.api.verify.VerifyResult; -import at.gv.egiz.pdfas.lib.impl.SignaturePositionImpl; -import at.gv.egiz.pdfas.lib.impl.StatusRequestImpl; - -public class PdfAsObject implements PdfAs { - - private at.gv.egiz.pdfas.lib.api.PdfAs pdfas4; - private Configuration configuration; - private File workdir; - - public SignResult sign(SignParameters signParameters) throws PdfAsException { - SignatureDetailInformation signatureDetailInformation = this - .prepareSign(signParameters); - return this.sign(signParameters, signatureDetailInformation); - } - - public SignResult sign(SignParameters signParameters, - SignatureDetailInformation signatureDetailInformation) - throws PdfAsException { - - if (!(signatureDetailInformation instanceof SignatureDetailInformationWrapper)) { - throw new PdfAsException(ErrorCode.SIGNATURE_COULDNT_BE_CREATED, - "Invalid state"); - } - - SignatureDetailInformationWrapper sdi = (SignatureDetailInformationWrapper) signatureDetailInformation; - StatusRequest statusRequest = sdi.getStatus(); - - if (!(statusRequest instanceof StatusRequestImpl)) { - throw new PdfAsException(ErrorCode.SIGNATURE_COULDNT_BE_CREATED, - "Invalid state"); - } - - StatusRequestImpl request = (StatusRequestImpl) statusRequest; - - if (request.needSignature()) { - try { - byte[] signature = sdi.wrapper.getSignParameter4().getPlainSigner().sign( - request.getSignatureData(), request.getSignatureDataByteRange(), sdi.wrapper.getSignParameter4(), - request.getStatus().getRequestedSignature()); - request.setSigature(signature); - request = (StatusRequestImpl) this.pdfas4.process(request); - if(request.isReady()) { - at.gv.egiz.pdfas.lib.api.sign.SignResult result = this.pdfas4.finishSign(request); - sdi.wrapper.syncNewToOld(result); - SignResultImpl oldresult = new SignResultImpl(sdi.wrapper.getSignParameters().getOutput(), - sdi.getX509Certificate(), new at.gv.egiz.pdfas.wrapper.SignaturePositionImpl( - result.getSignaturePosition())); - return oldresult; - } else { - throw new PdfAsException(ErrorCode.SIGNATURE_COULDNT_BE_CREATED, - "Invalid state"); - } - } catch (at.gv.egiz.pdfas.common.exceptions.PdfAsException e) { - e.printStackTrace(); - throw new PdfAsException( - ErrorCode.SIGNATURE_COULDNT_BE_CREATED, e.getMessage()); - - } catch (at.gv.egiz.pdfas.common.exceptions.PDFASError e) { - e.printStackTrace(); - throw new PdfAsException( - ErrorCode.SIGNATURE_COULDNT_BE_CREATED, e.getMessage()); - - } - } else { - throw new PdfAsException(ErrorCode.SIGNATURE_COULDNT_BE_CREATED, - "Invalid state"); - } - } - - public VerifyResults verify(VerifyParameters verifyParameters) - throws PdfAsException { - try { - VerifyParameter newParameter = VerifyParameterWrapper - .toNewParameters(verifyParameters, this.pdfas4.getConfiguration()); - - List<VerifyResult> results = this.pdfas4.verify(newParameter); - - Iterator<VerifyResult> it = results.iterator(); - - List<at.gv.egiz.pdfas.api.verify.VerifyResult> resultList = new ArrayList<at.gv.egiz.pdfas.api.verify.VerifyResult>(); - - while (it.hasNext()) { - VerifyResult newResult = it.next(); - at.gv.egiz.pdfas.api.verify.VerifyResult oldResult = new VerifyResultWrapper( - newResult); - resultList.add(oldResult); - } - - return new VerifyResultsImpl(resultList); - } catch (at.gv.egiz.pdfas.common.exceptions.PDFASError e) { - throw new PdfAsException(0, e.getMessage()); - } - } - - public AnalyzeResult analyze(AnalyzeParameters analyzeParameters) - throws PdfAsException { - throw new PdfAsException(ErrorCode.FUNCTION_NOT_AVAILABLE, - new RuntimeException()); - } - - public ReconstructXMLDsigResult reconstructXMLDSIG( - ReconstructXMLDsigParameters reconstructXMLDsigParameters) - throws PdfAsException { - throw new PdfAsException(ErrorCode.FUNCTION_NOT_AVAILABLE, - new RuntimeException()); - } - - public ReconstructXMLDsigResult reconstructXMLDSIG( - ReconstructXMLDsigAfterAnalysisParameters reconstructXMLDsigParameters) - throws PdfAsException { - throw new PdfAsException(ErrorCode.FUNCTION_NOT_AVAILABLE, - new RuntimeException()); - } - - public VerifyResults verify( - VerifyAfterAnalysisParameters verifyAfterAnalysisParameters) - throws PdfAsException { - throw new PdfAsException(ErrorCode.FUNCTION_NOT_AVAILABLE, - new RuntimeException()); - } - - public VerifyResults verify( - VerifyAfterReconstructXMLDsigParameters verifyAfterReconstructXMLDsigParameters) - throws PdfAsException { - throw new PdfAsException(ErrorCode.FUNCTION_NOT_AVAILABLE, - new RuntimeException()); - } - - public void reloadConfig() throws PdfAsException { - this.pdfas4 = at.gv.egiz.pdfas.lib.api.PdfAsFactory - .createPdfAs(this.workdir); - this.configuration = this.pdfas4.getConfiguration(); - } - - public List getProfileInformation() throws PdfAsException { - throw new PdfAsException(ErrorCode.FUNCTION_NOT_AVAILABLE, - new RuntimeException()); - } - - public DynamicSignatureProfile createDynamicSignatureProfile( - String parentProfile, DynamicSignatureLifetimeEnum mode) { - return DynamicSignatureProfileImpl.createFromParent(null, - parentProfile, mode, configuration); - } - - public DynamicSignatureProfile createDynamicSignatureProfile( - String myUniqueName, String parentProfile, - DynamicSignatureLifetimeEnum mode) { - return DynamicSignatureProfileImpl.createFromParent(myUniqueName, - parentProfile, mode, configuration); - } - - public DynamicSignatureProfile createEmptyDynamicSignatureProfile( - DynamicSignatureLifetimeEnum mode) { - return DynamicSignatureProfileImpl.createEmptyProfile(null, mode, - configuration); - } - - public DynamicSignatureProfile createEmptyDynamicSignatureProfile( - String myUniqueName, DynamicSignatureLifetimeEnum mode) { - return DynamicSignatureProfileImpl.createEmptyProfile(myUniqueName, - mode, configuration); - } - - public DynamicSignatureProfile loadDynamicSignatureProfile( - String profileName) { - return DynamicSignatureProfileImpl.loadProfile(profileName); - } - - public SignatureDetailInformation prepareSign(SignParameters signParameters) - throws PdfAsException { - try { - // Prepare Signature - - SignParameter signParameter4 = PdfAsFactory.createSignParameter( - this.configuration, new ByteArrayDataSource(signParameters - .getDocument().getAsByteArray()), - signParameters.getOutput() - .createOutputStream("application/pdf")); - - SignParameterWrapper wrapper = new SignParameterWrapper( - signParameters, signParameter4); - SignatureDetailInformationWrapper sdi = null; - - wrapper.syncOldToNew(); - - StatusRequest request = this.pdfas4.startSign(wrapper - .getSignParameter4()); - - if (request.needCertificate()) { - X509Certificate certificate = signParameter4.getPlainSigner() - .getCertificate(signParameter4); - sdi = new SignatureDetailInformationWrapper(certificate); - request.setCertificate(certificate.getEncoded()); - request = this.pdfas4.process(request); - if (request.needSignature()) { - sdi.setDataSource(new ByteArrayDataSource_OLD(request - .getSignatureData())); - } - sdi.wrapper = wrapper; - sdi.setStatus(request); - } - - return sdi; - } catch (at.gv.egiz.pdfas.common.exceptions.PdfAsException e) { - throw new PdfAsException(ErrorCode.SIGNATURE_COULDNT_BE_CREATED, - e.getMessage()); - } catch (CertificateEncodingException e) { - throw new PdfAsException(ErrorCode.SIGNATURE_COULDNT_BE_CREATED, - e.getMessage()); - } catch (CertificateException e) { - throw new PdfAsException(ErrorCode.SIGNATURE_COULDNT_BE_CREATED, - e.getMessage()); - } catch (at.gv.egiz.pdfas.common.exceptions.PDFASError e) { - e.printStackTrace(); - throw new PdfAsException( - ErrorCode.SIGNATURE_COULDNT_BE_CREATED, e.getMessage()); - } catch (IOException e) { - e.printStackTrace(); - throw new PdfAsException( - ErrorCode.SIGNATURE_COULDNT_BE_CREATED, e.getMessage()); - } - } - - public SignResult finishSign(SignParameters signParameters, - SignatureDetailInformation signatureDetailInformation) - throws PdfAsException { - return sign(signParameters, signatureDetailInformation); - } - - public PdfAsObject(File workdirectory) { - this.workdir = workdirectory; - this.pdfas4 = at.gv.egiz.pdfas.lib.api.PdfAsFactory - .createPdfAs(workdirectory); - this.configuration = this.pdfas4.getConfiguration(); - } - -} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignParameterWrapper.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignParameterWrapper.java deleted file mode 100644 index 7349dbec..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignParameterWrapper.java +++ /dev/null @@ -1,126 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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.wrapper; - -import java.io.OutputStream; -import java.util.Enumeration; - -import org.apache.commons.io.IOUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import at.gv.egiz.pdfas.api.exceptions.ErrorCode; -import at.gv.egiz.pdfas.api.exceptions.PdfAsException; -import at.gv.egiz.pdfas.api.sign.SignParameters; -import at.gv.egiz.pdfas.lib.api.sign.SignParameter; -import at.gv.egiz.pdfas.lib.api.sign.SignResult; -import at.gv.egiz.pdfas.moa.MOAConnector; -import at.gv.egiz.pdfas.sigs.pades.PAdESSigner; -import at.gv.egiz.sl.util.BKUSLConnector; - -public class SignParameterWrapper { - - private static final Logger logger = LoggerFactory - .getLogger(SignParameterWrapper.class); - - private SignParameter signParameter4; - private SignParameters signParameters; - - public SignParameterWrapper(SignParameters signParameters, - SignParameter signParameter4) { - this.signParameter4 = signParameter4; - this.signParameters = signParameters; - } - - public void syncOldToNew() throws PdfAsException { - - if (this.signParameters.getSignaturePositioning() != null) { - // Create positioning string - String posString = this.signParameters.getSignaturePositioning() - .getPositionString(); - logger.info("Pos String: " + posString); - if (posString.equals("x:auto;y:auto;w:auto;p:auto;f:0.0")) { - this.signParameter4.setSignaturePosition(null); - } else { - this.signParameter4.setSignaturePosition(posString); - } - } else { - this.signParameter4.setSignaturePosition(null); - } - - // Select signing device - if (this.signParameters.getSignatureDevice().equals("moa")) { - try { - this.signParameter4 - .setPlainSigner(new PAdESSigner(new MOAConnector( - this.signParameter4.getConfiguration()))); - } catch (Exception e) { - throw new PdfAsException(ErrorCode.CERTIFICATE_NOT_FOUND, - "You need to specify MOA certificate file to use moa (moa.sign.Certificate)"); - } - } else if (this.signParameters.getSignatureDevice().equals("bku")) { - this.signParameter4 - .setPlainSigner(new PAdESSigner(new BKUSLConnector( - this.signParameter4.getConfiguration()))); - } else { - throw new PdfAsException(ErrorCode.UNSUPPORTED_SIGNATURE, - "Unsupported device! Use bku or moa!"); - } - - // Overwrite Configurations - Enumeration<Object> keys = this.signParameters - .getProfileOverrideProperties().keys(); - - while (keys.hasMoreElements()) { - Object obj = keys.nextElement(); - if (obj != null) { - String key = obj.toString(); - this.signParameter4.getConfiguration().setValue( - key, - this.signParameters.getProfileOverrideProperties() - .getProperty(key)); - } - } - } - - public void syncNewToOld(SignResult result) throws PdfAsException { - try { - //OutputStream os = this.signParameters.getOutput() - // .createOutputStream("application/pdf"); - //IOUtils.copy(result.getOutputDocument(), os); - //os.close(); - } catch (Exception e) { - throw new PdfAsException(ErrorCode.SIGNATURE_COULDNT_BE_CREATED, - e.getMessage()); - } - } - - public SignParameter getSignParameter4() { - return this.signParameter4; - } - - public SignParameters getSignParameters() { - return this.signParameters; - } -} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignResultImpl.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignResultImpl.java deleted file mode 100644 index 60711717..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignResultImpl.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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.wrapper; - -import java.security.cert.X509Certificate; -import java.util.List; - -import at.gv.egiz.pdfas.api.io.DataSink; -import at.gv.egiz.pdfas.api.sign.SignResult; -import at.gv.egiz.pdfas.api.sign.pos.SignaturePosition; - -public class SignResultImpl implements SignResult { - - private DataSink sink; - private X509Certificate certificate; - private SignaturePosition position; - - public SignResultImpl(DataSink data, X509Certificate cert, SignaturePosition position) { - this.certificate = cert; - this.sink = data; - this.position = position; - } - - public DataSink getOutputDocument() { - return this.sink; - } - - public X509Certificate getSignerCertificate() { - return certificate; - } - - public SignaturePosition getSignaturePosition() { - return position; - } - - public List getNonTextualObjects() { - return null; - } - - public boolean hasNonTextualObjects() { - return false; - } - -} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignatureCheckWrapper.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignatureCheckWrapper.java deleted file mode 100644 index 743a7bf2..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignatureCheckWrapper.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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.wrapper; - -import at.gv.egiz.pdfas.api.verify.SignatureCheck; - -public class SignatureCheckWrapper implements SignatureCheck { - - private at.gv.egiz.pdfas.lib.api.verify.SignatureCheck newCheck; - - public SignatureCheckWrapper(at.gv.egiz.pdfas.lib.api.verify.SignatureCheck newCheck) { - this.newCheck = newCheck; - } - - public int getCode() { - return this.newCheck.getCode(); - } - - public String getMessage() { - return this.newCheck.getMessage(); - } - -} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignatureDetailInformationWrapper.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignatureDetailInformationWrapper.java deleted file mode 100644 index 9a01297c..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignatureDetailInformationWrapper.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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.wrapper; - -import java.security.cert.X509Certificate; -import java.util.Date; -import java.util.List; -import java.util.Map; - -import at.gv.egiz.pdfas.api.io.DataSource; -import at.gv.egiz.pdfas.api.sign.SignatureDetailInformation; -import at.gv.egiz.pdfas.api.sign.pos.SignaturePosition; -import at.gv.egiz.pdfas.common.utils.DNUtils; -import at.gv.egiz.pdfas.lib.api.StatusRequest; - -public class SignatureDetailInformationWrapper implements - SignatureDetailInformation { - - public SignParameterWrapper wrapper; - private StatusRequest status; - private DataSource dataSource; - private iaik.x509.X509Certificate certificate; - - public SignatureDetailInformationWrapper(iaik.x509.X509Certificate cert) { - this.certificate = cert; - } - - public StatusRequest getStatus() { - return status; - } - - public void setStatus(StatusRequest status) { - this.status = status; - } - - - public void setDataSource(DataSource dataSource) { - this.dataSource = dataSource; - } - - public DataSource getSignatureData() { - return this.dataSource; - } - - public SignaturePosition getSignaturePosition() { - return null; - } - - public List getNonTextualObjects() { - return null; - } - - public Date getSignDate() { - return null; - } - - public String getIssuer() { - return this.certificate.getIssuerDN().getName(); - } - - public Map getIssuerDNMap() { - try { - return DNUtils.dnToMap(getIssuer()); - } catch (Exception e) { - e.printStackTrace(); - return null; - } - } - - public String getSubjectName() { - return this.certificate.getSubjectDN().getName(); - } - - public String getSerialNumber() { - return this.certificate.getSerialNumber().toString(); - } - - public String getSigAlgorithm() { - return this.certificate.getSigAlgName(); - } - - public String getSigID() { - return null; - } - - public String getSigKZ() { - return null; - } - - public String getSignatureValue() { - return null; - } - - public String getSigTimeStamp() { - return null; - } - - public Map getSubjectDNMap() { - try { - return DNUtils.dnToMap(getSubjectName()); - } catch (Exception e) { - e.printStackTrace(); - return null; - } - } - - public X509Certificate getX509Certificate() { - return this.certificate; - } - - public boolean isTextual() { - return false; - } - - public boolean isBinary() { - return true; - } - -} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignaturePositionImpl.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignaturePositionImpl.java deleted file mode 100644 index 82da0d59..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/SignaturePositionImpl.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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.wrapper; - -import at.gv.egiz.pdfas.api.sign.pos.SignaturePosition; - -public class SignaturePositionImpl implements SignaturePosition { - - private at.gv.egiz.pdfas.lib.api.SignaturePosition position; - - public SignaturePositionImpl(at.gv.egiz.pdfas.lib.api.SignaturePosition position) { - this.position = position; - } - - - public int getPage() { - return this.position.getPage(); - } - - public float getX() { - return this.position.getX(); - } - - public float getY() { - return this.position.getY(); - } - - public float getWidth() { - return this.position.getWidth(); - } - - public float getHeight() { - return this.position.getHeight(); - } - -} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/VerifyParameterWrapper.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/VerifyParameterWrapper.java deleted file mode 100644 index e8e89cb4..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/VerifyParameterWrapper.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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.wrapper; - -import at.gv.egiz.pdfas.api.verify.VerifyParameters; -import at.gv.egiz.pdfas.lib.api.ByteArrayDataSource; -import at.gv.egiz.pdfas.lib.api.Configuration; -import at.gv.egiz.pdfas.lib.api.PdfAsFactory; -import at.gv.egiz.pdfas.lib.api.verify.VerifyParameter; - -public class VerifyParameterWrapper { - - public static VerifyParameter toNewParameters(VerifyParameters oldParameters, Configuration config) { - VerifyParameter parameter = PdfAsFactory.createVerifyParameter(config, - new ByteArrayDataSource(oldParameters.getDocument().getAsByteArray())); - - parameter.setWhichSignature(oldParameters.getSignatureToVerify()); - parameter.setVerificationTime(oldParameters.getVerificationTime()); - return parameter; - } - -} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/VerifyResultWrapper.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/VerifyResultWrapper.java deleted file mode 100644 index 770e7f3b..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/VerifyResultWrapper.java +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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.wrapper; - -import java.io.InputStream; -import java.security.cert.X509Certificate; -import java.util.Date; -import java.util.List; - -import at.gv.egiz.pdfas.api.commons.Constants; -import at.gv.egiz.pdfas.api.exceptions.PdfAsException; -import at.gv.egiz.pdfas.api.exceptions.PdfAsWrappedException; -import at.gv.egiz.pdfas.api.io.DataSource; -import at.gv.egiz.pdfas.api.verify.SignatureCheck; -import at.gv.egiz.pdfas.api.verify.VerifyResult; -import at.gv.egiz.pdfas.api.xmldsig.XMLDsigData; - -public class VerifyResultWrapper implements VerifyResult { - - private at.gv.egiz.pdfas.lib.api.verify.VerifyResult newResult; - - public VerifyResultWrapper(at.gv.egiz.pdfas.lib.api.verify.VerifyResult newResult) { - this.newResult = newResult; - } - - public String getSignatureType() { - return null; - } - - public DataSource getSignedData() { - return new ByteArrayDataSource_OLD(this.newResult.getSignatureData()); - } - - public X509Certificate getSignerCertificate() { - return this.newResult.getSignerCertificate(); - } - - public Date getSigningTime() { - return null; - } - - public Object getInternalSignatureInformation() { - return null; - } - - public String getTimeStampValue() { - return null; - } - - public void setNonTextualObjects(List nonTextualObjects) { - } - - public boolean isVerificationDone() { - return this.newResult.isVerificationDone(); - } - - public PdfAsException getVerificationException() { - return new PdfAsWrappedException(this.newResult.getVerificationException()); - } - - public SignatureCheck getCertificateCheck() { - return new SignatureCheckWrapper(this.newResult.getCertificateCheck()); - } - - public SignatureCheck getValueCheckCode() { - return new SignatureCheckWrapper(this.newResult.getValueCheckCode()); - } - - public SignatureCheck getManifestCheckCode() { - return new SignatureCheckWrapper(this.newResult.getManifestCheckCode()); - } - - public boolean isQualifiedCertificate() { - return this.newResult.isQualifiedCertificate(); - } - - public boolean isPublicAuthority() { - return false; - } - - public String getPublicAuthorityCode() { - return null; - } - - public List getPublicProperties() { - return null; - } - - public Date getVerificationTime() { - return null; - } - - public String getHashInputData() { - return null; - } - - public List getNonTextualObjects() { - return null; - } - - public boolean hasNonTextualObjects() { - return false; - } - - public XMLDsigData getReconstructedXMLDsig() { - return null; - } - - - -} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/VerifyResultsImpl.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/VerifyResultsImpl.java deleted file mode 100644 index d99db8bb..00000000 --- a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/wrapper/VerifyResultsImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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.wrapper; - -import java.util.List; - -import at.gv.egiz.pdfas.api.verify.VerifyResult; -import at.gv.egiz.pdfas.api.verify.VerifyResults; - -public class VerifyResultsImpl implements VerifyResults { - - private List<VerifyResult> list; - - public VerifyResultsImpl(List<VerifyResult> list) { - this.list = list; - } - - public List getResults() { - return this.list; - } - -} diff --git a/pdf-as-legacy/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypes.java b/pdf-as-legacy/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypes.java deleted file mode 100644 index 8bd69ef2..00000000 --- a/pdf-as-legacy/src/main/java/at/knowcenter/wag/egov/egiz/sig/SignatureTypes.java +++ /dev/null @@ -1,253 +0,0 @@ -/******************************************************************************* - * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> - * 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. - ******************************************************************************/ -/** - * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> - * 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: SignatureTypes.java,v 1.5 2006/10/31 08:18:56 wprinz Exp $ - */ -package at.knowcenter.wag.egov.egiz.sig; - -import org.apache.commons.lang3.ArrayUtils; - -public class SignatureTypes { - - /** - * Defines all supported states for {@link SignatureTypes} (signature - * profiles). Signature types can be enabled ("on"), can be set to support - * signature only ("sign_only"), to verification only ("verify_only") or can - * be disabled ("off" or any other value not covered by other enum values). - * - * @author Datentechnik Innovation GmbH - */ - public enum State { - - /** - * Enables a signature profile. - */ - ON("on", "yes", "true", "enabled"), - - /** - * Disables a signature profile. - */ - OFF(), - - /** - * Restricts the signature profile so that is can only be used for - * verification purposes and not for signature. - */ - VERIFY_ONLY("verify_only", "verify-only", "verifyonly", "verify only", - "verify"), - - /** - * Allows the signature profile to be used for signature but not for - * verification. - */ - SIGN_ONLY("sign_only", "sign-only", "signonly", "sign only", "sign"); - - /** - * Sets the default state when no valid value was provided. - */ - private static final State DEFAULT = OFF; - - /** - * States that allow signatures. - */ - private static final State[] CAN_SIGN = { ON, SIGN_ONLY }; - - /** - * States that allow verification. - */ - private static final State[] CAN_VERIFY = { ON, VERIFY_ONLY }; - - private String[] keyWords; - - private State(String... keyWords) { - this.keyWords = keyWords; - } - - /** - * Returns a valid State from a given {@code keyWord}. If the - * {@code keyWord} cannot be matched to a certain state, the default - * State {@link #OFF} is returned. - * - * @param keyWord - * A valid keyword like "on", "sign_only"... - * @return The enum State. - */ - public static State fromString(String keyWord) { - if (keyWord == null) { - return DEFAULT; - } - try { - return valueOf(keyWord.toUpperCase()); - } catch (IllegalArgumentException e) { - for (State candidate : values()) { - for (String candidateKeyWord : candidate.keyWords) { - if (keyWord.equalsIgnoreCase(candidateKeyWord)) { - return candidate; - } - } - } - return DEFAULT; - } - } - - /** - * Returns {@code true} when the current state is one of the given - * candidate {@code states}. - * - * @param states - * The candidate states. - * @return {@code true} when the current state is one of the given - * candidate states, {@code false} if not. - */ - public boolean in(State... states) { - if (states != null) { - for (State state : states) { - if (this == state) { - return true; - } - } - } - return false; - } - - /** - * Returns if the respective state allows signatures. - * - * @return {@code true} if signatures are allowed, {@code false} if not. - */ - public boolean canSign() { - return in(CAN_SIGN); - } - - /** - * Returns if the respective state allows verification. - * - * @return {@code true} if verification is allowed, {@code false} if - * not. - */ - public boolean canVerify() { - return in(CAN_VERIFY); - } - - } - - /** - * Standard key get/set the singature name - */ - public static final String SIG_NAME = "SIG_NAME"; - - /** - * Standard key get/set the signature date - */ - public static final String SIG_DATE = "SIG_DATE"; - - /** - * Standard key get/set the signator issuer - */ - public static final String SIG_ISSUER = "SIG_ISSUER"; - - /** - * Standard key get/set the siganture value - */ - public static final String SIG_VALUE = "SIG_VALUE"; - - /** - * Standard key get/set the normalisation method used - */ - public static final String SIG_NORM = "SIG_NORM"; - - /** - * Standard key get/set the signation id's used by BKU signated documents - */ - public static final String SIG_ID = "SIG_ID"; - - /** - * The EGIZ Algorithm "Kennzeichnung". - */ - public static final String SIG_KZ = "SIG_KZ"; - - /** - * Standard key get/set the reference to the signature label (image mark) - */ - public static final String SIG_LABEL = "SIG_LABEL"; - - /** - * Standard key get/set the serial number of the signature - */ - public static final String SIG_NUMBER = "SIG_NUMBER"; - - // public static final String SIG_TYPE = "SIG_TYPE"; - /** - * Standard key get/set the signature meta informations - */ - public static final String SIG_META = "SIG_META"; - - /** - * Standard key get/set the signature algorithm (sign + hash) - */ - public static final String SIG_ALG = "SIG_ALG"; - - /** - * Standard key get/set the signature note - * added by rpiazzi - */ - public static final String SIG_NOTE = "SIG_NOTE"; - - - /** - * Standard key get/set the signature subject - * Added to be able to define static signator name within config file - * added by rpiazzi - */ - public static final String SIG_SUBJECT = "SIG_SUBJECT"; - - public static String[] REQUIRED_SIG_KEYS = new String[] { SIG_DATE, - SIG_ISSUER, SIG_VALUE, SIG_NUMBER, SIG_ID, SIG_KZ }; - - public static boolean isRequredSigTypeKey(String name) { - return ArrayUtils.contains(REQUIRED_SIG_KEYS, name); - } -} |
