From 4e14449c2d0097e421bedc5f01647c8b09f1c49c Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Wed, 2 Oct 2013 11:29:09 +0200 Subject: Initial legacy API checkin --- .../gv/egiz/pdfas/api/verify/SignatureCheck.java | 51 +++++ .../api/verify/VerifyAfterAnalysisParameters.java | 166 ++++++++++++++ .../VerifyAfterReconstructXMLDsigParameters.java | 169 ++++++++++++++ .../gv/egiz/pdfas/api/verify/VerifyParameters.java | 249 +++++++++++++++++++++ .../at/gv/egiz/pdfas/api/verify/VerifyResult.java | 179 +++++++++++++++ .../at/gv/egiz/pdfas/api/verify/VerifyResults.java | 48 ++++ .../at/gv/egiz/pdfas/api/verify/package-info.java | 8 + 7 files changed, 870 insertions(+) create mode 100644 pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/SignatureCheck.java create mode 100644 pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyAfterAnalysisParameters.java create mode 100644 pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyAfterReconstructXMLDsigParameters.java create mode 100644 pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyParameters.java create mode 100644 pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResult.java create mode 100644 pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResults.java create mode 100644 pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/package-info.java (limited to 'pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify') 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 new file mode 100644 index 00000000..c1690774 --- /dev/null +++ b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/SignatureCheck.java @@ -0,0 +1,51 @@ +/** + * 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 new file mode 100644 index 00000000..8b9e2c6a --- /dev/null +++ b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyAfterAnalysisParameters.java @@ -0,0 +1,166 @@ +/** + * 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 new file mode 100644 index 00000000..8f8d17c7 --- /dev/null +++ b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyAfterReconstructXMLDsigParameters.java @@ -0,0 +1,169 @@ +/** + * 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 new file mode 100644 index 00000000..e7301dc4 --- /dev/null +++ b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyParameters.java @@ -0,0 +1,249 @@ +/** + * 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 new file mode 100644 index 00000000..fb48e5ee --- /dev/null +++ b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResult.java @@ -0,0 +1,179 @@ +/** + * 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 new file mode 100644 index 00000000..44b62a78 --- /dev/null +++ b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/VerifyResults.java @@ -0,0 +1,48 @@ +/** + * 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 new file mode 100644 index 00000000..be2cc3d4 --- /dev/null +++ b/pdf-as-legacy/src/main/java/at/gv/egiz/pdfas/api/verify/package-info.java @@ -0,0 +1,8 @@ +/** + * + */ +/** + * @author afitzek + * + */ +package at.gv.egiz.pdfas.api.verify; \ No newline at end of file -- cgit v1.2.3