From ab7a38ff2956d427b598704e9309912593ff1d87 Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Thu, 20 Feb 2014 12:03:32 +0100 Subject: Added license text --- .../main/java/at/gv/egiz/pdfas/PdfAsFactory.java | 285 ++++---- .../src/main/java/at/gv/egiz/pdfas/api/PdfAs.java | 627 ++++++++-------- .../egiz/pdfas/api/analyze/AnalyzeParameters.java | 239 +++--- .../gv/egiz/pdfas/api/analyze/AnalyzeResult.java | 151 ++-- .../egiz/pdfas/api/analyze/NonTextObjectInfo.java | 223 +++--- .../at/gv/egiz/pdfas/api/commons/Constants.java | 403 +++++----- .../api/commons/DynamicSignatureLifetimeEnum.java | 169 +++-- .../pdfas/api/commons/DynamicSignatureProfile.java | 275 +++---- .../api/commons/DynamicSignatureProfileImpl.java | 479 ++++++------ .../pdfas/api/commons/SignatureInformation.java | 283 +++---- .../egiz/pdfas/api/commons/SignatureProfile.java | 199 ++--- .../pdfas/api/exceptions/ConfigUtilsException.java | 269 +++---- .../at/gv/egiz/pdfas/api/exceptions/ErrorCode.java | 255 ++++--- .../egiz/pdfas/api/exceptions/PdfAsException.java | 221 +++--- .../api/exceptions/PdfAsWrappedException.java | 23 + .../java/at/gv/egiz/pdfas/api/io/DataSink.java | 221 +++--- .../java/at/gv/egiz/pdfas/api/io/DataSource.java | 213 +++--- .../java/at/gv/egiz/pdfas/api/io/FileBased.java | 127 ++-- .../java/at/gv/egiz/pdfas/api/io/TextBased.java | 125 ++-- .../at/gv/egiz/pdfas/api/sign/SignParameters.java | 811 +++++++++++---------- .../java/at/gv/egiz/pdfas/api/sign/SignResult.java | 193 ++--- .../pdfas/api/sign/SignatureDetailInformation.java | 319 ++++---- .../egiz/pdfas/api/sign/pos/SignaturePosition.java | 169 +++-- .../pdfas/api/sign/pos/SignaturePositioning.java | 697 +++++++++--------- .../api/sign/pos/axis/AbsoluteAxisAlgorithm.java | 147 ++-- .../pdfas/api/sign/pos/axis/AutoAxisAlgorithm.java | 105 +-- .../pdfas/api/sign/pos/axis/AxisAlgorithm.java | 105 +-- .../egiz/pdfas/api/sign/pos/axis/package-info.java | 25 +- .../gv/egiz/pdfas/api/sign/pos/package-info.java | 25 +- .../api/sign/pos/page/AbsolutePageAlgorithm.java | 151 ++-- .../pdfas/api/sign/pos/page/AutoPageAlgorithm.java | 117 +-- .../pdfas/api/sign/pos/page/NewPageAlgorithm.java | 105 +-- .../pdfas/api/sign/pos/page/PageAlgorithm.java | 105 +-- .../egiz/pdfas/api/sign/pos/page/package-info.java | 25 +- .../egiz/pdfas/api/timestamp/DummyTimeStamper.java | 149 ++-- .../gv/egiz/pdfas/api/timestamp/TimeStamper.java | 105 +-- .../gv/egiz/pdfas/api/timestamp/package-info.java | 25 +- .../gv/egiz/pdfas/api/verify/SignatureCheck.java | 125 ++-- .../api/verify/VerifyAfterAnalysisParameters.java | 355 ++++----- .../VerifyAfterReconstructXMLDsigParameters.java | 361 ++++----- .../gv/egiz/pdfas/api/verify/VerifyParameters.java | 521 ++++++------- .../at/gv/egiz/pdfas/api/verify/VerifyResult.java | 381 +++++----- .../at/gv/egiz/pdfas/api/verify/VerifyResults.java | 119 +-- .../at/gv/egiz/pdfas/api/verify/package-info.java | 25 +- .../api/xmldsig/ExtendedSignatureInformation.java | 161 ++-- .../ReconstructXMLDsigAfterAnalysisParameters.java | 195 ++--- .../api/xmldsig/ReconstructXMLDsigParameters.java | 459 ++++++------ .../api/xmldsig/ReconstructXMLDsigResult.java | 171 +++-- .../at/gv/egiz/pdfas/api/xmldsig/XMLDsigData.java | 189 ++--- .../at/gv/egiz/pdfas/api/xmldsig/package-info.java | 25 +- .../egiz/pdfas/wrapper/ByteArrayDataSink_OLD.java | 23 + .../pdfas/wrapper/ByteArrayDataSource_OLD.java | 23 + .../at/gv/egiz/pdfas/wrapper/FileDataSource.java | 23 + .../at/gv/egiz/pdfas/wrapper/LegacyMainTest.java | 23 + .../java/at/gv/egiz/pdfas/wrapper/PdfAsObject.java | 23 + .../egiz/pdfas/wrapper/SignParameterWrapper.java | 23 + .../at/gv/egiz/pdfas/wrapper/SignResultImpl.java | 23 + .../egiz/pdfas/wrapper/SignatureCheckWrapper.java | 23 + .../wrapper/SignatureDetailInformationWrapper.java | 23 + .../egiz/pdfas/wrapper/SignaturePositionImpl.java | 23 + .../egiz/pdfas/wrapper/VerifyParameterWrapper.java | 23 + .../gv/egiz/pdfas/wrapper/VerifyResultWrapper.java | 23 + .../gv/egiz/pdfas/wrapper/VerifyResultsImpl.java | 23 + 63 files changed, 6500 insertions(+), 5051 deletions(-) (limited to 'pdf-as-legacy/src/main/java/at/gv') 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 index c09dbd40..431e5db2 100644 --- 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 @@ -1,131 +1,154 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas; - -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 null 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 null the configuration is assumed to be located - * within the user's home directory. - * - * @param registerProvider true: automatically registers IAIK JCE and ECC Provider; - * false: 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 true: automatically registers IAIK JCE and ECC Provider; - * false: 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); - } - -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas; + +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 null 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 null the configuration is assumed to be located + * within the user's home directory. + * + * @param registerProvider true: automatically registers IAIK JCE and ECC Provider; + * false: 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 true: automatically registers IAIK JCE and ECC Provider; + * false: 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 index 505360c1..f876a80a 100644 --- 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 @@ -1,302 +1,325 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api; - -import java.util.List; - -import at.gv.egiz.pdfas.api.analyze.AnalyzeParameters; -import at.gv.egiz.pdfas.api.analyze.AnalyzeResult; -import at.gv.egiz.pdfas.api.commons.DynamicSignatureLifetimeEnum; -import at.gv.egiz.pdfas.api.commons.DynamicSignatureProfile; -import at.gv.egiz.pdfas.api.commons.SignatureProfile; -import at.gv.egiz.pdfas.api.exceptions.PdfAsException; -import at.gv.egiz.pdfas.api.sign.SignParameters; -import at.gv.egiz.pdfas.api.sign.SignResult; -import at.gv.egiz.pdfas.api.sign.SignatureDetailInformation; -import at.gv.egiz.pdfas.api.verify.VerifyAfterAnalysisParameters; -import at.gv.egiz.pdfas.api.verify.VerifyAfterReconstructXMLDsigParameters; -import at.gv.egiz.pdfas.api.verify.VerifyParameters; -import at.gv.egiz.pdfas.api.verify.VerifyResult; -import at.gv.egiz.pdfas.api.verify.VerifyResults; -import at.gv.egiz.pdfas.api.xmldsig.ReconstructXMLDsigAfterAnalysisParameters; -import at.gv.egiz.pdfas.api.xmldsig.ReconstructXMLDsigParameters; -import at.gv.egiz.pdfas.api.xmldsig.ReconstructXMLDsigResult; - -/** - * The PDF-AS API main interface. - * - *

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

- * - * @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.
- * 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 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 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. - * - *

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

- *

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

- * - * @return Returns the list of {@link SignatureProfile} objects with - * information about active profiles available in the configuration. - * @throws PdfAsException - * Thrown on error. - * - * @see SignatureProfile - */ - @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}. - *
- * 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}. - *
- * 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 null 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.
- * 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.
- * 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; - -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api; + +import java.util.List; + +import at.gv.egiz.pdfas.api.analyze.AnalyzeParameters; +import at.gv.egiz.pdfas.api.analyze.AnalyzeResult; +import at.gv.egiz.pdfas.api.commons.DynamicSignatureLifetimeEnum; +import at.gv.egiz.pdfas.api.commons.DynamicSignatureProfile; +import at.gv.egiz.pdfas.api.commons.SignatureProfile; +import at.gv.egiz.pdfas.api.exceptions.PdfAsException; +import at.gv.egiz.pdfas.api.sign.SignParameters; +import at.gv.egiz.pdfas.api.sign.SignResult; +import at.gv.egiz.pdfas.api.sign.SignatureDetailInformation; +import at.gv.egiz.pdfas.api.verify.VerifyAfterAnalysisParameters; +import at.gv.egiz.pdfas.api.verify.VerifyAfterReconstructXMLDsigParameters; +import at.gv.egiz.pdfas.api.verify.VerifyParameters; +import at.gv.egiz.pdfas.api.verify.VerifyResult; +import at.gv.egiz.pdfas.api.verify.VerifyResults; +import at.gv.egiz.pdfas.api.xmldsig.ReconstructXMLDsigAfterAnalysisParameters; +import at.gv.egiz.pdfas.api.xmldsig.ReconstructXMLDsigParameters; +import at.gv.egiz.pdfas.api.xmldsig.ReconstructXMLDsigResult; + +/** + * The PDF-AS API main interface. + * + *

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

+ * + * @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.
+ * 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 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 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. + * + *

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

+ *

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

+ * + * @return Returns the list of {@link SignatureProfile} objects with + * information about active profiles available in the configuration. + * @throws PdfAsException + * Thrown on error. + * + * @see SignatureProfile + */ + @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}. + *
+ * 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}. + *
+ * 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 null 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.
+ * 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.
+ * 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 index 164aa464..ca782f81 100644 --- 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 @@ -1,108 +1,131 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.analyze; - -import at.gv.egiz.pdfas.api.commons.Constants; -import at.gv.egiz.pdfas.api.io.DataSource; - -/** - * Parameter object that holds the analyze parameters. - * - * @author wprinz - */ -@Deprecated -public class AnalyzeParameters -{ - - /** - * The document to be analyzed. - */ - protected DataSource document = null; - - /** - * The mode of operation how the document is analyzed. - * - *

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

- */ - protected String verifyMode = Constants.VERIFY_MODE_FULL_CONSERVATIVE; - - protected boolean returnNonTextualObjects = false; - - protected boolean hasBeenCorrected = false; - - /** - * @return the document - */ - public DataSource getDocument() - { - return this.document; - } - - /** - * @param document the document to set - */ - public void setDocument(DataSource document) - { - this.document = document; - } - - /** - * @return the verifyMode - */ - public String getVerifyMode() - { - return this.verifyMode; - } - - /** - * @param verifyMode the verifyMode to set - */ - public void setVerifyMode(String verifyMode) - { - this.verifyMode = verifyMode; - } - - public boolean isReturnNonTextualObjects() { - return this.returnNonTextualObjects; - } - - /** - * Tells if non text object of the signed pdf should be extracted and returned. - * One should show this to the user, especially in case of textual signature. - * Defaults to false - * - * @param returnNonTextualObjects - */ - public void setReturnNonTextualObjects(boolean returnNonTextualObjects) { - this.returnNonTextualObjects = returnNonTextualObjects; - } - -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.analyze; + +import at.gv.egiz.pdfas.api.commons.Constants; +import at.gv.egiz.pdfas.api.io.DataSource; + +/** + * Parameter object that holds the analyze parameters. + * + * @author wprinz + */ +@Deprecated +public class AnalyzeParameters +{ + + /** + * The document to be analyzed. + */ + protected DataSource document = null; + + /** + * The mode of operation how the document is analyzed. + * + *

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

+ */ + protected String verifyMode = Constants.VERIFY_MODE_FULL_CONSERVATIVE; + + protected boolean returnNonTextualObjects = false; + + protected boolean hasBeenCorrected = false; + + /** + * @return the document + */ + public DataSource getDocument() + { + return this.document; + } + + /** + * @param document the document to set + */ + public void setDocument(DataSource document) + { + this.document = document; + } + + /** + * @return the verifyMode + */ + public String getVerifyMode() + { + return this.verifyMode; + } + + /** + * @param verifyMode the verifyMode to set + */ + public void setVerifyMode(String verifyMode) + { + this.verifyMode = verifyMode; + } + + public boolean isReturnNonTextualObjects() { + return this.returnNonTextualObjects; + } + + /** + * Tells if non text object of the signed pdf should be extracted and returned. + * One should show this to the user, especially in case of textual signature. + * Defaults to false + * + * @param returnNonTextualObjects + */ + public void setReturnNonTextualObjects(boolean returnNonTextualObjects) { + this.returnNonTextualObjects = returnNonTextualObjects; + } + +} diff --git a/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 index 43c23190..a371c21b 100644 --- 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 @@ -1,64 +1,87 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.analyze; - -import java.util.List; - -import at.gv.egiz.pdfas.api.commons.SignatureInformation; -import at.gv.egiz.pdfas.api.exceptions.PdfAsException; - -/** - * The result of an analyze operation, which is a list of verifyable signatures. - * - * @author wprinz - * - */ -@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 - * correct_document_on_verify_if_necessary). The correction can only work for textual - * signatures. Binary signatures are lost anyhow. - * @return - */ - public boolean hasBeenCorrected(); - - -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.analyze; + +import java.util.List; + +import at.gv.egiz.pdfas.api.commons.SignatureInformation; +import at.gv.egiz.pdfas.api.exceptions.PdfAsException; + +/** + * The result of an analyze operation, which is a list of verifyable signatures. + * + * @author wprinz + * + */ +@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 + * correct_document_on_verify_if_necessary). The correction can only work for textual + * signatures. Binary signatures are lost anyhow. + * @return + */ + public boolean hasBeenCorrected(); + + +} diff --git a/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 index 311cff45..fdc5880b 100644 --- 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 @@ -1,100 +1,123 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.analyze; - -/** - * Encapsulates information about non textual objects in a pdf document. - * - * @author dferbas - * - */ -@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 + "]"; - } - -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.analyze; + +/** + * Encapsulates information about non textual objects in a pdf document. + * + * @author dferbas + * + */ +@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 index 568787b4..136e0d70 100644 --- 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 @@ -1,190 +1,213 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.commons; - - -/** - * 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. - * - *

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

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

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

- */ - public static final String VERIFY_MODE_SEMI_CONSERVATIVE = "semiConservative"; - - /** - * Binary and textual signatures are verified. - */ - public static final String VERIFY_MODE_FULL_CONSERVATIVE = "fullConservative"; - - /** - * All signatures are verified. - */ - public static final int VERIFY_ALL = -1; - - /** - * The system property that may be used to declare the pdf-as configuration folder. - */ - public static final String CONFIG_DIR_SYSTEM_PROPERTY = "pdf-as.work-dir"; - - /** - * The zip file containing the default configuration. - */ - public static final String DEFAULT_CONFIGURATION_ZIP_RESOURCE = "DefaultConfiguration.zip"; - - /** - * The configuration folder for pdf-as within the user's home folder. - */ - public static final String USERHOME_CONFIG_FOLDER = "PDF-AS"; - - /** - * The name of the directory, where temporary files are stored. - */ - public static final String TEMP_DIR_NAME = "pdfastmp"; - - public static final String BKU_HEADER_SIGNATURE_LAYOUT = "SignatureLayout"; - - public static final String ADOBE_SIG_FILTER = "Adobe.PDF-AS"; - - /** - * Strict matching mode for placeholder extraction.
- * If the placeholder with the given id is not found in the document, an exception will be thrown. - */ - public static final int PLACEHOLDER_MATCH_MODE_STRICT = 0; - - /** - * A moderate matching mode for placeholder extraction.
- * If the placeholder with the given id is not found in the document, the first placeholder without an id will be taken.
- * If there is no such placeholder, the signature will be placed as usual, according to the pos parameter of the signature profile used. - */ - public static final int PLACEHOLDER_MATCH_MODE_MODERATE = 1; - - /** - * A more lenient matching mode for placeholder extraction.
- * If the placeholder with the given id is not found in the document, the first found placeholder will be taken, regardless if it has an id set, or not.
- * If there is no placeholder at all, the signature will be placed as usual, according to the pos parameter of the signature profile used. - */ - public static final int PLACEHOLDER_MATCH_MODE_LENIENT = 2; - - /** - * Identifier for QR based placeholders. - */ - public static final String QR_PLACEHOLDER_IDENTIFIER = "PDF-AS-POS"; - - /** - * The name of a logger used for statistical logging. - */ - public static final String STATISTIC_LOGGER_NAME = "statistic"; - -} - +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.commons; + + +/** + * 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. + * + *

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

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

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

+ */ + public static final String VERIFY_MODE_SEMI_CONSERVATIVE = "semiConservative"; + + /** + * Binary and textual signatures are verified. + */ + public static final String VERIFY_MODE_FULL_CONSERVATIVE = "fullConservative"; + + /** + * All signatures are verified. + */ + public static final int VERIFY_ALL = -1; + + /** + * The system property that may be used to declare the pdf-as configuration folder. + */ + public static final String CONFIG_DIR_SYSTEM_PROPERTY = "pdf-as.work-dir"; + + /** + * The zip file containing the default configuration. + */ + public static final String DEFAULT_CONFIGURATION_ZIP_RESOURCE = "DefaultConfiguration.zip"; + + /** + * The configuration folder for pdf-as within the user's home folder. + */ + public static final String USERHOME_CONFIG_FOLDER = "PDF-AS"; + + /** + * The name of the directory, where temporary files are stored. + */ + public static final String TEMP_DIR_NAME = "pdfastmp"; + + public static final String BKU_HEADER_SIGNATURE_LAYOUT = "SignatureLayout"; + + public static final String ADOBE_SIG_FILTER = "Adobe.PDF-AS"; + + /** + * Strict matching mode for placeholder extraction.
+ * If the placeholder with the given id is not found in the document, an exception will be thrown. + */ + public static final int PLACEHOLDER_MATCH_MODE_STRICT = 0; + + /** + * A moderate matching mode for placeholder extraction.
+ * If the placeholder with the given id is not found in the document, the first placeholder without an id will be taken.
+ * If there is no such placeholder, the signature will be placed as usual, according to the pos parameter of the signature profile used. + */ + public static final int PLACEHOLDER_MATCH_MODE_MODERATE = 1; + + /** + * A more lenient matching mode for placeholder extraction.
+ * If the placeholder with the given id is not found in the document, the first found placeholder will be taken, regardless if it has an id set, or not.
+ * If there is no placeholder at all, the signature will be placed as usual, according to the pos parameter of the signature profile used. + */ + public static final int PLACEHOLDER_MATCH_MODE_LENIENT = 2; + + /** + * Identifier for QR based placeholders. + */ + public static final String QR_PLACEHOLDER_IDENTIFIER = "PDF-AS-POS"; + + /** + * 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 index 369bff87..ff967077 100644 --- 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 @@ -1,73 +1,96 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.commons; - -import java.io.Serializable; - -/** - * Pseudo enum defining lifetime models for {@link DynamicSignatureProfile}s. - * - * @author exthex - * - */ -@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; - } - - - -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.commons; + +import java.io.Serializable; + +/** + * Pseudo enum defining lifetime models for {@link DynamicSignatureProfile}s. + * + * @author exthex + * + */ +@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 index 9620d2fe..535ea18c 100644 --- 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 @@ -1,126 +1,149 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.commons; - -import at.gv.egiz.pdfas.api.PdfAs; -import at.gv.egiz.pdfas.api.sign.SignParameters; - -/** - * A dynamic signature profile. It is used to define a signature profile like the ones from pdf-as/config.properties at runtime. - * After creation via {@link PdfAs} you can set properties via {@link #setPropertyRaw(String, String)} - * or {@link #setFieldValue(String, String)}.
- * You have to call {@link #apply()} to use the profile. The identifying name (e.g. for {@link SignParameters#setSignatureProfileId(String)} - * can be obtained via {@link #getName()}.
- * Depending on the {@link DynamicSignatureLifetimeEnum} the profile can be alive and usable till you {@link #dispose()} it manually. - *

- * Sample usage:
- *

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

- * - * @author exthex - * - */ -@Deprecated -public interface DynamicSignatureProfile { - - /** - * Get the name of the dynamic signature profile. Equals the SignatureProfileId - * @return - */ - public abstract String getName(); - - /** - * Set a field value for the profile. Use {@link #setPropertyRaw(String, String)} for setting any property.
- * For example to set sig_obj.MEIN_DYN_SIGNATURBLOCK.value.SIG_META just use SIG_META as fieldName. - * @param fieldName the name of the field - * @param value the value to set - */ - public abstract void setFieldValue(String fieldName, String value); - - /** - * Get a field value from the profile. See {@link #setFieldValue(String, String)} - * @param fieldName - * @return - */ - public abstract String getFieldValue(String fieldName); - - /** - * Set any property for the signature profile. - * Uses the same keys as the property file without the "prefix" for the profile. - * For example to set sig_obj.MEIN_DYN_SIGNATURBLOCK.key.SIG_META use key.SIG_META - * @param key property key - * @param val property value - */ - public void setPropertyRaw(String key, String val); - - /** - * Get any property from the signature profile. See {@link #setPropertyRaw(String, String)} for details. - * @param key - * @return - */ - public String getPropertyRaw(String key); - - /** - * Apply the signature profile. Call this after all properties are set and you want to use the profile. It is then added - * to the globally available signature profiles. Depending on the lifetime model {@link DynamicSignatureLifetimeEnum} you - * have to {@link #dispose()} it manually when not needed anymore. - */ - public abstract void apply(); - - /** - * Disposes the signature profile from the global store. Call this for {@link DynamicSignatureLifetimeEnum#MANUAL} only. - */ - public abstract void dispose(); - -} \ No newline at end of file +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.commons; + +import at.gv.egiz.pdfas.api.PdfAs; +import at.gv.egiz.pdfas.api.sign.SignParameters; + +/** + * A dynamic signature profile. It is used to define a signature profile like the ones from pdf-as/config.properties at runtime. + * After creation via {@link PdfAs} you can set properties via {@link #setPropertyRaw(String, String)} + * or {@link #setFieldValue(String, String)}.
+ * You have to call {@link #apply()} to use the profile. The identifying name (e.g. for {@link SignParameters#setSignatureProfileId(String)} + * can be obtained via {@link #getName()}.
+ * Depending on the {@link DynamicSignatureLifetimeEnum} the profile can be alive and usable till you {@link #dispose()} it manually. + *

+ * Sample usage:
+ *

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

+ * + * @author exthex + * + */ +@Deprecated +public interface DynamicSignatureProfile { + + /** + * Get the name of the dynamic signature profile. Equals the SignatureProfileId + * @return + */ + public abstract String getName(); + + /** + * Set a field value for the profile. Use {@link #setPropertyRaw(String, String)} for setting any property.
+ * For example to set sig_obj.MEIN_DYN_SIGNATURBLOCK.value.SIG_META just use SIG_META as fieldName. + * @param fieldName the name of the field + * @param value the value to set + */ + public abstract void setFieldValue(String fieldName, String value); + + /** + * Get a field value from the profile. See {@link #setFieldValue(String, String)} + * @param fieldName + * @return + */ + public abstract String getFieldValue(String fieldName); + + /** + * Set any property for the signature profile. + * Uses the same keys as the property file without the "prefix" for the profile. + * For example to set sig_obj.MEIN_DYN_SIGNATURBLOCK.key.SIG_META use key.SIG_META + * @param key property key + * @param val property value + */ + public void setPropertyRaw(String key, String val); + + /** + * Get any property from the signature profile. See {@link #setPropertyRaw(String, String)} for details. + * @param key + * @return + */ + public String getPropertyRaw(String key); + + /** + * Apply the signature profile. Call this after all properties are set and you want to use the profile. It is then added + * to the globally available signature profiles. Depending on the lifetime model {@link DynamicSignatureLifetimeEnum} you + * have to {@link #dispose()} it manually when not needed anymore. + */ + public abstract void apply(); + + /** + * Disposes the signature profile from the global store. Call this for {@link DynamicSignatureLifetimeEnum#MANUAL} only. + */ + public abstract void dispose(); + +} 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 index 71317a52..4bf896b6 100644 --- 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 @@ -1,228 +1,251 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.commons; - -import java.util.Enumeration; -import java.util.HashMap; -import java.util.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; - -// TODO exception types? -/** - * Implementation class of the {@link DynamicSignatureProfile}. Don't use this class directly. Use {@link PdfAs} to create and the - * {@link DynamicSignatureProfile} interface for manipulation. - * @author exthex - * - */ -@Deprecated -public class DynamicSignatureProfileImpl implements DynamicSignatureProfile { - private String name; - private Properties newProps = new Properties(); - private int dynamicTypeCounter = 0; - private static Map profiles = - new HashMap(); - private static ThreadLocal localProfiles = new ThreadLocal(); - private DynamicSignatureLifetimeEnum lifeMode; - private 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 properties = cfg.getValuesPrefix(parentKey); - //Properties props = cfg.getProperties(); - // DTI: props.keys() does not support default properties, therefore we should better use props.propertyNames() -// for (Enumeration e = props.keys(); e.hasMoreElements();) { - /*for (Enumeration e = props.propertyNames(); e.hasMoreElements();) { - String oldKey = (String) e.nextElement(); - if (oldKey.startsWith("sig_obj." + parentProfile + ".")) { - String newKey = StringUtils.replace(oldKey, parentProfile, name); - String val = props.getProperty(oldKey); - this.newProps.put(newKey, val); - } - }*/ - - Iterator 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 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 e = newProps.keys(); e.hasMoreElements();) { - String key = (String) e.nextElement(); - cfg.setValue(key, null); - } - remove(); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.commons; + +import java.util.Enumeration; +import java.util.HashMap; +import java.util.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; + +// TODO exception types? +/** + * Implementation class of the {@link DynamicSignatureProfile}. Don't use this class directly. Use {@link PdfAs} to create and the + * {@link DynamicSignatureProfile} interface for manipulation. + * @author exthex + * + */ +@Deprecated +public class DynamicSignatureProfileImpl implements DynamicSignatureProfile { + private String name; + private Properties newProps = new Properties(); + private int dynamicTypeCounter = 0; + private static Map profiles = + new HashMap(); + private static ThreadLocal localProfiles = new ThreadLocal(); + private DynamicSignatureLifetimeEnum lifeMode; + private 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 properties = cfg.getValuesPrefix(parentKey); + //Properties props = cfg.getProperties(); + // DTI: props.keys() does not support default properties, therefore we should better use props.propertyNames() +// for (Enumeration e = props.keys(); e.hasMoreElements();) { + /*for (Enumeration e = props.propertyNames(); e.hasMoreElements();) { + String oldKey = (String) e.nextElement(); + if (oldKey.startsWith("sig_obj." + parentProfile + ".")) { + String newKey = StringUtils.replace(oldKey, parentProfile, name); + String val = props.getProperty(oldKey); + this.newProps.put(newKey, val); + } + }*/ + + Iterator 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 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 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 index 2f5c7d97..413be0ad 100644 --- 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 @@ -1,130 +1,153 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - * - * $Id: SignatureHolder.java,v 1.3 2006/10/11 07:57:58 wprinz Exp $ - */ -package at.gv.egiz.pdfas.api.commons; - -import java.security.cert.X509Certificate; -import java.util.Date; -import java.util.List; - -import at.gv.egiz.pdfas.api.analyze.NonTextObjectInfo; -import at.gv.egiz.pdfas.api.io.DataSource; - -/** - * Holds the information of one found signature block, which is the signed data - * and the corresponding signature information. - * - * @author wprinz - */ -@Deprecated -public interface SignatureInformation -{ - /** - * Returns the type of this signature (binary/textual). - * - *

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

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

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

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

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

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

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

