diff options
Diffstat (limited to 'pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify')
7 files changed, 1024 insertions, 863 deletions
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> Copyright 2006 by Know-Center, Graz, Austria </copyright>
- * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a
- * joint initiative of the Federal Chancellery Austria and Graz University of
- * Technology.
- *
- * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
- * http://www.osor.eu/eupl/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- */
-package at.gv.egiz.pdfas.api.verify;
-
-/**
- * The result of a signature check performed by a verification device.
- *
- * @see VerifyResult
- *
- * @author wprinz
- */
-public interface SignatureCheck
-{
- /**
- * Returns the response code of the check.
- *
- * @return Returns the response code of the check.
- */
- public int getCode();
-
- /**
- * Returns the textual response message of the check (corresponding to the
- * code).
- *
- * @return Returns the textual response message of the check (corresponding to
- * the code).
- */
- public String getMessage();
-
-}
+/******************************************************************************* + * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.verify; + +/** + * The result of a signature check performed by a verification device. + * + * @see VerifyResult + * + * @author wprinz + */ +public interface SignatureCheck +{ + /** + * Returns the response code of the check. + * + * @return Returns the response code of the check. + */ + public int getCode(); + + /** + * Returns the textual response message of the check (corresponding to the + * code). + * + * @return Returns the textual response message of the check (corresponding to + * the code). + */ + public String getMessage(); + +} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyAfterAnalysisParameters.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyAfterAnalysisParameters.java 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> Copyright 2006 by Know-Center, Graz, Austria </copyright>
- * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a
- * joint initiative of the Federal Chancellery Austria and Graz University of
- * Technology.
- *
- * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
- * http://www.osor.eu/eupl/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- */
-package at.gv.egiz.pdfas.api.verify;
-
-import java.util.Date;
-
-import at.gv.egiz.pdfas.api.analyze.AnalyzeResult;
-import at.gv.egiz.pdfas.api.commons.Constants;
-
-/**
- * Parameter object that holds the verify after analysis parameters.
- *
- * @author wprinz
- */
-public class VerifyAfterAnalysisParameters
-{
-
- /**
- * The list of signatures to be verified.
- */
- protected AnalyzeResult analyzeResult = null;
-
- /**
- * The signature device to perform the actual signature.
- *
- * <p>
- * May be {@link Constants#SIGNATURE_DEVICE_MOA} or
- * {@link Constants#SIGNATURE_DEVICE_BKU}.
- * </p>
- */
- protected String signatureDevice = Constants.SIGNATURE_DEVICE_MOA;
-
- /**
- * Allows to pass a VerificationTime to the signature device.
- */
- protected Date verificationTime = null;
-
- /**
- * Tells the signature device (e.g. MOA) to return the signature hash input
- * data (which is the probably transformed signed data).
- *
- * <p>
- * Note that this forces MOA to return the potentially large signature data to
- * be returned in the result XML, which may result in very bad performance.
- * </p>
- */
- protected boolean returnHashInputData = false;
-
- /**
- * The index of the signature to be verified. A value < 0 indicates to verify all signatures.
- */
- protected int verifySignatureIndex = -1;
-
- /**
- * @return the analyzeResult
- */
- public AnalyzeResult getAnalyzeResult()
- {
- return this.analyzeResult;
- }
-
- /**
- * @param analyzeResult
- * the analyzeResult to set
- */
- public void setAnalyzeResult(AnalyzeResult analyzeResult)
- {
- this.analyzeResult = analyzeResult;
- }
-
- /**
- * @return the signatureDevice
- */
- public String getSignatureDevice()
- {
- return this.signatureDevice;
- }
-
- /**
- * @param signatureDevice
- * the signatureDevice to set
- */
- public void setSignatureDevice(String signatureDevice)
- {
- this.signatureDevice = signatureDevice;
- }
-
- /**
- * @return the verificationTime
- */
- public Date getVerificationTime()
- {
- return this.verificationTime;
- }
-
- /**
- * @param verificationTime the verificationTime to set
- */
- public void setVerificationTime(Date verificationTime)
- {
- this.verificationTime = verificationTime;
- }
-
- /**
- * @return the returnHashInputData
- */
- public boolean isReturnHashInputData()
- {
- return this.returnHashInputData;
- }
-
- /**
- * @param returnHashInputData
- * the returnHashInputData to set
- */
- public void setReturnHashInputData(boolean returnHashInputData)
- {
- this.returnHashInputData = returnHashInputData;
- }
-
- /**
- * Set the index of the signature to verify (index starting at 0). A value < 0 indicates to verify all values.
- * @param verify_which
- */
- public void setVerifySignatureIndex(int verify_which) {
- this.verifySignatureIndex = verify_which;
- }
-
- public int getVerifySignatureIndex() {
- return verifySignatureIndex;
- }
-
- /**
- * @see VerifyParameters#setSuppressVerifyExceptions(boolean)
- * @param suppress
- */
- public void setSuppressVerifyExceptions(boolean suppress) {
- VerifyParameters.setSuppressVerify(suppress);
- }
-
- public boolean isSuppressVerifyExceptions() {
- return VerifyParameters.isSuppressVerifyExceptions();
- }
-
-}
+/******************************************************************************* + * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.verify; + +import java.util.Date; + +import at.gv.egiz.pdfas.api.analyze.AnalyzeResult; +import at.gv.egiz.pdfas.api.commons.Constants; + +/** + * Parameter object that holds the verify after analysis parameters. + * + * @author wprinz + */ +public class VerifyAfterAnalysisParameters +{ + + /** + * The list of signatures to be verified. + */ + protected AnalyzeResult analyzeResult = null; + + /** + * The signature device to perform the actual signature. + * + * <p> + * May be {@link Constants#SIGNATURE_DEVICE_MOA} or + * {@link Constants#SIGNATURE_DEVICE_BKU}. + * </p> + */ + protected String signatureDevice = Constants.SIGNATURE_DEVICE_MOA; + + /** + * Allows to pass a VerificationTime to the signature device. + */ + protected Date verificationTime = null; + + /** + * Tells the signature device (e.g. MOA) to return the signature hash input + * data (which is the probably transformed signed data). + * + * <p> + * Note that this forces MOA to return the potentially large signature data to + * be returned in the result XML, which may result in very bad performance. + * </p> + */ + protected boolean returnHashInputData = false; + + /** + * The index of the signature to be verified. A value < 0 indicates to verify all signatures. + */ + protected int verifySignatureIndex = -1; + + /** + * @return the analyzeResult + */ + public AnalyzeResult getAnalyzeResult() + { + return this.analyzeResult; + } + + /** + * @param analyzeResult + * the analyzeResult to set + */ + public void setAnalyzeResult(AnalyzeResult analyzeResult) + { + this.analyzeResult = analyzeResult; + } + + /** + * @return the signatureDevice + */ + public String getSignatureDevice() + { + return this.signatureDevice; + } + + /** + * @param signatureDevice + * the signatureDevice to set + */ + public void setSignatureDevice(String signatureDevice) + { + this.signatureDevice = signatureDevice; + } + + /** + * @return the verificationTime + */ + public Date getVerificationTime() + { + return this.verificationTime; + } + + /** + * @param verificationTime the verificationTime to set + */ + public void setVerificationTime(Date verificationTime) + { + this.verificationTime = verificationTime; + } + + /** + * @return the returnHashInputData + */ + public boolean isReturnHashInputData() + { + return this.returnHashInputData; + } + + /** + * @param returnHashInputData + * the returnHashInputData to set + */ + public void setReturnHashInputData(boolean returnHashInputData) + { + this.returnHashInputData = returnHashInputData; + } + + /** + * Set the index of the signature to verify (index starting at 0). A value < 0 indicates to verify all values. + * @param verify_which + */ + public void setVerifySignatureIndex(int verify_which) { + this.verifySignatureIndex = verify_which; + } + + public int getVerifySignatureIndex() { + return verifySignatureIndex; + } + + /** + * @see VerifyParameters#setSuppressVerifyExceptions(boolean) + * @param suppress + */ + public void setSuppressVerifyExceptions(boolean suppress) { + VerifyParameters.setSuppressVerify(suppress); + } + + public boolean isSuppressVerifyExceptions() { + return VerifyParameters.isSuppressVerifyExceptions(); + } + +} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyAfterReconstructXMLDsigParameters.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyAfterReconstructXMLDsigParameters.java 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> Copyright 2006 by Know-Center, Graz, Austria </copyright>
- * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a
- * joint initiative of the Federal Chancellery Austria and Graz University of
- * Technology.
- *
- * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
- * http://www.osor.eu/eupl/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- */
-package at.gv.egiz.pdfas.api.verify;
-
-import java.util.Date;
-
-import at.gv.egiz.pdfas.api.commons.Constants;
-import at.gv.egiz.pdfas.api.xmldsig.ReconstructXMLDsigResult;
-
-/**
- * This class represents the parameters needed for verify after reconstructXMLDsig has already been executed.
- *
- * @author exthex
- *
- */
-public class VerifyAfterReconstructXMLDsigParameters {
-
- /**
- * The list of signatures to be verified.
- */
- protected ReconstructXMLDsigResult reconstructXMLDsigResult = null;
-
- /**
- * The signature device to perform the actual signature.
- *
- * <p>
- * May be {@link Constants#SIGNATURE_DEVICE_MOA} or
- * {@link Constants#SIGNATURE_DEVICE_BKU}.
- * </p>
- */
- protected String signatureDevice;
-
- /**
- * Allows to pass a VerificationTime to the signature device.
- */
- protected Date verificationTime = null;
-
- /**
- * Tells the signature device (e.g. MOA) to return the signature hash input
- * data (which is the probably transformed signed data).
- *
- * <p>
- * Note that this forces MOA to return the potentially large signature data to
- * be returned in the result XML, which may result in very bad performance.
- * </p>
- */
- protected boolean returnHashInputData = false;
-
- /**
- * The index of the signature to be verified. A value < 0 indicates to verify all signatures.
- */
- protected int verifySignatureIndex = -1;
-
- /**
- * @return the reconstructXMLDsigResult
- */
- public ReconstructXMLDsigResult getReconstructXMLDsigResult()
- {
- return this.reconstructXMLDsigResult;
- }
-
- /**
- * @param reconstructXMLDsigResult
- * the reconstructXMLDsigResult to set
- */
- public void setReconstructXMLDsigResult(ReconstructXMLDsigResult reconstructXMLDsigResult)
- {
- this.reconstructXMLDsigResult = reconstructXMLDsigResult;
- }
-
- /**
- * @return the signatureDevice
- */
- public String getSignatureDevice()
- {
- return this.signatureDevice;
- }
-
- /**
- * Set the signature device to use for verification.
- * If none is set here, the signature device that was used for reconstructXMLDsig will be used.
- *
- * @param signatureDevice
- * the signatureDevice to set
- */
- public void setSignatureDevice(String signatureDevice)
- {
- this.signatureDevice = signatureDevice;
- }
-
- /**
- * @return the verificationTime
- */
- public Date getVerificationTime()
- {
- return this.verificationTime;
- }
-
- /**
- * @param verificationTime the verificationTime to set
- */
- public void setVerificationTime(Date verificationTime)
- {
- this.verificationTime = verificationTime;
- }
-
- /**
- * @return the returnHashInputData
- */
- public boolean isReturnHashInputData()
- {
- return this.returnHashInputData;
- }
-
- /**
- * @param returnHashInputData
- * the returnHashInputData to set
- */
- public void setReturnHashInputData(boolean returnHashInputData)
- {
- this.returnHashInputData = returnHashInputData;
- }
-
- /**
- * Set the index of the signature to verify (index starting at 0). A value < 0 indicates to verify all values.
- * @param verify_which
- */
- public void setVerifySignatureIndex(int verify_which) {
- this.verifySignatureIndex = verify_which;
- }
-
- public int getVerifySignatureIndex() {
- return verifySignatureIndex;
- }
-
- /**
- * @see VerifyParameters#setSuppressVerifyExceptions(boolean)
- * @param suppress
- */
- public void setSuppressVerifyExceptions(boolean suppress) {
- VerifyParameters.setSuppressVerify(suppress);
- }
-
- public boolean isSuppressVerifyExceptions() {
- return VerifyParameters.isSuppressVerifyExceptions();
- }
-
-}
+/******************************************************************************* + * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.verify; + +import java.util.Date; + +import at.gv.egiz.pdfas.api.commons.Constants; +import at.gv.egiz.pdfas.api.xmldsig.ReconstructXMLDsigResult; + +/** + * This class represents the parameters needed for verify after reconstructXMLDsig has already been executed. + * + * @author exthex + * + */ +public class VerifyAfterReconstructXMLDsigParameters { + + /** + * The list of signatures to be verified. + */ + protected ReconstructXMLDsigResult reconstructXMLDsigResult = null; + + /** + * The signature device to perform the actual signature. + * + * <p> + * May be {@link Constants#SIGNATURE_DEVICE_MOA} or + * {@link Constants#SIGNATURE_DEVICE_BKU}. + * </p> + */ + protected String signatureDevice; + + /** + * Allows to pass a VerificationTime to the signature device. + */ + protected Date verificationTime = null; + + /** + * Tells the signature device (e.g. MOA) to return the signature hash input + * data (which is the probably transformed signed data). + * + * <p> + * Note that this forces MOA to return the potentially large signature data to + * be returned in the result XML, which may result in very bad performance. + * </p> + */ + protected boolean returnHashInputData = false; + + /** + * The index of the signature to be verified. A value < 0 indicates to verify all signatures. + */ + protected int verifySignatureIndex = -1; + + /** + * @return the reconstructXMLDsigResult + */ + public ReconstructXMLDsigResult getReconstructXMLDsigResult() + { + return this.reconstructXMLDsigResult; + } + + /** + * @param reconstructXMLDsigResult + * the reconstructXMLDsigResult to set + */ + public void setReconstructXMLDsigResult(ReconstructXMLDsigResult reconstructXMLDsigResult) + { + this.reconstructXMLDsigResult = reconstructXMLDsigResult; + } + + /** + * @return the signatureDevice + */ + public String getSignatureDevice() + { + return this.signatureDevice; + } + + /** + * Set the signature device to use for verification. + * If none is set here, the signature device that was used for reconstructXMLDsig will be used. + * + * @param signatureDevice + * the signatureDevice to set + */ + public void setSignatureDevice(String signatureDevice) + { + this.signatureDevice = signatureDevice; + } + + /** + * @return the verificationTime + */ + public Date getVerificationTime() + { + return this.verificationTime; + } + + /** + * @param verificationTime the verificationTime to set + */ + public void setVerificationTime(Date verificationTime) + { + this.verificationTime = verificationTime; + } + + /** + * @return the returnHashInputData + */ + public boolean isReturnHashInputData() + { + return this.returnHashInputData; + } + + /** + * @param returnHashInputData + * the returnHashInputData to set + */ + public void setReturnHashInputData(boolean returnHashInputData) + { + this.returnHashInputData = returnHashInputData; + } + + /** + * Set the index of the signature to verify (index starting at 0). A value < 0 indicates to verify all values. + * @param verify_which + */ + public void setVerifySignatureIndex(int verify_which) { + this.verifySignatureIndex = verify_which; + } + + public int getVerifySignatureIndex() { + return verifySignatureIndex; + } + + /** + * @see VerifyParameters#setSuppressVerifyExceptions(boolean) + * @param suppress + */ + public void setSuppressVerifyExceptions(boolean suppress) { + VerifyParameters.setSuppressVerify(suppress); + } + + public boolean isSuppressVerifyExceptions() { + return VerifyParameters.isSuppressVerifyExceptions(); + } + +} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyParameters.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyParameters.java 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> Copyright 2006 by Know-Center, Graz, Austria </copyright>
- * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a
- * joint initiative of the Federal Chancellery Austria and Graz University of
- * Technology.
- *
- * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
- * http://www.osor.eu/eupl/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- */
-package at.gv.egiz.pdfas.api.verify;
-
-import java.util.Date;
-
-import at.gv.egiz.pdfas.api.commons.Constants;
-import at.gv.egiz.pdfas.api.io.DataSource;
-
-/**
- * Parameter object that holds the verify parameters.
- *
- * @author wprinz
- */
-public class VerifyParameters
-{
- // This would be a perfect point for multiple inheritance in Java.
- // VerifyParameters extends AnalyzeParameters, VerifyAfterAnalysisParameters
- // Then a lot of code could be easily reused in the PdfAsObject's check*Parameters methods.
-
- /**
- * The document to be verified.
- */
- protected DataSource document = null;
-
- /**
- * The signature device to perform the actual signature.
- *
- * <p>
- * May be {@link Constants#SIGNATURE_DEVICE_MOA} or
- * {@link Constants#SIGNATURE_DEVICE_BKU}.
- * </p>
- */
- protected String signatureDevice = Constants.SIGNATURE_DEVICE_MOA;
-
- /**
- * The mode of operation how the document is analyzed.
- *
- * <p>
- * May be {@link Constants#VERIFY_MODE_BINARY_ONLY} to check the document for
- * binary signatures only (very fast). Or may be
- * {@link Constants#VERIFY_MODE_SEMI_CONSERVATIVE} to perform a semi
- * conservative (optimized) text and binary verification (slow). Or may be
- * {@link Constants#VERIFY_MODE_FULL_CONSERVATIVE} to perform a full
- * conservative text and binary verification (very slow).
- * </p>
- */
- protected String verifyMode = Constants.VERIFY_MODE_FULL_CONSERVATIVE;
-
- /**
- * The (zero based) index of the signature to verify.
- *
- * <p>
- * This allows to verify only one found signature instead of all. {@link Constants#VERIFY_ALL} means to
- * verify all found signatures.
- * </p>
- */
- protected int signatureToVerify = Constants.VERIFY_ALL;
-
- /**
- * Allows to pass a VerificationTime to the verification device.
- *
- * <p>
- * Note that the actual usage of this parameter depends on the verification device.
- * </p>
- */
- protected Date verificationTime = null;
-
- /**
- * Tells the signature device (e.g. MOA) to return the signature hash input
- * data (which is the probably transformed signed data).
- *
- * <p>
- * Note that this forces MOA to return the potentially large signature data to
- * be returned in the result XML, which may result in very bad performance.
- * </p>
- */
- protected boolean returnHashInputData = false;
-
- protected boolean returnNonTextualObjects = false;
-
- private static ThreadLocal suppressVerifyExceptions = new ThreadLocal();
-
-
- public VerifyParameters() {
- suppressVerifyExceptions.set(Boolean.FALSE);
- }
- /**
- * @return the document
- */
- public DataSource getDocument()
- {
- return this.document;
- }
-
- /**
- * @param document
- * the document to set
- */
- public void setDocument(DataSource document)
- {
- this.document = document;
- }
-
- /**
- * @return the signatureDevice
- */
- public String getSignatureDevice()
- {
- return this.signatureDevice;
- }
-
- /**
- * @param signatureDevice
- * the signatureDevice to set
- */
- public void setSignatureDevice(String signatureDevice)
- {
- this.signatureDevice = signatureDevice;
- }
-
- /**
- * @return the verifyMode
- */
- public String getVerifyMode()
- {
- return this.verifyMode;
- }
-
- /**
- * @param verifyMode
- * the verifyMode to set
- */
- public void setVerifyMode(String verifyMode)
- {
- this.verifyMode = verifyMode;
- }
-
- /**
- * @return the signatureToVerify
- */
- public int getSignatureToVerify()
- {
- return this.signatureToVerify;
- }
-
- /**
- * @param signatureToVerify
- * the signatureToVerify to set
- */
- public void setSignatureToVerify(int signatureToVerify)
- {
- this.signatureToVerify = signatureToVerify;
- }
-
- /**
- * @return the verificationTime
- */
- public Date getVerificationTime()
- {
- return this.verificationTime;
- }
-
- /**
- * @param verificationTime
- * the verificationTime to set
- */
- public void setVerificationTime(Date verificationTime)
- {
- this.verificationTime = verificationTime;
- }
-
- /**
- * @return the returnHashInputData
- */
- public boolean isReturnHashInputData()
- {
- return this.returnHashInputData;
- }
-
- /**
- * @param returnHashInputData
- * the returnHashInputData to set
- */
- public void setReturnHashInputData(boolean returnHashInputData)
- {
- this.returnHashInputData = returnHashInputData;
- }
-
- public boolean isReturnNonTextualObjects() {
- return this.returnNonTextualObjects;
- }
-
- /**
- * Tells if non text object of the signed pdf should be extracted and returned.
- * One should show this to the user, especially in case of textual signature.
- * Defaults to <tt>false</tt>
- *
- * @param returnNonTextualObjects
- */
- public void setReturnNonTextualObjects(boolean returnNonTextualObjects) {
- this.returnNonTextualObjects = returnNonTextualObjects;
- }
-
- /**
- * Set if verify exceptions (because of unknown signatures) are suppressed or not (default).
- * Suppressing can be helpful for multiple signatures if you want to verify the working rest. Unsupported
- * Signatures are reported without throwing an exception via {@link VerifyResult#getVerificationException()}
- * @param suppress
- */
- public void setSuppressVerifyExceptions(boolean suppress) {
- setSuppressVerify(suppress);
- }
-
- /**
- * See {@link #setSuppressVerifyExceptions(boolean)}
- * @return
- */
- public static boolean isSuppressVerifyExceptions() {
- if (suppressVerifyExceptions.get() == null) return false;
- return ((Boolean) suppressVerifyExceptions.get()).booleanValue();
- }
-
- static void setSuppressVerify(boolean suppress) {
- suppressVerifyExceptions.set(new Boolean(suppress));
- }
-
-}
+/******************************************************************************* + * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.verify; + +import java.util.Date; + +import at.gv.egiz.pdfas.api.commons.Constants; +import at.gv.egiz.pdfas.api.io.DataSource; + +/** + * Parameter object that holds the verify parameters. + * + * @author wprinz + */ +public class VerifyParameters +{ + // This would be a perfect point for multiple inheritance in Java. + // VerifyParameters extends AnalyzeParameters, VerifyAfterAnalysisParameters + // Then a lot of code could be easily reused in the PdfAsObject's check*Parameters methods. + + /** + * The document to be verified. + */ + protected DataSource document = null; + + /** + * The signature device to perform the actual signature. + * + * <p> + * May be {@link Constants#SIGNATURE_DEVICE_MOA} or + * {@link Constants#SIGNATURE_DEVICE_BKU}. + * </p> + */ + protected String signatureDevice = Constants.SIGNATURE_DEVICE_MOA; + + /** + * The mode of operation how the document is analyzed. + * + * <p> + * May be {@link Constants#VERIFY_MODE_BINARY_ONLY} to check the document for + * binary signatures only (very fast). Or may be + * {@link Constants#VERIFY_MODE_SEMI_CONSERVATIVE} to perform a semi + * conservative (optimized) text and binary verification (slow). Or may be + * {@link Constants#VERIFY_MODE_FULL_CONSERVATIVE} to perform a full + * conservative text and binary verification (very slow). + * </p> + */ + protected String verifyMode = Constants.VERIFY_MODE_FULL_CONSERVATIVE; + + /** + * The (zero based) index of the signature to verify. + * + * <p> + * This allows to verify only one found signature instead of all. {@link Constants#VERIFY_ALL} means to + * verify all found signatures. + * </p> + */ + protected int signatureToVerify = Constants.VERIFY_ALL; + + /** + * Allows to pass a VerificationTime to the verification device. + * + * <p> + * Note that the actual usage of this parameter depends on the verification device. + * </p> + */ + protected Date verificationTime = null; + + /** + * Tells the signature device (e.g. MOA) to return the signature hash input + * data (which is the probably transformed signed data). + * + * <p> + * Note that this forces MOA to return the potentially large signature data to + * be returned in the result XML, which may result in very bad performance. + * </p> + */ + protected boolean returnHashInputData = false; + + protected boolean returnNonTextualObjects = false; + + private static ThreadLocal suppressVerifyExceptions = new ThreadLocal(); + + + public VerifyParameters() { + suppressVerifyExceptions.set(Boolean.FALSE); + } + /** + * @return the document + */ + public DataSource getDocument() + { + return this.document; + } + + /** + * @param document + * the document to set + */ + public void setDocument(DataSource document) + { + this.document = document; + } + + /** + * @return the signatureDevice + */ + public String getSignatureDevice() + { + return this.signatureDevice; + } + + /** + * @param signatureDevice + * the signatureDevice to set + */ + public void setSignatureDevice(String signatureDevice) + { + this.signatureDevice = signatureDevice; + } + + /** + * @return the verifyMode + */ + public String getVerifyMode() + { + return this.verifyMode; + } + + /** + * @param verifyMode + * the verifyMode to set + */ + public void setVerifyMode(String verifyMode) + { + this.verifyMode = verifyMode; + } + + /** + * @return the signatureToVerify + */ + public int getSignatureToVerify() + { + return this.signatureToVerify; + } + + /** + * @param signatureToVerify + * the signatureToVerify to set + */ + public void setSignatureToVerify(int signatureToVerify) + { + this.signatureToVerify = signatureToVerify; + } + + /** + * @return the verificationTime + */ + public Date getVerificationTime() + { + return this.verificationTime; + } + + /** + * @param verificationTime + * the verificationTime to set + */ + public void setVerificationTime(Date verificationTime) + { + this.verificationTime = verificationTime; + } + + /** + * @return the returnHashInputData + */ + public boolean isReturnHashInputData() + { + return this.returnHashInputData; + } + + /** + * @param returnHashInputData + * the returnHashInputData to set + */ + public void setReturnHashInputData(boolean returnHashInputData) + { + this.returnHashInputData = returnHashInputData; + } + + public boolean isReturnNonTextualObjects() { + return this.returnNonTextualObjects; + } + + /** + * Tells if non text object of the signed pdf should be extracted and returned. + * One should show this to the user, especially in case of textual signature. + * Defaults to <tt>false</tt> + * + * @param returnNonTextualObjects + */ + public void setReturnNonTextualObjects(boolean returnNonTextualObjects) { + this.returnNonTextualObjects = returnNonTextualObjects; + } + + /** + * Set if verify exceptions (because of unknown signatures) are suppressed or not (default). + * Suppressing can be helpful for multiple signatures if you want to verify the working rest. Unsupported + * Signatures are reported without throwing an exception via {@link VerifyResult#getVerificationException()} + * @param suppress + */ + public void setSuppressVerifyExceptions(boolean suppress) { + setSuppressVerify(suppress); + } + + /** + * See {@link #setSuppressVerifyExceptions(boolean)} + * @return + */ + public static boolean isSuppressVerifyExceptions() { + if (suppressVerifyExceptions.get() == null) return false; + return ((Boolean) suppressVerifyExceptions.get()).booleanValue(); + } + + static void setSuppressVerify(boolean suppress) { + suppressVerifyExceptions.set(new Boolean(suppress)); + } + +} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResult.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResult.java 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> Copyright 2006 by Know-Center, Graz, Austria </copyright>
- * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a
- * joint initiative of the Federal Chancellery Austria and Graz University of
- * Technology.
- *
- * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
- * http://www.osor.eu/eupl/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- */
-package at.gv.egiz.pdfas.api.verify;
-
-import java.util.Date;
-import java.util.List;
-
-import at.gv.egiz.pdfas.api.PdfAs;
-import at.gv.egiz.pdfas.api.analyze.NonTextObjectInfo;
-import at.gv.egiz.pdfas.api.commons.SignatureInformation;
-import at.gv.egiz.pdfas.api.exceptions.PdfAsException;
-import at.gv.egiz.pdfas.api.xmldsig.XMLDsigData;
-
-/**
- * Encapsulates the data of a verification of one signature.
- *
- * @author wprinz
- */
-public interface VerifyResult extends SignatureInformation
-{
- /**
- * Returns if the verification was possible or could not even be startet. see {@link #getVerificationException()} for details.
- * @return
- */
- public boolean isVerificationDone();
-
- /**
- * Returns a verification exception if any. Shows that the verification could not be started. See {@link #isVerificationDone()}.
- * @return
- */
- public PdfAsException getVerificationException();
-
- /**
- * Returns the result of the certificate check.
- *
- * @return Returns the result of the certificate check.
- */
- public SignatureCheck getCertificateCheck();
-
- /**
- * Returns the result of the value (and hash) check.
- *
- * @return Returns the result of the value (and hash) check.
- */
- public SignatureCheck getValueCheckCode();
-
- /**
- * Returns the result of the manifest check.
- *
- * @return Returns the result of the manifest check.
- */
- public SignatureCheck getManifestCheckCode();
-
- /**
- * Returns true, if the signer's certificate is a qualified certificate.
- *
- * @return Returns true, if the signer's certificate is a qualified
- * certificate.
- */
- public boolean isQualifiedCertificate();
-
- /**
- * Returns {@code true} if public authority is indicated.
- * @return {@code true} if public authority.
- */
- public boolean isPublicAuthority();
-
- /**
- * Returns the public authority code or {@code null}.
- * @return The public authority code or {@code null}.
- */
- public String getPublicAuthorityCode();
-
- /**
- * Returns a list of Strings each stating one public property of the
- * certificate.
- *
- * <p>
- * Such public properties are certificate extensions each being assigned an
- * own OID. For example the public property "Verwaltungseigenschaft" has the
- * OID "1.2.40.0.10.1.1.1".
- * </p>
- *
- * @return Returns the list of Strings representing the public properties of
- * this certificate, if any.
- */
- public List getPublicProperties();
-
- /**
- * Returns the verification time, which is the time when the signature was
- * verified.
- *
- * <p>
- * Note that this is actually the Date passed to the verify methods over
- * {@link VerifyParameters#setVerificationTime(Date)} or
- * {@link VerifyAfterAnalysisParameters#setVerificationTime(Date)}. The
- * signature devices don't respond the actual verification time so there is no
- * guarantee that the set verification time was actually used as time of
- * verification. Please consult the device's documentation for more
- * information.
- * </p>
- * <p>
- * If the verification device does not return a verification time and no
- * verification time was set in the
- * {@link VerifyParameters#setVerificationTime(Date)} or
- * {@link VerifyAfterAnalysisParameters#setVerificationTime(Date)}, the time
- * returned by this method will be equal to the signing time (
- * {@link SignatureInformation#getSigningTime()}).
- * </p>
- *
- * @return Returns the verification time, which is the time when the signature
- * was verified.
- */
- public Date getVerificationTime();
-
- /**
- * Returns the hash input data as returned by MOA as Base64-encoded String.
- *
- * <p>
- * This will only return a value other than null if the corresponding
- * {@link VerifyParameters} has been set to true.
- * </p>
- * <p>
- * Note that the HashInputData does not necessarily have to be exactly the
- * same as the signed data return by the
- * {@link SignatureInformation#getSignedData()} method.
- * </p>
- *
- * @return Returns the base64 encoded hash input data as returned by MOA.
- *
- * @see SignatureInformation#getSignedData()
- */
- public String getHashInputData();
-
- /**
- * Returns a list<{@link NonTextObjectInfo}> of non textual objects in the pdf document.
- * Only available for textual signatures. Show this to the user who signed the textual content only!
- * @return List<{@link NonTextObjectInfo} or <tt>null</tt> of not available (binary signature)
- */
- public List getNonTextualObjects();
-
-
- /**
- * Returns <code>true</code> if non textual objects have been found, <code>false</code> if not.
- * @return <code>true</code> if non textual objects have been found, <code>false</code> if not.
- */
- public boolean hasNonTextualObjects();
-
- /**
- * Get the reconstructed xmldsig XML data. The reconstruction is done during the verification process.
- *
- * @see PdfAs#reconstructXMLDSIG(at.gv.egiz.pdfas.api.xmldsig.ReconstructXMLDsigParameters)
- * @see PdfAs#reconstructXMLDSIG(at.gv.egiz.pdfas.api.xmldsig.ReconstructXMLDsigAfterAnalysisParameters)
- * @return
- */
- public XMLDsigData getReconstructedXMLDsig();
-
-}
+/******************************************************************************* + * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.verify; + +import java.util.Date; +import java.util.List; + +import at.gv.egiz.pdfas.api.PdfAs; +import at.gv.egiz.pdfas.api.analyze.NonTextObjectInfo; +import at.gv.egiz.pdfas.api.commons.SignatureInformation; +import at.gv.egiz.pdfas.api.exceptions.PdfAsException; +import at.gv.egiz.pdfas.api.xmldsig.XMLDsigData; + +/** + * Encapsulates the data of a verification of one signature. + * + * @author wprinz + */ +public interface VerifyResult extends SignatureInformation +{ + /** + * Returns if the verification was possible or could not even be startet. see {@link #getVerificationException()} for details. + * @return + */ + public boolean isVerificationDone(); + + /** + * Returns a verification exception if any. Shows that the verification could not be started. See {@link #isVerificationDone()}. + * @return + */ + public PdfAsException getVerificationException(); + + /** + * Returns the result of the certificate check. + * + * @return Returns the result of the certificate check. + */ + public SignatureCheck getCertificateCheck(); + + /** + * Returns the result of the value (and hash) check. + * + * @return Returns the result of the value (and hash) check. + */ + public SignatureCheck getValueCheckCode(); + + /** + * Returns the result of the manifest check. + * + * @return Returns the result of the manifest check. + */ + public SignatureCheck getManifestCheckCode(); + + /** + * Returns true, if the signer's certificate is a qualified certificate. + * + * @return Returns true, if the signer's certificate is a qualified + * certificate. + */ + public boolean isQualifiedCertificate(); + + /** + * Returns {@code true} if public authority is indicated. + * @return {@code true} if public authority. + */ + public boolean isPublicAuthority(); + + /** + * Returns the public authority code or {@code null}. + * @return The public authority code or {@code null}. + */ + public String getPublicAuthorityCode(); + + /** + * Returns a list of Strings each stating one public property of the + * certificate. + * + * <p> + * Such public properties are certificate extensions each being assigned an + * own OID. For example the public property "Verwaltungseigenschaft" has the + * OID "1.2.40.0.10.1.1.1". + * </p> + * + * @return Returns the list of Strings representing the public properties of + * this certificate, if any. + */ + public List getPublicProperties(); + + /** + * Returns the verification time, which is the time when the signature was + * verified. + * + * <p> + * Note that this is actually the Date passed to the verify methods over + * {@link VerifyParameters#setVerificationTime(Date)} or + * {@link VerifyAfterAnalysisParameters#setVerificationTime(Date)}. The + * signature devices don't respond the actual verification time so there is no + * guarantee that the set verification time was actually used as time of + * verification. Please consult the device's documentation for more + * information. + * </p> + * <p> + * If the verification device does not return a verification time and no + * verification time was set in the + * {@link VerifyParameters#setVerificationTime(Date)} or + * {@link VerifyAfterAnalysisParameters#setVerificationTime(Date)}, the time + * returned by this method will be equal to the signing time ( + * {@link SignatureInformation#getSigningTime()}). + * </p> + * + * @return Returns the verification time, which is the time when the signature + * was verified. + */ + public Date getVerificationTime(); + + /** + * Returns the hash input data as returned by MOA as Base64-encoded String. + * + * <p> + * This will only return a value other than null if the corresponding + * {@link VerifyParameters} has been set to true. + * </p> + * <p> + * Note that the HashInputData does not necessarily have to be exactly the + * same as the signed data return by the + * {@link SignatureInformation#getSignedData()} method. + * </p> + * + * @return Returns the base64 encoded hash input data as returned by MOA. + * + * @see SignatureInformation#getSignedData() + */ + public String getHashInputData(); + + /** + * Returns a list<{@link NonTextObjectInfo}> of non textual objects in the pdf document. + * Only available for textual signatures. Show this to the user who signed the textual content only! + * @return List<{@link NonTextObjectInfo} or <tt>null</tt> of not available (binary signature) + */ + public List getNonTextualObjects(); + + + /** + * Returns <code>true</code> if non textual objects have been found, <code>false</code> if not. + * @return <code>true</code> if non textual objects have been found, <code>false</code> if not. + */ + public boolean hasNonTextualObjects(); + + /** + * Get the reconstructed xmldsig XML data. The reconstruction is done during the verification process. + * + * @see PdfAs#reconstructXMLDSIG(at.gv.egiz.pdfas.api.xmldsig.ReconstructXMLDsigParameters) + * @see PdfAs#reconstructXMLDSIG(at.gv.egiz.pdfas.api.xmldsig.ReconstructXMLDsigAfterAnalysisParameters) + * @return + */ + public XMLDsigData getReconstructedXMLDsig(); + +} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResults.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResults.java 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> Copyright 2006 by Know-Center, Graz, Austria </copyright>
- * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a
- * joint initiative of the Federal Chancellery Austria and Graz University of
- * Technology.
- *
- * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
- * the European Commission - subsequent versions of the EUPL (the "Licence");
- * You may not use this work except in compliance with the Licence.
- * You may obtain a copy of the Licence at:
- * http://www.osor.eu/eupl/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the Licence is distributed on an "AS IS" basis,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the Licence for the specific language governing permissions and
- * limitations under the Licence.
- *
- * This product combines work with different licenses. See the "NOTICE" text
- * file for details on the various modules and licenses.
- * The "NOTICE" text file is part of the distribution. Any derivative works
- * that you distribute must include a readable copy of the "NOTICE" text file.
- */
-package at.gv.egiz.pdfas.api.verify;
-
-import java.util.List;
-
-/**
- * The result of the verification of a document.
- *
- * <p>
- * Currently, this is not more than a list of VerifyResult objects, one for each
- * verified signature. There may be additional items in future PDF-AS versions.
- * </p>
- *
- * @author wprinz
- */
-public interface VerifyResults
-{
- /**
- * Returns the List of VerifyResult objects, one for each verified signature.
- *
- * @return Returns the List of VerifyResult objects, one for each verified
- * signature.
- */
- public List getResults();
-
-}
+/******************************************************************************* + * <copyright> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ +/** + * <copyright> Copyright 2006 by Know-Center, Graz, Austria </copyright> + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ +package at.gv.egiz.pdfas.api.verify; + +import java.util.List; + +/** + * The result of the verification of a document. + * + * <p> + * Currently, this is not more than a list of VerifyResult objects, one for each + * verified signature. There may be additional items in future PDF-AS versions. + * </p> + * + * @author wprinz + */ +public interface VerifyResults +{ + /** + * Returns the List of VerifyResult objects, one for each verified signature. + * + * @return Returns the List of VerifyResult objects, one for each verified + * signature. + */ + public List getResults(); + +} diff --git a/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/package-info.java b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/package-info.java 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> Copyright 2014 by E-Government Innovation Center EGIZ, Graz, Austria </copyright> + * PDF-AS has been contracted by the E-Government Innovation Center EGIZ, a + * joint initiative of the Federal Chancellery Austria and Graz University of + * Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + ******************************************************************************/ /** * */ @@ -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; |