- * - * @return Returns additional, internal information about the signature. Null - * means that no additional information is available. - */ - public Object getInternalSignatureInformation(); - - /** - * Returns the embedded /TimeStamp value (b64 encoded) from the signature if available. - * @return - */ - public String getTimeStampValue(); - - /** - * Returns a list<{@link NonTextObjectInfo}> of non textual objects in the pdf document. - * Only available for textual signatures. Show this to the user who signed the textual content only! - * @return List<{@link NonTextObjectInfo} or null of not available (binary signature) - */ - public List getNonTextualObjects(); - - public void setNonTextualObjects(List nonTextualObjects); - - /** - * Returns true if non textual objects have been found, false if not. - * @return true if non textual objects have been found, false if not. - */ - public boolean hasNonTextualObjects(); - - -} \ No newline at end of file +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + * + * $Id: SignatureHolder.java,v 1.3 2006/10/11 07:57:58 wprinz Exp $ + */ +package at.gv.egiz.pdfas.api.commons; + +import java.security.cert.X509Certificate; +import java.util.Date; +import java.util.List; + +import at.gv.egiz.pdfas.api.analyze.NonTextObjectInfo; +import at.gv.egiz.pdfas.api.io.DataSource; + +/** + * Holds the information of one found signature block, which is the signed data + * and the corresponding signature information. + * + * @author wprinz + */ +@Deprecated +public interface SignatureInformation +{ + /** + * Returns the type of this signature (binary/textual). + * + *

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

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

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

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

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

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

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

+ * + * @return Returns additional, internal information about the signature. Null + * means that no additional information is available. + */ + public Object getInternalSignatureInformation(); + + /** + * Returns the embedded /TimeStamp value (b64 encoded) from the signature if available. + * @return + */ + public String getTimeStampValue(); + + /** + * Returns a list<{@link NonTextObjectInfo}> of non textual objects in the pdf document. + * Only available for textual signatures. Show this to the user who signed the textual content only! + * @return List<{@link NonTextObjectInfo} or null of not available (binary signature) + */ + public List getNonTextualObjects(); + + public void setNonTextualObjects(List nonTextualObjects); + + /** + * Returns true if non textual objects have been found, false if not. + * @return true if non textual objects have been found, false if not. + */ + public boolean hasNonTextualObjects(); + + +} 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 index def2d820..f23ce5a0 100644 --- 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 @@ -1,88 +1,111 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.commons; - -import java.util.Properties; - -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.
- * e.g. properties starting with sig_obj.PROFILE.key. and - * properties of the form sig_obj.PROFILE.table.TABLENAME.NUMBER - * where PROFILE is the name of the current profile, - * TABLENAME is the name of a table and NUMBER - * is the number of the specific row within the table TABLENAME. - * - * @return The entries relevant to the signature block search algorithm as - * Java properties. - */ - public Properties getSignatureBlockEntries(); - - /** - * Returns the profile description. - * - * @return The profile description. - */ - public String getProfileDescription(); - - /** - * True only if this is the default profile according to config. - * @return - */ - public boolean isDefault(); - - /** - * 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(); - -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.commons; + +import java.util.Properties; + +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.
+ * e.g. properties starting with sig_obj.PROFILE.key. and + * properties of the form sig_obj.PROFILE.table.TABLENAME.NUMBER + * where PROFILE is the name of the current profile, + * TABLENAME is the name of a table and NUMBER + * is the number of the specific row within the table TABLENAME. + * + * @return The entries relevant to the signature block search algorithm as + * Java properties. + */ + public Properties getSignatureBlockEntries(); + + /** + * Returns the profile description. + * + * @return The profile description. + */ + public String getProfileDescription(); + + /** + * True only if this is the default profile according to config. + * @return + */ + public boolean isDefault(); + + /** + * 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 index f8059d16..d130c354 100644 --- 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 @@ -1,123 +1,146 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.exceptions; - -/** - * @author Thomas Knall - */ -@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(); - } - } - -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.exceptions; + +/** + * @author Thomas Knall + */ +@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 index c5364abc..557b33dc 100644 --- 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 @@ -1,116 +1,139 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.exceptions; - -/** - * Contains constants for the error codes. - * - *

- * In Java 1.5 this would be an enum. - *

- * - * @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 - *

- * {@code sig_obj.types. = 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; -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.exceptions; + +/** + * Contains constants for the error codes. + * + *

+ * In Java 1.5 this would be an enum. + *

+ * + * @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 + *

+ * {@code sig_obj.types. = 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 index fb602934..e20301e5 100644 --- 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 @@ -1,99 +1,122 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.exceptions; - -/** - * This exception is the base for all PDF-AS exceptions. - * - *

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

- * - * @author wprinz - */ -@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; - } -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.exceptions; + +/** + * This exception is the base for all PDF-AS exceptions. + * + *

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

+ * + * @author wprinz + */ +@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 index c5fb3fd3..d8ea2825 100644 --- 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 @@ -1,3 +1,26 @@ +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ package at.gv.egiz.pdfas.api.exceptions; @Deprecated 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 index 5163822d..9c0b6b09 100644 --- 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 @@ -1,99 +1,122 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.io; - -import java.io.IOException; -import java.io.OutputStream; - -/** - * Output document data sink. - * - *

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

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

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

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

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

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

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

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

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

- * - * @return Returns the character encoding of the data stream. - */ - public String getCharacterEncoding(); -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.io; + +import java.io.IOException; +import java.io.OutputStream; + +/** + * Output document data sink. + * + *

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

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

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

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

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

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

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

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

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

+ * + * @return Returns the character encoding of the data stream. + */ + public String getCharacterEncoding(); +} diff --git a/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 index dfeb6261..0bd8966a 100644 --- 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 @@ -1,95 +1,118 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.io; - -import java.io.InputStream; - -/** - * Input document data source. - * - *

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

- * - * @author wprinz - * - */ -@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. - * - *

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

- *

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

- *

- * Never write to this byte array! - *

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

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

- * - * @return Returns the character encoding of the data or null if no encoding - * is applicable (e.g. if the data is binary). - */ - public String getCharacterEncoding(); - -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.io; + +import java.io.InputStream; + +/** + * Input document data source. + * + *

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

+ * + * @author wprinz + * + */ +@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. + * + *

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

+ *

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

+ *

+ * Never write to this byte array! + *

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

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

+ * + * @return Returns the character encoding of the data or null if no encoding + * is applicable (e.g. if the data is binary). + */ + public String getCharacterEncoding(); + +} diff --git a/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 index c09f480b..c2a7b25f 100644 --- 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 @@ -1,52 +1,75 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.io; - -import java.io.File; - -/** - * Tells that the IO element (DataSink or DataSource) is backed by a file in the local file system. - * - *

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

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

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

- * - * @return Returns the File "behind" this io element. - */ - public File getFile (); - -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.io; + +import java.io.File; + +/** + * Tells that the IO element (DataSink or DataSource) is backed by a file in the local file system. + * + *

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

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

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

+ * + * @return Returns the File "behind" this io element. + */ + public File getFile (); + +} diff --git a/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 index 9e3987ba..fadd8bbf 100644 --- 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 @@ -1,51 +1,74 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.io; - -/** - * Tells, that the IO Element (DataSink - but mostly DataSource) is based upon - * character data. - * - *

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

- *

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

- * - * @author wprinz - */ -@Deprecated -public interface TextBased -{ - - /** - * Returns the text. - * - * @return Returns the text. - */ - public String getText(); - -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.io; + +/** + * Tells, that the IO Element (DataSink - but mostly DataSource) is based upon + * character data. + * + *

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

+ *

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

+ * + * @author wprinz + */ +@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 index 62b48227..5466d596 100644 --- 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 @@ -1,394 +1,417 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.sign; - -import java.util.Properties; - -import at.gv.egiz.pdfas.api.commons.Constants; -import at.gv.egiz.pdfas.api.io.DataSink; -import at.gv.egiz.pdfas.api.io.DataSource; -import at.gv.egiz.pdfas.api.sign.pos.SignaturePositioning; -import at.gv.egiz.pdfas.api.timestamp.TimeStamper; -import at.knowcenter.wag.egov.egiz.sig.SignatureTypes; - -/** - * Parameter object that holds the sign parameters. - * - * @author wprinz - */ -@Deprecated -public class SignParameters -{ -// 23.11.2010 changed by exthex - added parameters for placeholder handling - - /** - * The document to be signed. - * - *

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

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

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

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

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

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

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

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

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

- *

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

- *

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

- *

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

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

- * Sample usage: - *

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

- * @param key the name of the setting to override e.g. "SIG_META" - * @param value The new value - */ - public void setProfileOverrideValue(String key, String value) { - if (SignatureTypes.isRequredSigTypeKey(key)) { - throw new RuntimeException("cannot set value for pre defined signature field names"); - } - this.overrideProps.put(key, value); - } - - /** - * Get override values created via {@link #setProfileOverrideValue(String, String)} - * @return - */ - public Properties getProfileOverrideProperties() { - return this.overrideProps; - - } - - /** - * Get the value of the checkForPlaceholder flag. - * - * @return - */ - public Boolean isCheckForPlaceholder() { - return this.checkForPlaceholder; - } - - /** - * Set this to true, if you want a search for placeholder images to be performed and - * appropriate images to be replaced. - * If this is not set, a search will only be performed if the configuration property "enable_placeholder_search" is set to true. - * - * @param check - */ - public void setCheckForPlaceholder(Boolean 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.
- * Exactly matching meaning:
- *
  • If a placeholderId is set: a placeholder which has exactly this id embedded
  • - *
  • If no placeholderId is set: a placeholder without an embedded id is found
- * - * @see Constants#PLACEHOLDER_MATCH_MODE_LENIENT - * @see Constants#PLACEHOLDER_MATCH_MODE_MODERATE - * @see Constants#PLACEHOLDER_MATCH_MODE_STRICT - * - * Defaults to {@link Constants#PLACEHOLDER_MATCH_MODE_MODERATE}. - * - * @param placeholderMatchMode - */ - public void setPlaceholderMatchMode(int placeholderMatchMode) { - this.placeholderMatchMode = placeholderMatchMode; - } - - /** - * Get the placeholder matching mode. - * - * @see SignParameters#getPlaceholderMatchMode() - * @return the placeholderMatchMode - */ - public int getPlaceholderMatchMode() { - return this.placeholderMatchMode; - } - -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.sign; + +import java.util.Properties; + +import at.gv.egiz.pdfas.api.commons.Constants; +import at.gv.egiz.pdfas.api.io.DataSink; +import at.gv.egiz.pdfas.api.io.DataSource; +import at.gv.egiz.pdfas.api.sign.pos.SignaturePositioning; +import at.gv.egiz.pdfas.api.timestamp.TimeStamper; +import at.knowcenter.wag.egov.egiz.sig.SignatureTypes; + +/** + * Parameter object that holds the sign parameters. + * + * @author wprinz + */ +@Deprecated +public class SignParameters +{ +// 23.11.2010 changed by exthex - added parameters for placeholder handling + + /** + * The document to be signed. + * + *

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

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

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

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

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

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

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

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

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

+ *

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

+ *

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

+ *

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

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

+ * Sample usage: + *

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

+ * @param key the name of the setting to override e.g. "SIG_META" + * @param value The new value + */ + public void setProfileOverrideValue(String key, String value) { + if (SignatureTypes.isRequredSigTypeKey(key)) { + throw new RuntimeException("cannot set value for pre defined signature field names"); + } + this.overrideProps.put(key, value); + } + + /** + * Get override values created via {@link #setProfileOverrideValue(String, String)} + * @return + */ + public Properties getProfileOverrideProperties() { + return this.overrideProps; + + } + + /** + * Get the value of the checkForPlaceholder flag. + * + * @return + */ + public Boolean isCheckForPlaceholder() { + return this.checkForPlaceholder; + } + + /** + * Set this to true, if you want a search for placeholder images to be performed and + * appropriate images to be replaced. + * If this is not set, a search will only be performed if the configuration property "enable_placeholder_search" is set to true. + * + * @param check + */ + public void setCheckForPlaceholder(Boolean 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.
+ * Exactly matching meaning:
+ *
  • If a placeholderId is set: a placeholder which has exactly this id embedded
  • + *
  • If no placeholderId is set: a placeholder without an embedded id is found
+ * + * @see Constants#PLACEHOLDER_MATCH_MODE_LENIENT + * @see Constants#PLACEHOLDER_MATCH_MODE_MODERATE + * @see Constants#PLACEHOLDER_MATCH_MODE_STRICT + * + * Defaults to {@link Constants#PLACEHOLDER_MATCH_MODE_MODERATE}. + * + * @param placeholderMatchMode + */ + public void setPlaceholderMatchMode(int placeholderMatchMode) { + this.placeholderMatchMode = placeholderMatchMode; + } + + /** + * Get the placeholder matching mode. + * + * @see SignParameters#getPlaceholderMatchMode() + * @return the placeholderMatchMode + */ + public int getPlaceholderMatchMode() { + return this.placeholderMatchMode; + } + +} diff --git a/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 index ad9b6cf8..e18d8105 100644 --- 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 @@ -1,85 +1,108 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.sign; - -import java.security.cert.X509Certificate; -import java.util.List; - -import at.gv.egiz.pdfas.api.analyze.NonTextObjectInfo; -import at.gv.egiz.pdfas.api.io.DataSink; -import at.gv.egiz.pdfas.api.sign.pos.SignaturePosition; - -/** - * The result of a sign operation. - * - * @author wprinz - */ -@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. - * - *

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

- * - *

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

- * - * @return Returns the position where the signature is finally placed. May - * return null if no position information is available. - */ - public SignaturePosition getSignaturePosition(); - - /** - * Returns a list<{@link NonTextObjectInfo} of non textual objects in the pdf document. - * Only available for textual signatures. Show this to the user who signed the textual content only! - * @return List<{@link NonTextObjectInfo} or null of not available (binary signature) - */ - public List getNonTextualObjects(); - - /** - * Returns if pdf has non textual objects (only for textual signature available). - * @return - */ - public boolean hasNonTextualObjects(); -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.sign; + +import java.security.cert.X509Certificate; +import java.util.List; + +import at.gv.egiz.pdfas.api.analyze.NonTextObjectInfo; +import at.gv.egiz.pdfas.api.io.DataSink; +import at.gv.egiz.pdfas.api.sign.pos.SignaturePosition; + +/** + * The result of a sign operation. + * + * @author wprinz + */ +@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. + * + *

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

+ * + *

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

+ * + * @return Returns the position where the signature is finally placed. May + * return null if no position information is available. + */ + public SignaturePosition getSignaturePosition(); + + /** + * Returns a list<{@link NonTextObjectInfo} of non textual objects in the pdf document. + * Only available for textual signatures. Show this to the user who signed the textual content only! + * @return List<{@link NonTextObjectInfo} or null of not available (binary signature) + */ + public List getNonTextualObjects(); + + /** + * Returns if pdf has non textual objects (only for textual signature available). + * @return + */ + public boolean hasNonTextualObjects(); +} diff --git a/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 index b4bba9a3..11b063ed 100644 --- 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 @@ -1,148 +1,171 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.sign; - -import java.security.cert.X509Certificate; -import java.util.Date; -import java.util.List; -import java.util.Map; - -import at.gv.egiz.pdfas.api.analyze.NonTextObjectInfo; -import at.gv.egiz.pdfas.api.io.DataSource; -import at.gv.egiz.pdfas.api.sign.pos.SignaturePosition; - -/** - * A container for all relevant signature related data. - * - * @author exthex - */ -@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 null of not available (binary signature) - */ - public List getNonTextualObjects(); - - /** - * Returns the date of signature extracted from the signature. - * @return - */ - public Date getSignDate(); - - /** - * Get the name of the issuer. - * Short for {@link SignatureDetailInformation#getX509Certificate()#getIssuer()#getName()} - * - * @return - */ - public String getIssuer(); - - /** - * Short for {@link SignatureDetailInformation#getX509Certificate()#getIssuerDNMap()} - * - * @return - */ - public Map getIssuerDNMap(); - - /** - * Short for {@link SignatureDetailInformation#getX509Certificate()#getSubjectName()#toString()} - * - * @return - */ - public String getSubjectName(); - - /** - * Short for {@link SignatureDetailInformation#getX509Certificate()#getSerialNumber()#toString()} - * - * @return - */ - public String getSerialNumber(); - - /** - * Get the algorithm the signature was created with. - * @return - */ - public String getSigAlgorithm(); - - /** - * - * @return the signature id. - */ - public String getSigID(); - - /** - * - * @return the signature method. - */ - public String getSigKZ(); - - /** - * - * @return the signature value. - */ - public String getSignatureValue(); - - /** - * - * @return the signature time stamp. - */ - public String getSigTimeStamp(); - - /** - * Short for {@link SignatureDetailInformation#getX509Certificate()#getSubjectDNMap()} - * - * @return - */ - public Map getSubjectDNMap(); - - /** - * - * @return the certificate used for signature. - */ - public X509Certificate getX509Certificate(); - - /** - * - * @return true if the signature is textual, false otherwise. - */ - public boolean isTextual(); - - /** - * - * @return true if this signature is binary, false otherwise. - */ - public boolean isBinary(); -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.sign; + +import java.security.cert.X509Certificate; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import at.gv.egiz.pdfas.api.analyze.NonTextObjectInfo; +import at.gv.egiz.pdfas.api.io.DataSource; +import at.gv.egiz.pdfas.api.sign.pos.SignaturePosition; + +/** + * A container for all relevant signature related data. + * + * @author exthex + */ +@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 null of not available (binary signature) + */ + public List getNonTextualObjects(); + + /** + * Returns the date of signature extracted from the signature. + * @return + */ + public Date getSignDate(); + + /** + * Get the name of the issuer. + * Short for {@link SignatureDetailInformation#getX509Certificate()#getIssuer()#getName()} + * + * @return + */ + public String getIssuer(); + + /** + * Short for {@link SignatureDetailInformation#getX509Certificate()#getIssuerDNMap()} + * + * @return + */ + public Map getIssuerDNMap(); + + /** + * Short for {@link SignatureDetailInformation#getX509Certificate()#getSubjectName()#toString()} + * + * @return + */ + public String getSubjectName(); + + /** + * Short for {@link SignatureDetailInformation#getX509Certificate()#getSerialNumber()#toString()} + * + * @return + */ + public String getSerialNumber(); + + /** + * Get the algorithm the signature was created with. + * @return + */ + public String getSigAlgorithm(); + + /** + * + * @return the signature id. + */ + public String getSigID(); + + /** + * + * @return the signature method. + */ + public String getSigKZ(); + + /** + * + * @return the signature value. + */ + public String getSignatureValue(); + + /** + * + * @return the signature time stamp. + */ + public String getSigTimeStamp(); + + /** + * Short for {@link SignatureDetailInformation#getX509Certificate()#getSubjectDNMap()} + * + * @return + */ + public Map getSubjectDNMap(); + + /** + * + * @return the certificate used for signature. + */ + public X509Certificate getX509Certificate(); + + /** + * + * @return true if the signature is textual, false otherwise. + */ + public boolean isTextual(); + + /** + * + * @return true if this signature is binary, false otherwise. + */ + public boolean isBinary(); +} diff --git a/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 index f16d2ffb..ce73039f 100644 --- 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 @@ -1,73 +1,96 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.sign.pos; - -/** - * Holds the actual, absolute signature position where a signature was placed. - * - *

- * This is usually returned after signing. - *

- * - * @author wprinz - */ -@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(); - -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.sign.pos; + +/** + * Holds the actual, absolute signature position where a signature was placed. + * + *

+ * This is usually returned after signing. + *

+ * + * @author wprinz + */ +@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 index 029d9022..ab5bb652 100644 --- 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 @@ -1,337 +1,360 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.sign.pos; - -import java.io.Serializable; -import java.util.StringTokenizer; - -import at.gv.egiz.pdfas.api.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. - * - *

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

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

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

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

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

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

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

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

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

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

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

- */ - protected float footerLine = 0.0f; - - protected void checkAxisAlgorithm(AxisAlgorithm algorithm) - { - if (algorithm == null) - { - throw new IllegalArgumentException("The algorithm must not be null."); - } - if (!(algorithm instanceof AutoAxisAlgorithm) && !(algorithm instanceof AbsoluteAxisAlgorithm)) - { - throw new IllegalArgumentException("The algorithm must be either Auto or Absolute."); - } - } - - protected void checkPageAlgorithm(PageAlgorithm algorithm) - { - if (algorithm == null) - { - throw new IllegalArgumentException("The algorithm must not be null."); - } - if (!(algorithm instanceof AutoPageAlgorithm) && !(algorithm instanceof AbsolutePageAlgorithm) && !(algorithm instanceof NewPageAlgorithm)) - { - throw new IllegalArgumentException("The algorithm must be either Auto or Absolute."); - } - - } - - /** - * @return the xAlgorithm - */ - public AxisAlgorithm getXAlgorithm() - { - return this.xAlgorithm; - } - - /** - * @param algorithm - * the xAlgorithm to set - */ - public void setXAlgorithm(AxisAlgorithm algorithm) - { - checkAxisAlgorithm(algorithm); - xAlgorithm = algorithm; - } - - /** - * @return the yAlgorithm - */ - public AxisAlgorithm getYAlgorithm() - { - return this.yAlgorithm; - } - - /** - * @param algorithm - * the yAlgorithm to set - */ - public void setYAlgorithm(AxisAlgorithm algorithm) - { - checkAxisAlgorithm(algorithm); - - yAlgorithm = algorithm; - } - - /** - * @return the widthAlgorithm - */ - public AxisAlgorithm getWidthAlgorithm() - { - return this.widthAlgorithm; - } - - /** - * @param widthAlgorithm - * the widthAlgorithm to set - */ - public void setWidthAlgorithm(AxisAlgorithm widthAlgorithm) - { - checkAxisAlgorithm(widthAlgorithm); - - this.widthAlgorithm = widthAlgorithm; - } - - /** - * @return the pageAlgorithm - */ - public PageAlgorithm getPageAlgorithm() - { - return this.pageAlgorithm; - } - - /** - * @param pageAlgorithm - * the pageAlgorithm to set - */ - public void setPageAlgorithm(PageAlgorithm pageAlgorithm) - { - checkPageAlgorithm(pageAlgorithm); - this.pageAlgorithm = pageAlgorithm; - } - - /** - * @return the footerLine - */ - public float getFooterLine() - { - return this.footerLine; - } - - /** - * @param footerLine - * the footerLine to set - */ - public void setFooterLine(float footerLine) - { - this.footerLine = footerLine; - } - - public SignaturePositioning() { - } - - public SignaturePositioning(String position) throws 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(); - } - - -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.sign.pos; + +import java.io.Serializable; +import java.util.StringTokenizer; + +import at.gv.egiz.pdfas.api.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. + * + *

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

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

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

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

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

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

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

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

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

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

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

+ */ + protected float footerLine = 0.0f; + + protected void checkAxisAlgorithm(AxisAlgorithm algorithm) + { + if (algorithm == null) + { + throw new IllegalArgumentException("The algorithm must not be null."); + } + if (!(algorithm instanceof AutoAxisAlgorithm) && !(algorithm instanceof AbsoluteAxisAlgorithm)) + { + throw new IllegalArgumentException("The algorithm must be either Auto or Absolute."); + } + } + + protected void checkPageAlgorithm(PageAlgorithm algorithm) + { + if (algorithm == null) + { + throw new IllegalArgumentException("The algorithm must not be null."); + } + if (!(algorithm instanceof AutoPageAlgorithm) && !(algorithm instanceof AbsolutePageAlgorithm) && !(algorithm instanceof NewPageAlgorithm)) + { + throw new IllegalArgumentException("The algorithm must be either Auto or Absolute."); + } + + } + + /** + * @return the xAlgorithm + */ + public AxisAlgorithm getXAlgorithm() + { + return this.xAlgorithm; + } + + /** + * @param algorithm + * the xAlgorithm to set + */ + public void setXAlgorithm(AxisAlgorithm algorithm) + { + checkAxisAlgorithm(algorithm); + xAlgorithm = algorithm; + } + + /** + * @return the yAlgorithm + */ + public AxisAlgorithm getYAlgorithm() + { + return this.yAlgorithm; + } + + /** + * @param algorithm + * the yAlgorithm to set + */ + public void setYAlgorithm(AxisAlgorithm algorithm) + { + checkAxisAlgorithm(algorithm); + + yAlgorithm = algorithm; + } + + /** + * @return the widthAlgorithm + */ + public AxisAlgorithm getWidthAlgorithm() + { + return this.widthAlgorithm; + } + + /** + * @param widthAlgorithm + * the widthAlgorithm to set + */ + public void setWidthAlgorithm(AxisAlgorithm widthAlgorithm) + { + checkAxisAlgorithm(widthAlgorithm); + + this.widthAlgorithm = widthAlgorithm; + } + + /** + * @return the pageAlgorithm + */ + public PageAlgorithm getPageAlgorithm() + { + return this.pageAlgorithm; + } + + /** + * @param pageAlgorithm + * the pageAlgorithm to set + */ + public void setPageAlgorithm(PageAlgorithm pageAlgorithm) + { + checkPageAlgorithm(pageAlgorithm); + this.pageAlgorithm = pageAlgorithm; + } + + /** + * @return the footerLine + */ + public float getFooterLine() + { + return this.footerLine; + } + + /** + * @param footerLine + * the footerLine to set + */ + public void setFooterLine(float footerLine) + { + this.footerLine = footerLine; + } + + public SignaturePositioning() { + } + + public SignaturePositioning(String position) throws 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 index ea2143dd..7d550ddc 100644 --- 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 @@ -1,62 +1,85 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.sign.pos.axis; - -import java.io.Serializable; - -/** - * An absolute positioned element. - * @author wprinz - */ -public class AbsoluteAxisAlgorithm extends AxisAlgorithm implements Serializable -{ - - /** - * - */ - private static final long serialVersionUID = 1L; - - /** - * The absolute positioning value on the axis. - */ - protected float absoluteValue = 0.0f; - - /** - * Constructor. - * @param absoluteValue The absolute positioning value on the axis. - */ - public AbsoluteAxisAlgorithm (float absoluteValue) - { - this.absoluteValue = absoluteValue; - } - - /** - * Returns absolute positioning value on the axis. - * @return the absoluteValue Returns absolute positioning value on the axis. - */ - public float getAbsoluteValue() - { - return this.absoluteValue; - } -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.sign.pos.axis; + +import java.io.Serializable; + +/** + * An absolute positioned element. + * @author wprinz + */ +public class AbsoluteAxisAlgorithm extends AxisAlgorithm implements Serializable +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * The absolute positioning value on the axis. + */ + protected float absoluteValue = 0.0f; + + /** + * Constructor. + * @param absoluteValue The absolute positioning value on the axis. + */ + public AbsoluteAxisAlgorithm (float absoluteValue) + { + this.absoluteValue = absoluteValue; + } + + /** + * Returns absolute positioning value on the axis. + * @return the absoluteValue Returns absolute positioning value on the axis. + */ + public float getAbsoluteValue() + { + return this.absoluteValue; + } +} diff --git a/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 index a9857b42..e0fa101d 100644 --- 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 @@ -1,41 +1,64 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.sign.pos.axis; - -import java.io.Serializable; - -/** - * Auto positioning for this element. - * - * @author wprinz - */ -public class AutoAxisAlgorithm extends AxisAlgorithm implements Serializable -{ - - /** - * - */ - private static final long serialVersionUID = 1L; -// empty -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.sign.pos.axis; + +import java.io.Serializable; + +/** + * Auto positioning for this element. + * + * @author wprinz + */ +public class AutoAxisAlgorithm extends AxisAlgorithm implements Serializable +{ + + /** + * + */ + private static final long serialVersionUID = 1L; +// empty +} diff --git a/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 index dd1d1700..c43bca89 100644 --- 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 @@ -1,41 +1,64 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.sign.pos.axis; - -import java.io.Serializable; - -/** - * Determines how a certain position is chosen on the axis (x, y, width). - * - * @author wprinz - */ -public abstract class AxisAlgorithm implements Serializable -{ - - /** - * - */ - private static final long serialVersionUID = 1L; -// base class -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.sign.pos.axis; + +import java.io.Serializable; + +/** + * Determines how a certain position is chosen on the axis (x, y, width). + * + * @author wprinz + */ +public abstract class AxisAlgorithm implements Serializable +{ + + /** + * + */ + private static final long serialVersionUID = 1L; +// base class +} diff --git a/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 index c4f24440..8703b27d 100644 --- 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 @@ -1,3 +1,26 @@ +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ /** * */ @@ -5,4 +28,4 @@ * @author afitzek * */ -package at.gv.egiz.pdfas.api.sign.pos.axis; \ No newline at end of file +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 index 80914293..1dbd22eb 100644 --- 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 @@ -1,3 +1,26 @@ +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ /** * */ @@ -5,4 +28,4 @@ * @author afitzek * */ -package at.gv.egiz.pdfas.api.sign.pos; \ No newline at end of file +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 index 434c20c4..ed17954f 100644 --- 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 @@ -1,64 +1,87 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.sign.pos.page; - -import java.io.Serializable; - -/** - * The page is selected absolutely by giving the page number directly. - * - * @author wprinz - */ -public class AbsolutePageAlgorithm extends PageAlgorithm implements Serializable -{ - /** - * - */ - private static final long serialVersionUID = 1L; - - /** - * The page. - */ - protected int page = -1; - - /** - * Constructor. - * - * @param page - * The page. - */ - public AbsolutePageAlgorithm(int page) - { - this.page = page; - } - - /** - * @return the page - */ - public int getPage() - { - return this.page; - } - -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.sign.pos.page; + +import java.io.Serializable; + +/** + * The page is selected absolutely by giving the page number directly. + * + * @author wprinz + */ +public class AbsolutePageAlgorithm extends PageAlgorithm implements Serializable +{ + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * The page. + */ + protected int page = -1; + + /** + * Constructor. + * + * @param page + * The page. + */ + public AbsolutePageAlgorithm(int page) + { + this.page = page; + } + + /** + * @return the page + */ + public int getPage() + { + return this.page; + } + +} diff --git a/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 index fffcbad0..54365613 100644 --- 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 @@ -1,47 +1,70 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.sign.pos.page; - -import java.io.Serializable; - -/** - * The page for placing the signature is selected automatically. - * - *

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

- * - * @author wprinz - */ -public class AutoPageAlgorithm extends PageAlgorithm implements Serializable -{ - - /** - * - */ - private static final long serialVersionUID = 1L; -// empty -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.sign.pos.page; + +import java.io.Serializable; + +/** + * The page for placing the signature is selected automatically. + * + *

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

+ * + * @author wprinz + */ +public class AutoPageAlgorithm extends PageAlgorithm implements Serializable +{ + + /** + * + */ + private static final long serialVersionUID = 1L; +// empty +} diff --git a/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 index ded9f618..e3f4b9cc 100644 --- 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 @@ -1,41 +1,64 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.sign.pos.page; - -import java.io.Serializable; - -/** - * Places the signature on a new Page. - * - * @author wprinz - */ -public class NewPageAlgorithm extends PageAlgorithm implements Serializable -{ - - /** - * - */ - private static final long serialVersionUID = 1L; - // empty block -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.sign.pos.page; + +import java.io.Serializable; + +/** + * Places the signature on a new Page. + * + * @author wprinz + */ +public class NewPageAlgorithm extends PageAlgorithm implements Serializable +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + // empty block +} diff --git a/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 index 16aa72ca..64840d90 100644 --- 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 @@ -1,41 +1,64 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.sign.pos.page; - -import java.io.Serializable; - -/** - * Determines how the page on which the signature is to be placed is selected. - * - * @author wprinz - */ -public abstract class PageAlgorithm implements Serializable -{ - - /** - * - */ - private static final long serialVersionUID = 1L; - // empty -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.sign.pos.page; + +import java.io.Serializable; + +/** + * Determines how the page on which the signature is to be placed is selected. + * + * @author wprinz + */ +public abstract class PageAlgorithm implements Serializable +{ + + /** + * + */ + private static final long serialVersionUID = 1L; + // empty +} diff --git a/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 index fec6dbea..9ac906ec 100644 --- 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 @@ -1,3 +1,26 @@ +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ /** * */ @@ -5,4 +28,4 @@ * @author afitzek * */ -package at.gv.egiz.pdfas.api.sign.pos.page; \ No newline at end of file +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 index 0245a7ca..ffad7790 100644 --- 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 @@ -1,63 +1,86 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.timestamp; - -import java.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; - } - -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.timestamp; + +import java.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 index 99bda3a7..b8cb3974 100644 --- 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 @@ -1,41 +1,64 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.timestamp; - -/** - * Interface for timestamper implementations/handlers - * - * @author dferbas - * - */ -public interface TimeStamper { - - /** - * Implement timestamp in this method. - * @param b64SignatureValue signature value, base64 encoded - * @return timestamp to be embedded in egiz dictionary base64 encoded (following RFC3161). - */ - public String applyTimeStamp(String b64SignatureValue); - -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.timestamp; + +/** + * Interface for timestamper implementations/handlers + * + * @author dferbas + * + */ +public interface TimeStamper { + + /** + * Implement timestamp in this method. + * @param b64SignatureValue signature value, base64 encoded + * @return timestamp to be embedded in egiz dictionary base64 encoded (following RFC3161). + */ + public String applyTimeStamp(String b64SignatureValue); + +} diff --git a/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 index 30b76e0c..32c3fe67 100644 --- 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 @@ -1,3 +1,26 @@ +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ /** * */ @@ -5,4 +28,4 @@ * @author afitzek * */ -package at.gv.egiz.pdfas.api.timestamp; \ No newline at end of file +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 index c1690774..2b38819a 100644 --- 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 @@ -1,51 +1,74 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.verify; - -/** - * The result of a signature check performed by a verification device. - * - * @see VerifyResult - * - * @author wprinz - */ -public interface SignatureCheck -{ - /** - * Returns the response code of the check. - * - * @return Returns the response code of the check. - */ - public int getCode(); - - /** - * Returns the textual response message of the check (corresponding to the - * code). - * - * @return Returns the textual response message of the check (corresponding to - * the code). - */ - public String getMessage(); - -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.verify; + +/** + * The result of a signature check performed by a verification device. + * + * @see VerifyResult + * + * @author wprinz + */ +public interface SignatureCheck +{ + /** + * Returns the response code of the check. + * + * @return Returns the response code of the check. + */ + public int getCode(); + + /** + * Returns the textual response message of the check (corresponding to the + * code). + * + * @return Returns the textual response message of the check (corresponding to + * the code). + */ + public String getMessage(); + +} diff --git a/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 index 8b9e2c6a..62b7e7e4 100644 --- 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 @@ -1,166 +1,189 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.verify; - -import java.util.Date; - -import at.gv.egiz.pdfas.api.analyze.AnalyzeResult; -import at.gv.egiz.pdfas.api.commons.Constants; - -/** - * Parameter object that holds the verify after analysis parameters. - * - * @author wprinz - */ -public class VerifyAfterAnalysisParameters -{ - - /** - * The list of signatures to be verified. - */ - protected AnalyzeResult analyzeResult = null; - - /** - * The signature device to perform the actual signature. - * - *

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

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

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

- */ - protected boolean returnHashInputData = false; - - /** - * The index of the signature to be verified. A value < 0 indicates to verify all signatures. - */ - protected int verifySignatureIndex = -1; - - /** - * @return the analyzeResult - */ - public AnalyzeResult getAnalyzeResult() - { - return this.analyzeResult; - } - - /** - * @param analyzeResult - * the analyzeResult to set - */ - public void setAnalyzeResult(AnalyzeResult analyzeResult) - { - this.analyzeResult = analyzeResult; - } - - /** - * @return the signatureDevice - */ - public String getSignatureDevice() - { - return this.signatureDevice; - } - - /** - * @param signatureDevice - * the signatureDevice to set - */ - public void setSignatureDevice(String signatureDevice) - { - this.signatureDevice = signatureDevice; - } - - /** - * @return the verificationTime - */ - public Date getVerificationTime() - { - return this.verificationTime; - } - - /** - * @param verificationTime the verificationTime to set - */ - public void setVerificationTime(Date verificationTime) - { - this.verificationTime = verificationTime; - } - - /** - * @return the returnHashInputData - */ - public boolean isReturnHashInputData() - { - return this.returnHashInputData; - } - - /** - * @param returnHashInputData - * the returnHashInputData to set - */ - public void setReturnHashInputData(boolean returnHashInputData) - { - this.returnHashInputData = returnHashInputData; - } - - /** - * Set the index of the signature to verify (index starting at 0). A value < 0 indicates to verify all values. - * @param verify_which - */ - public void setVerifySignatureIndex(int verify_which) { - this.verifySignatureIndex = verify_which; - } - - public int getVerifySignatureIndex() { - return verifySignatureIndex; - } - - /** - * @see VerifyParameters#setSuppressVerifyExceptions(boolean) - * @param suppress - */ - public void setSuppressVerifyExceptions(boolean suppress) { - VerifyParameters.setSuppressVerify(suppress); - } - - public boolean isSuppressVerifyExceptions() { - return VerifyParameters.isSuppressVerifyExceptions(); - } - -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.verify; + +import java.util.Date; + +import at.gv.egiz.pdfas.api.analyze.AnalyzeResult; +import at.gv.egiz.pdfas.api.commons.Constants; + +/** + * Parameter object that holds the verify after analysis parameters. + * + * @author wprinz + */ +public class VerifyAfterAnalysisParameters +{ + + /** + * The list of signatures to be verified. + */ + protected AnalyzeResult analyzeResult = null; + + /** + * The signature device to perform the actual signature. + * + *

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

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

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

+ */ + protected boolean returnHashInputData = false; + + /** + * The index of the signature to be verified. A value < 0 indicates to verify all signatures. + */ + protected int verifySignatureIndex = -1; + + /** + * @return the analyzeResult + */ + public AnalyzeResult getAnalyzeResult() + { + return this.analyzeResult; + } + + /** + * @param analyzeResult + * the analyzeResult to set + */ + public void setAnalyzeResult(AnalyzeResult analyzeResult) + { + this.analyzeResult = analyzeResult; + } + + /** + * @return the signatureDevice + */ + public String getSignatureDevice() + { + return this.signatureDevice; + } + + /** + * @param signatureDevice + * the signatureDevice to set + */ + public void setSignatureDevice(String signatureDevice) + { + this.signatureDevice = signatureDevice; + } + + /** + * @return the verificationTime + */ + public Date getVerificationTime() + { + return this.verificationTime; + } + + /** + * @param verificationTime the verificationTime to set + */ + public void setVerificationTime(Date verificationTime) + { + this.verificationTime = verificationTime; + } + + /** + * @return the returnHashInputData + */ + public boolean isReturnHashInputData() + { + return this.returnHashInputData; + } + + /** + * @param returnHashInputData + * the returnHashInputData to set + */ + public void setReturnHashInputData(boolean returnHashInputData) + { + this.returnHashInputData = returnHashInputData; + } + + /** + * Set the index of the signature to verify (index starting at 0). A value < 0 indicates to verify all values. + * @param verify_which + */ + public void setVerifySignatureIndex(int verify_which) { + this.verifySignatureIndex = verify_which; + } + + public int getVerifySignatureIndex() { + return verifySignatureIndex; + } + + /** + * @see VerifyParameters#setSuppressVerifyExceptions(boolean) + * @param suppress + */ + public void setSuppressVerifyExceptions(boolean suppress) { + VerifyParameters.setSuppressVerify(suppress); + } + + public boolean isSuppressVerifyExceptions() { + return VerifyParameters.isSuppressVerifyExceptions(); + } + +} diff --git a/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 index 8f8d17c7..d5b04e43 100644 --- 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 @@ -1,169 +1,192 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.verify; - -import java.util.Date; - -import at.gv.egiz.pdfas.api.commons.Constants; -import at.gv.egiz.pdfas.api.xmldsig.ReconstructXMLDsigResult; - -/** - * This class represents the parameters needed for verify after reconstructXMLDsig has already been executed. - * - * @author exthex - * - */ -public class VerifyAfterReconstructXMLDsigParameters { - - /** - * The list of signatures to be verified. - */ - protected ReconstructXMLDsigResult reconstructXMLDsigResult = null; - - /** - * The signature device to perform the actual signature. - * - *

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

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

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

- */ - protected boolean returnHashInputData = false; - - /** - * The index of the signature to be verified. A value < 0 indicates to verify all signatures. - */ - protected int verifySignatureIndex = -1; - - /** - * @return the reconstructXMLDsigResult - */ - public ReconstructXMLDsigResult getReconstructXMLDsigResult() - { - return this.reconstructXMLDsigResult; - } - - /** - * @param reconstructXMLDsigResult - * the reconstructXMLDsigResult to set - */ - public void setReconstructXMLDsigResult(ReconstructXMLDsigResult reconstructXMLDsigResult) - { - this.reconstructXMLDsigResult = reconstructXMLDsigResult; - } - - /** - * @return the signatureDevice - */ - public String getSignatureDevice() - { - return this.signatureDevice; - } - - /** - * Set the signature device to use for verification. - * If none is set here, the signature device that was used for reconstructXMLDsig will be used. - * - * @param signatureDevice - * the signatureDevice to set - */ - public void setSignatureDevice(String signatureDevice) - { - this.signatureDevice = signatureDevice; - } - - /** - * @return the verificationTime - */ - public Date getVerificationTime() - { - return this.verificationTime; - } - - /** - * @param verificationTime the verificationTime to set - */ - public void setVerificationTime(Date verificationTime) - { - this.verificationTime = verificationTime; - } - - /** - * @return the returnHashInputData - */ - public boolean isReturnHashInputData() - { - return this.returnHashInputData; - } - - /** - * @param returnHashInputData - * the returnHashInputData to set - */ - public void setReturnHashInputData(boolean returnHashInputData) - { - this.returnHashInputData = returnHashInputData; - } - - /** - * Set the index of the signature to verify (index starting at 0). A value < 0 indicates to verify all values. - * @param verify_which - */ - public void setVerifySignatureIndex(int verify_which) { - this.verifySignatureIndex = verify_which; - } - - public int getVerifySignatureIndex() { - return verifySignatureIndex; - } - - /** - * @see VerifyParameters#setSuppressVerifyExceptions(boolean) - * @param suppress - */ - public void setSuppressVerifyExceptions(boolean suppress) { - VerifyParameters.setSuppressVerify(suppress); - } - - public boolean isSuppressVerifyExceptions() { - return VerifyParameters.isSuppressVerifyExceptions(); - } - -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.verify; + +import java.util.Date; + +import at.gv.egiz.pdfas.api.commons.Constants; +import at.gv.egiz.pdfas.api.xmldsig.ReconstructXMLDsigResult; + +/** + * This class represents the parameters needed for verify after reconstructXMLDsig has already been executed. + * + * @author exthex + * + */ +public class VerifyAfterReconstructXMLDsigParameters { + + /** + * The list of signatures to be verified. + */ + protected ReconstructXMLDsigResult reconstructXMLDsigResult = null; + + /** + * The signature device to perform the actual signature. + * + *

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

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

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

+ */ + protected boolean returnHashInputData = false; + + /** + * The index of the signature to be verified. A value < 0 indicates to verify all signatures. + */ + protected int verifySignatureIndex = -1; + + /** + * @return the reconstructXMLDsigResult + */ + public ReconstructXMLDsigResult getReconstructXMLDsigResult() + { + return this.reconstructXMLDsigResult; + } + + /** + * @param reconstructXMLDsigResult + * the reconstructXMLDsigResult to set + */ + public void setReconstructXMLDsigResult(ReconstructXMLDsigResult reconstructXMLDsigResult) + { + this.reconstructXMLDsigResult = reconstructXMLDsigResult; + } + + /** + * @return the signatureDevice + */ + public String getSignatureDevice() + { + return this.signatureDevice; + } + + /** + * Set the signature device to use for verification. + * If none is set here, the signature device that was used for reconstructXMLDsig will be used. + * + * @param signatureDevice + * the signatureDevice to set + */ + public void setSignatureDevice(String signatureDevice) + { + this.signatureDevice = signatureDevice; + } + + /** + * @return the verificationTime + */ + public Date getVerificationTime() + { + return this.verificationTime; + } + + /** + * @param verificationTime the verificationTime to set + */ + public void setVerificationTime(Date verificationTime) + { + this.verificationTime = verificationTime; + } + + /** + * @return the returnHashInputData + */ + public boolean isReturnHashInputData() + { + return this.returnHashInputData; + } + + /** + * @param returnHashInputData + * the returnHashInputData to set + */ + public void setReturnHashInputData(boolean returnHashInputData) + { + this.returnHashInputData = returnHashInputData; + } + + /** + * Set the index of the signature to verify (index starting at 0). A value < 0 indicates to verify all values. + * @param verify_which + */ + public void setVerifySignatureIndex(int verify_which) { + this.verifySignatureIndex = verify_which; + } + + public int getVerifySignatureIndex() { + return verifySignatureIndex; + } + + /** + * @see VerifyParameters#setSuppressVerifyExceptions(boolean) + * @param suppress + */ + public void setSuppressVerifyExceptions(boolean suppress) { + VerifyParameters.setSuppressVerify(suppress); + } + + public boolean isSuppressVerifyExceptions() { + return VerifyParameters.isSuppressVerifyExceptions(); + } + +} diff --git a/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 index e7301dc4..56e11ca1 100644 --- 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 @@ -1,249 +1,272 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.verify; - -import java.util.Date; - -import at.gv.egiz.pdfas.api.commons.Constants; -import at.gv.egiz.pdfas.api.io.DataSource; - -/** - * Parameter object that holds the verify parameters. - * - * @author wprinz - */ -public class VerifyParameters -{ - // This would be a perfect point for multiple inheritance in Java. - // VerifyParameters extends AnalyzeParameters, VerifyAfterAnalysisParameters - // Then a lot of code could be easily reused in the PdfAsObject's check*Parameters methods. - - /** - * The document to be verified. - */ - protected DataSource document = null; - - /** - * The signature device to perform the actual signature. - * - *

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

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

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

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

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

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

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

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

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

- */ - protected boolean returnHashInputData = false; - - protected boolean returnNonTextualObjects = false; - - private static ThreadLocal suppressVerifyExceptions = new ThreadLocal(); - - - public VerifyParameters() { - suppressVerifyExceptions.set(Boolean.FALSE); - } - /** - * @return the document - */ - public DataSource getDocument() - { - return this.document; - } - - /** - * @param document - * the document to set - */ - public void setDocument(DataSource document) - { - this.document = document; - } - - /** - * @return the signatureDevice - */ - public String getSignatureDevice() - { - return this.signatureDevice; - } - - /** - * @param signatureDevice - * the signatureDevice to set - */ - public void setSignatureDevice(String signatureDevice) - { - this.signatureDevice = signatureDevice; - } - - /** - * @return the verifyMode - */ - public String getVerifyMode() - { - return this.verifyMode; - } - - /** - * @param verifyMode - * the verifyMode to set - */ - public void setVerifyMode(String verifyMode) - { - this.verifyMode = verifyMode; - } - - /** - * @return the signatureToVerify - */ - public int getSignatureToVerify() - { - return this.signatureToVerify; - } - - /** - * @param signatureToVerify - * the signatureToVerify to set - */ - public void setSignatureToVerify(int signatureToVerify) - { - this.signatureToVerify = signatureToVerify; - } - - /** - * @return the verificationTime - */ - public Date getVerificationTime() - { - return this.verificationTime; - } - - /** - * @param verificationTime - * the verificationTime to set - */ - public void setVerificationTime(Date verificationTime) - { - this.verificationTime = verificationTime; - } - - /** - * @return the returnHashInputData - */ - public boolean isReturnHashInputData() - { - return this.returnHashInputData; - } - - /** - * @param returnHashInputData - * the returnHashInputData to set - */ - public void setReturnHashInputData(boolean returnHashInputData) - { - this.returnHashInputData = returnHashInputData; - } - - public boolean isReturnNonTextualObjects() { - return this.returnNonTextualObjects; - } - - /** - * Tells if non text object of the signed pdf should be extracted and returned. - * One should show this to the user, especially in case of textual signature. - * Defaults to false - * - * @param returnNonTextualObjects - */ - public void setReturnNonTextualObjects(boolean returnNonTextualObjects) { - this.returnNonTextualObjects = returnNonTextualObjects; - } - - /** - * Set if verify exceptions (because of unknown signatures) are suppressed or not (default). - * Suppressing can be helpful for multiple signatures if you want to verify the working rest. Unsupported - * Signatures are reported without throwing an exception via {@link VerifyResult#getVerificationException()} - * @param suppress - */ - public void setSuppressVerifyExceptions(boolean suppress) { - setSuppressVerify(suppress); - } - - /** - * See {@link #setSuppressVerifyExceptions(boolean)} - * @return - */ - public static boolean isSuppressVerifyExceptions() { - if (suppressVerifyExceptions.get() == null) return false; - return ((Boolean) suppressVerifyExceptions.get()).booleanValue(); - } - - static void setSuppressVerify(boolean suppress) { - suppressVerifyExceptions.set(new Boolean(suppress)); - } - -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.verify; + +import java.util.Date; + +import at.gv.egiz.pdfas.api.commons.Constants; +import at.gv.egiz.pdfas.api.io.DataSource; + +/** + * Parameter object that holds the verify parameters. + * + * @author wprinz + */ +public class VerifyParameters +{ + // This would be a perfect point for multiple inheritance in Java. + // VerifyParameters extends AnalyzeParameters, VerifyAfterAnalysisParameters + // Then a lot of code could be easily reused in the PdfAsObject's check*Parameters methods. + + /** + * The document to be verified. + */ + protected DataSource document = null; + + /** + * The signature device to perform the actual signature. + * + *

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

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

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

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

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

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

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

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

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

+ */ + protected boolean returnHashInputData = false; + + protected boolean returnNonTextualObjects = false; + + private static ThreadLocal suppressVerifyExceptions = new ThreadLocal(); + + + public VerifyParameters() { + suppressVerifyExceptions.set(Boolean.FALSE); + } + /** + * @return the document + */ + public DataSource getDocument() + { + return this.document; + } + + /** + * @param document + * the document to set + */ + public void setDocument(DataSource document) + { + this.document = document; + } + + /** + * @return the signatureDevice + */ + public String getSignatureDevice() + { + return this.signatureDevice; + } + + /** + * @param signatureDevice + * the signatureDevice to set + */ + public void setSignatureDevice(String signatureDevice) + { + this.signatureDevice = signatureDevice; + } + + /** + * @return the verifyMode + */ + public String getVerifyMode() + { + return this.verifyMode; + } + + /** + * @param verifyMode + * the verifyMode to set + */ + public void setVerifyMode(String verifyMode) + { + this.verifyMode = verifyMode; + } + + /** + * @return the signatureToVerify + */ + public int getSignatureToVerify() + { + return this.signatureToVerify; + } + + /** + * @param signatureToVerify + * the signatureToVerify to set + */ + public void setSignatureToVerify(int signatureToVerify) + { + this.signatureToVerify = signatureToVerify; + } + + /** + * @return the verificationTime + */ + public Date getVerificationTime() + { + return this.verificationTime; + } + + /** + * @param verificationTime + * the verificationTime to set + */ + public void setVerificationTime(Date verificationTime) + { + this.verificationTime = verificationTime; + } + + /** + * @return the returnHashInputData + */ + public boolean isReturnHashInputData() + { + return this.returnHashInputData; + } + + /** + * @param returnHashInputData + * the returnHashInputData to set + */ + public void setReturnHashInputData(boolean returnHashInputData) + { + this.returnHashInputData = returnHashInputData; + } + + public boolean isReturnNonTextualObjects() { + return this.returnNonTextualObjects; + } + + /** + * Tells if non text object of the signed pdf should be extracted and returned. + * One should show this to the user, especially in case of textual signature. + * Defaults to false + * + * @param returnNonTextualObjects + */ + public void setReturnNonTextualObjects(boolean returnNonTextualObjects) { + this.returnNonTextualObjects = returnNonTextualObjects; + } + + /** + * Set if verify exceptions (because of unknown signatures) are suppressed or not (default). + * Suppressing can be helpful for multiple signatures if you want to verify the working rest. Unsupported + * Signatures are reported without throwing an exception via {@link VerifyResult#getVerificationException()} + * @param suppress + */ + public void setSuppressVerifyExceptions(boolean suppress) { + setSuppressVerify(suppress); + } + + /** + * See {@link #setSuppressVerifyExceptions(boolean)} + * @return + */ + public static boolean isSuppressVerifyExceptions() { + if (suppressVerifyExceptions.get() == null) return false; + return ((Boolean) suppressVerifyExceptions.get()).booleanValue(); + } + + static void setSuppressVerify(boolean suppress) { + suppressVerifyExceptions.set(new Boolean(suppress)); + } + +} diff --git a/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 index fb48e5ee..ca8ee7c4 100644 --- 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 @@ -1,179 +1,202 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.verify; - -import java.util.Date; -import java.util.List; - -import at.gv.egiz.pdfas.api.PdfAs; -import at.gv.egiz.pdfas.api.analyze.NonTextObjectInfo; -import at.gv.egiz.pdfas.api.commons.SignatureInformation; -import at.gv.egiz.pdfas.api.exceptions.PdfAsException; -import at.gv.egiz.pdfas.api.xmldsig.XMLDsigData; - -/** - * Encapsulates the data of a verification of one signature. - * - * @author wprinz - */ -public interface VerifyResult extends SignatureInformation -{ - /** - * Returns if the verification was possible or could not even be startet. see {@link #getVerificationException()} for details. - * @return - */ - public boolean isVerificationDone(); - - /** - * Returns a verification exception if any. Shows that the verification could not be started. See {@link #isVerificationDone()}. - * @return - */ - public PdfAsException getVerificationException(); - - /** - * Returns the result of the certificate check. - * - * @return Returns the result of the certificate check. - */ - public SignatureCheck getCertificateCheck(); - - /** - * Returns the result of the value (and hash) check. - * - * @return Returns the result of the value (and hash) check. - */ - public SignatureCheck getValueCheckCode(); - - /** - * Returns the result of the manifest check. - * - * @return Returns the result of the manifest check. - */ - public SignatureCheck getManifestCheckCode(); - - /** - * Returns true, if the signer's certificate is a qualified certificate. - * - * @return Returns true, if the signer's certificate is a qualified - * certificate. - */ - public boolean isQualifiedCertificate(); - - /** - * Returns {@code true} if public authority is indicated. - * @return {@code true} if public authority. - */ - public boolean isPublicAuthority(); - - /** - * Returns the public authority code or {@code null}. - * @return The public authority code or {@code null}. - */ - public String getPublicAuthorityCode(); - - /** - * Returns a list of Strings each stating one public property of the - * certificate. - * - *

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

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

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

- *

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

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

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

- *

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

- * - * @return Returns the base64 encoded hash input data as returned by MOA. - * - * @see SignatureInformation#getSignedData() - */ - public String getHashInputData(); - - /** - * Returns a list<{@link NonTextObjectInfo}> of non textual objects in the pdf document. - * Only available for textual signatures. Show this to the user who signed the textual content only! - * @return List<{@link NonTextObjectInfo} or null of not available (binary signature) - */ - public List getNonTextualObjects(); - - - /** - * Returns true if non textual objects have been found, false if not. - * @return true if non textual objects have been found, false if not. - */ - public boolean hasNonTextualObjects(); - - /** - * Get the reconstructed xmldsig XML data. The reconstruction is done during the verification process. - * - * @see PdfAs#reconstructXMLDSIG(at.gv.egiz.pdfas.api.xmldsig.ReconstructXMLDsigParameters) - * @see PdfAs#reconstructXMLDSIG(at.gv.egiz.pdfas.api.xmldsig.ReconstructXMLDsigAfterAnalysisParameters) - * @return - */ - public XMLDsigData getReconstructedXMLDsig(); - -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.verify; + +import java.util.Date; +import java.util.List; + +import at.gv.egiz.pdfas.api.PdfAs; +import at.gv.egiz.pdfas.api.analyze.NonTextObjectInfo; +import at.gv.egiz.pdfas.api.commons.SignatureInformation; +import at.gv.egiz.pdfas.api.exceptions.PdfAsException; +import at.gv.egiz.pdfas.api.xmldsig.XMLDsigData; + +/** + * Encapsulates the data of a verification of one signature. + * + * @author wprinz + */ +public interface VerifyResult extends SignatureInformation +{ + /** + * Returns if the verification was possible or could not even be startet. see {@link #getVerificationException()} for details. + * @return + */ + public boolean isVerificationDone(); + + /** + * Returns a verification exception if any. Shows that the verification could not be started. See {@link #isVerificationDone()}. + * @return + */ + public PdfAsException getVerificationException(); + + /** + * Returns the result of the certificate check. + * + * @return Returns the result of the certificate check. + */ + public SignatureCheck getCertificateCheck(); + + /** + * Returns the result of the value (and hash) check. + * + * @return Returns the result of the value (and hash) check. + */ + public SignatureCheck getValueCheckCode(); + + /** + * Returns the result of the manifest check. + * + * @return Returns the result of the manifest check. + */ + public SignatureCheck getManifestCheckCode(); + + /** + * Returns true, if the signer's certificate is a qualified certificate. + * + * @return Returns true, if the signer's certificate is a qualified + * certificate. + */ + public boolean isQualifiedCertificate(); + + /** + * Returns {@code true} if public authority is indicated. + * @return {@code true} if public authority. + */ + public boolean isPublicAuthority(); + + /** + * Returns the public authority code or {@code null}. + * @return The public authority code or {@code null}. + */ + public String getPublicAuthorityCode(); + + /** + * Returns a list of Strings each stating one public property of the + * certificate. + * + *

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

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

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

+ *

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

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

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

+ *

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

+ * + * @return Returns the base64 encoded hash input data as returned by MOA. + * + * @see SignatureInformation#getSignedData() + */ + public String getHashInputData(); + + /** + * Returns a list<{@link NonTextObjectInfo}> of non textual objects in the pdf document. + * Only available for textual signatures. Show this to the user who signed the textual content only! + * @return List<{@link NonTextObjectInfo} or null of not available (binary signature) + */ + public List getNonTextualObjects(); + + + /** + * Returns true if non textual objects have been found, false if not. + * @return true if non textual objects have been found, false if not. + */ + public boolean hasNonTextualObjects(); + + /** + * Get the reconstructed xmldsig XML data. The reconstruction is done during the verification process. + * + * @see PdfAs#reconstructXMLDSIG(at.gv.egiz.pdfas.api.xmldsig.ReconstructXMLDsigParameters) + * @see PdfAs#reconstructXMLDSIG(at.gv.egiz.pdfas.api.xmldsig.ReconstructXMLDsigAfterAnalysisParameters) + * @return + */ + public XMLDsigData getReconstructedXMLDsig(); + +} diff --git a/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 index 44b62a78..3e0f4ee0 100644 --- 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 @@ -1,48 +1,71 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.verify; - -import java.util.List; - -/** - * The result of the verification of a document. - * - *

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

- * - * @author wprinz - */ -public interface VerifyResults -{ - /** - * Returns the List of VerifyResult objects, one for each verified signature. - * - * @return Returns the List of VerifyResult objects, one for each verified - * signature. - */ - public List getResults(); - -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.verify; + +import java.util.List; + +/** + * The result of the verification of a document. + * + *

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

+ * + * @author wprinz + */ +public interface VerifyResults +{ + /** + * Returns the List of VerifyResult objects, one for each verified signature. + * + * @return Returns the List of VerifyResult objects, one for each verified + * signature. + */ + public List getResults(); + +} diff --git a/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 index be2cc3d4..e18d1b92 100644 --- 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 @@ -1,3 +1,26 @@ +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ /** * */ @@ -5,4 +28,4 @@ * @author afitzek * */ -package at.gv.egiz.pdfas.api.verify; \ No newline at end of file +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 index df12b529..f2cd3598 100644 --- 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 @@ -1,69 +1,92 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.xmldsig; - -import at.gv.egiz.pdfas.api.commons.SignatureInformation; - -/** - * A wrapper to combine {@link SignatureInformation} and {@link XMLDsigData} - * - * @author exthex - * - */ -public class ExtendedSignatureInformation { - - private final SignatureInformation signatureInformation; - - private final XMLDsigData xmlDsigData; - - /** - * Constructor. - * - * @param siginfo - * The signature information - * @param dsigData - * The matching xmldsig to the signature information. - */ - public ExtendedSignatureInformation(SignatureInformation siginfo, XMLDsigData dsigData) { - this.signatureInformation = siginfo; - this.xmlDsigData = dsigData; - } - - /** - * - * @return the signatureInformation - */ - public SignatureInformation getSignatureInformation() { - return signatureInformation; - } - - /** - * - * @return the xmlDsigData - */ - public XMLDsigData getXmlDsigData() { - return xmlDsigData; - } - -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.xmldsig; + +import at.gv.egiz.pdfas.api.commons.SignatureInformation; + +/** + * A wrapper to combine {@link SignatureInformation} and {@link XMLDsigData} + * + * @author exthex + * + */ +public class ExtendedSignatureInformation { + + private final SignatureInformation signatureInformation; + + private final XMLDsigData xmlDsigData; + + /** + * Constructor. + * + * @param siginfo + * The signature information + * @param dsigData + * The matching xmldsig to the signature information. + */ + public ExtendedSignatureInformation(SignatureInformation siginfo, XMLDsigData dsigData) { + this.signatureInformation = siginfo; + this.xmlDsigData = dsigData; + } + + /** + * + * @return the signatureInformation + */ + public SignatureInformation getSignatureInformation() { + return signatureInformation; + } + + /** + * + * @return the xmlDsigData + */ + public XMLDsigData getXmlDsigData() { + return xmlDsigData; + } + +} diff --git a/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 index 229fba04..62815fb8 100644 --- 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 @@ -1,86 +1,109 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.xmldsig; - -import at.gv.egiz.pdfas.api.analyze.AnalyzeResult; -import at.gv.egiz.pdfas.api.commons.Constants; - -/** - * Parameters for the reconstructXMLDsig method which is to be called after a analyze call. - * - * @author exthex - * - */ -public class ReconstructXMLDsigAfterAnalysisParameters { - - - /** - * The list of signatures to be verified. - */ - protected AnalyzeResult analyzeResult = null; - - /** - * The signature device to perform the actual signature. - * - *

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

- */ - protected String signatureDevice = Constants.SIGNATURE_DEVICE_MOA; - - /** - * @return the analyzeResult - */ - public AnalyzeResult getAnalyzeResult() - { - return this.analyzeResult; - } - - /** - * @param analyzeResult - * the analyzeResult to set - */ - public void setAnalyzeResult(AnalyzeResult analyzeResult) - { - this.analyzeResult = analyzeResult; - } - - /** - * @return the signatureDevice - */ - public String getSignatureDevice() - { - return this.signatureDevice; - } - - /** - * @param signatureDevice - * the signatureDevice to set - */ - public void setSignatureDevice(String signatureDevice) - { - this.signatureDevice = signatureDevice; - } -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.xmldsig; + +import at.gv.egiz.pdfas.api.analyze.AnalyzeResult; +import at.gv.egiz.pdfas.api.commons.Constants; + +/** + * Parameters for the reconstructXMLDsig method which is to be called after a analyze call. + * + * @author exthex + * + */ +public class ReconstructXMLDsigAfterAnalysisParameters { + + + /** + * The list of signatures to be verified. + */ + protected AnalyzeResult analyzeResult = null; + + /** + * The signature device to perform the actual signature. + * + *

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

+ */ + protected String signatureDevice = Constants.SIGNATURE_DEVICE_MOA; + + /** + * @return the analyzeResult + */ + public AnalyzeResult getAnalyzeResult() + { + return this.analyzeResult; + } + + /** + * @param analyzeResult + * the analyzeResult to set + */ + public void setAnalyzeResult(AnalyzeResult analyzeResult) + { + this.analyzeResult = analyzeResult; + } + + /** + * @return the signatureDevice + */ + public String getSignatureDevice() + { + return this.signatureDevice; + } + + /** + * @param signatureDevice + * the signatureDevice to set + */ + public void setSignatureDevice(String signatureDevice) + { + this.signatureDevice = signatureDevice; + } +} diff --git a/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 index 445d7ae4..03b77f1c 100644 --- 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 @@ -1,218 +1,241 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.xmldsig; - -import java.util.Date; - -import at.gv.egiz.pdfas.api.PdfAs; -import at.gv.egiz.pdfas.api.commons.Constants; -import at.gv.egiz.pdfas.api.io.DataSource; - -/** - * Parameters for the {@link PdfAs#reconstructXMLDSIG(ReconstructXMLDsigParameters)} method. - * No need to call analyze before calling this method. - * - * @author exthex - * - */ -public class ReconstructXMLDsigParameters { - - /** - * The document to be verified. - */ - protected DataSource document = null; - - /** - * The signature device to perform the actual signature. - * - *

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

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

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

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

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

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

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

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

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

- */ - protected boolean returnHashInputData = false; - - protected boolean returnNonTextualObjects = false; - - /** - * @return the document - */ - public DataSource getDocument() - { - return this.document; - } - - /** - * @param document - * the document to set - */ - public void setDocument(DataSource document) - { - this.document = document; - } - - /** - * @return the signatureDevice - */ - public String getSignatureDevice() - { - return this.signatureDevice; - } - - /** - * @param signatureDevice - * the signatureDevice to set - */ - public void setSignatureDevice(String signatureDevice) - { - this.signatureDevice = signatureDevice; - } - - /** - * @return the verifyMode - */ - public String getVerifyMode() - { - return this.verifyMode; - } - - /** - * @param verifyMode - * the verifyMode to set - */ - public void setVerifyMode(String verifyMode) - { - this.verifyMode = verifyMode; - } - - /** - * @return the signatureToVerify - */ - public int getSignatureToVerify() - { - return this.signatureToVerify; - } - - /** - * @param signatureToVerify - * the signatureToVerify to set - */ - public void setSignatureToVerify(int signatureToVerify) - { - this.signatureToVerify = signatureToVerify; - } - - /** - * @return the verificationTime - */ - public Date getVerificationTime() - { - return this.verificationTime; - } - - /** - * @param verificationTime - * the verificationTime to set - */ - public void setVerificationTime(Date verificationTime) - { - this.verificationTime = verificationTime; - } - - /** - * @return the returnHashInputData - */ - public boolean isReturnHashInputData() - { - return this.returnHashInputData; - } - - /** - * @param returnHashInputData - * the returnHashInputData to set - */ - public void setReturnHashInputData(boolean returnHashInputData) - { - this.returnHashInputData = returnHashInputData; - } - - public boolean isReturnNonTextualObjects() { - return this.returnNonTextualObjects; - } - - /** - * Tells if non text object of the signed pdf should be extracted and returned. - * One should show this to the user, especially in case of textual signature. - * Defaults to false - * - * @param returnNonTextualObjects - */ - public void setReturnNonTextualObjects(boolean returnNonTextualObjects) { - this.returnNonTextualObjects = returnNonTextualObjects; - } -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.xmldsig; + +import java.util.Date; + +import at.gv.egiz.pdfas.api.PdfAs; +import at.gv.egiz.pdfas.api.commons.Constants; +import at.gv.egiz.pdfas.api.io.DataSource; + +/** + * Parameters for the {@link PdfAs#reconstructXMLDSIG(ReconstructXMLDsigParameters)} method. + * No need to call analyze before calling this method. + * + * @author exthex + * + */ +public class ReconstructXMLDsigParameters { + + /** + * The document to be verified. + */ + protected DataSource document = null; + + /** + * The signature device to perform the actual signature. + * + *

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

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

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

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

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

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

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

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

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

+ */ + protected boolean returnHashInputData = false; + + protected boolean returnNonTextualObjects = false; + + /** + * @return the document + */ + public DataSource getDocument() + { + return this.document; + } + + /** + * @param document + * the document to set + */ + public void setDocument(DataSource document) + { + this.document = document; + } + + /** + * @return the signatureDevice + */ + public String getSignatureDevice() + { + return this.signatureDevice; + } + + /** + * @param signatureDevice + * the signatureDevice to set + */ + public void setSignatureDevice(String signatureDevice) + { + this.signatureDevice = signatureDevice; + } + + /** + * @return the verifyMode + */ + public String getVerifyMode() + { + return this.verifyMode; + } + + /** + * @param verifyMode + * the verifyMode to set + */ + public void setVerifyMode(String verifyMode) + { + this.verifyMode = verifyMode; + } + + /** + * @return the signatureToVerify + */ + public int getSignatureToVerify() + { + return this.signatureToVerify; + } + + /** + * @param signatureToVerify + * the signatureToVerify to set + */ + public void setSignatureToVerify(int signatureToVerify) + { + this.signatureToVerify = signatureToVerify; + } + + /** + * @return the verificationTime + */ + public Date getVerificationTime() + { + return this.verificationTime; + } + + /** + * @param verificationTime + * the verificationTime to set + */ + public void setVerificationTime(Date verificationTime) + { + this.verificationTime = verificationTime; + } + + /** + * @return the returnHashInputData + */ + public boolean isReturnHashInputData() + { + return this.returnHashInputData; + } + + /** + * @param returnHashInputData + * the returnHashInputData to set + */ + public void setReturnHashInputData(boolean returnHashInputData) + { + this.returnHashInputData = returnHashInputData; + } + + public boolean isReturnNonTextualObjects() { + return this.returnNonTextualObjects; + } + + /** + * Tells if non text object of the signed pdf should be extracted and returned. + * One should show this to the user, especially in case of textual signature. + * Defaults to false + * + * @param returnNonTextualObjects + */ + public void setReturnNonTextualObjects(boolean returnNonTextualObjects) { + this.returnNonTextualObjects = returnNonTextualObjects; + } +} diff --git a/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 index 580f3af6..01156143 100644 --- 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 @@ -1,74 +1,97 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.xmldsig; - -import java.util.List; - -import at.gv.egiz.pdfas.api.commons.Constants; -import at.gv.egiz.pdfas.api.commons.SignatureInformation; - -/** - * The result of a reconstructXMLDsig call.
- * This is just a wrapper for a list of {@link ExtendedSignatureInformation}s - * - * - * @author exthex - */ -public class ReconstructXMLDsigResult { - - private List extendedSignatures; - - private String device; - - /** - * - * @param extendedSignatureInfos - * @param signatureDevice - */ - public ReconstructXMLDsigResult(List extendedSignatureInfos, String signatureDevice) { - this.extendedSignatures = extendedSignatureInfos; - this.device = signatureDevice; - } - - /** - * Get the signature device that was used to create this result. - * - * @return {@link Constants#SIGNATURE_DEVICE_MOA} or {@link Constants#SIGNATURE_DEVICE_BKU} - */ - public String getDevice() { - return device; - } - - /** - * Returns the list of found signatures. - * - * @return Returns a list of {@link ExtendedSignatureInformation} objects representing all - * found signatures + {@link XMLDsigData}. - * @see SignatureInformation - */ - public List getExtendedSignatures() { - return this.extendedSignatures; - } - -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.xmldsig; + +import java.util.List; + +import at.gv.egiz.pdfas.api.commons.Constants; +import at.gv.egiz.pdfas.api.commons.SignatureInformation; + +/** + * The result of a reconstructXMLDsig call.
+ * This is just a wrapper for a list of {@link ExtendedSignatureInformation}s + * + * + * @author exthex + */ +public class ReconstructXMLDsigResult { + + private List extendedSignatures; + + private String device; + + /** + * + * @param extendedSignatureInfos + * @param signatureDevice + */ + public ReconstructXMLDsigResult(List extendedSignatureInfos, String signatureDevice) { + this.extendedSignatures = extendedSignatureInfos; + this.device = signatureDevice; + } + + /** + * Get the signature device that was used to create this result. + * + * @return {@link Constants#SIGNATURE_DEVICE_MOA} or {@link Constants#SIGNATURE_DEVICE_BKU} + */ + public String getDevice() { + return device; + } + + /** + * Returns the list of found signatures. + * + * @return Returns a list of {@link ExtendedSignatureInformation} objects representing all + * found signatures + {@link XMLDsigData}. + * @see SignatureInformation + */ + public List getExtendedSignatures() { + return this.extendedSignatures; + } + +} diff --git a/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 index 0449cfa2..4f39b599 100644 --- 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 @@ -1,83 +1,106 @@ -/** - * Copyright 2006 by Know-Center, Graz, Austria - * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a - * joint initiative of the Federal Chancellery Austria and Graz University of - * Technology. - * - * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by - * the European Commission - subsequent versions of the EUPL (the "Licence"); - * You may not use this work except in compliance with the Licence. - * You may obtain a copy of the Licence at: - * http://www.osor.eu/eupl/ - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the Licence is distributed on an "AS IS" basis, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the Licence for the specific language governing permissions and - * limitations under the Licence. - * - * This product combines work with different licenses. See the "NOTICE" text - * file for details on the various modules and licenses. - * The "NOTICE" text file is part of the distribution. Any derivative works - * that you distribute must include a readable copy of the "NOTICE" text file. - */ -package at.gv.egiz.pdfas.api.xmldsig; - -/** - * A container for XMLDsig data. - * - * @author exthex - * - */ -public class XMLDsigData { - - private String xmlDsig; - - private boolean detached; - - /** - * Constructor. - * - * @param xmldsig the xml string of the xmldsig. - * @param detached true if detached, false otherwise - */ - public XMLDsigData(String xmldsig, boolean detached) { - this.xmlDsig = xmldsig; - this.detached = detached; - } - - /** - * Get the xmldsig string - * @return - */ - public String getXmlDsig() { - return xmlDsig; - } - - /** - * Set the xmldsig string. - * - * @param xmlDsig - */ - public void setXmlDsig(String xmlDsig) { - this.xmlDsig = xmlDsig; - } - - /** - * - * @return true if detached, false otherwise - */ - public boolean isDetached() { - return detached; - } - - /** - * Set the detached. - * - * @param detached - */ - public void setDetached(boolean detached) { - this.detached = detached; - } - -} +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * Copyright 2006 by Know-Center, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.xmldsig; + +/** + * A container for XMLDsig data. + * + * @author exthex + * + */ +public class XMLDsigData { + + private String xmlDsig; + + private boolean detached; + + /** + * Constructor. + * + * @param xmldsig the xml string of the xmldsig. + * @param detached true if detached, false otherwise + */ + public XMLDsigData(String xmldsig, boolean detached) { + this.xmlDsig = xmldsig; + this.detached = detached; + } + + /** + * Get the xmldsig string + * @return + */ + public String getXmlDsig() { + return xmlDsig; + } + + /** + * Set the xmldsig string. + * + * @param xmlDsig + */ + public void setXmlDsig(String xmlDsig) { + this.xmlDsig = xmlDsig; + } + + /** + * + * @return true if detached, false otherwise + */ + public boolean isDetached() { + return detached; + } + + /** + * Set the detached. + * + * @param detached + */ + public void setDetached(boolean detached) { + this.detached = detached; + } + +} 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 index a34405a8..7ea150ff 100644 --- 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 @@ -1,3 +1,26 @@ +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ /** * */ @@ -5,4 +28,4 @@ * @author afitzek * */ -package at.gv.egiz.pdfas.api.xmldsig; \ No newline at end of file +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 index bb39a322..95316937 100644 --- 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 @@ -1,3 +1,26 @@ +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ package at.gv.egiz.pdfas.wrapper; import java.io.ByteArrayOutputStream; 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 index ad494acd..152f4053 100644 --- 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 @@ -1,3 +1,26 @@ +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ package at.gv.egiz.pdfas.wrapper; import java.io.ByteArrayInputStream; 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 index 19394f0a..fa64f7bd 100644 --- 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 @@ -1,3 +1,26 @@ +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ package at.gv.egiz.pdfas.wrapper; import java.io.ByteArrayInputStream; 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 index b64bb4c7..8838834e 100644 --- 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 @@ -1,3 +1,26 @@ +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ package at.gv.egiz.pdfas.wrapper; import java.io.File; 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 index ecd3c031..005e3963 100644 --- 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 @@ -1,3 +1,26 @@ +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ package at.gv.egiz.pdfas.wrapper; import iaik.x509.X509Certificate; 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 index 87278c85..9d0f45d7 100644 --- 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 @@ -1,3 +1,26 @@ +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ package at.gv.egiz.pdfas.wrapper; import java.io.OutputStream; 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 index f8d36869..60711717 100644 --- 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 @@ -1,3 +1,26 @@ +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ package at.gv.egiz.pdfas.wrapper; import java.security.cert.X509Certificate; 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 index 04b0dd3c..743a7bf2 100644 --- 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 @@ -1,3 +1,26 @@ +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ package at.gv.egiz.pdfas.wrapper; import at.gv.egiz.pdfas.api.verify.SignatureCheck; 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 index 5192ffe4..fa036c8f 100644 --- 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 @@ -1,3 +1,26 @@ +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ package at.gv.egiz.pdfas.wrapper; import java.security.cert.X509Certificate; 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 index 2d950643..82da0d59 100644 --- 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 @@ -1,3 +1,26 @@ +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ package at.gv.egiz.pdfas.wrapper; import at.gv.egiz.pdfas.api.sign.pos.SignaturePosition; 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 index 44f9aa6c..e8e89cb4 100644 --- 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 @@ -1,3 +1,26 @@ +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ package at.gv.egiz.pdfas.wrapper; import at.gv.egiz.pdfas.api.verify.VerifyParameters; 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 index 7b35ef6c..770e7f3b 100644 --- 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 @@ -1,3 +1,26 @@ +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ package at.gv.egiz.pdfas.wrapper; import java.io.InputStream; 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 index d20da58b..d99db8bb 100644 --- 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 @@ -1,3 +1,26 @@ +/******************************************************************************* + * Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ package at.gv.egiz.pdfas.wrapper; import java.util.List; -- cgit v1.2.3