aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authortknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-12-14 13:43:36 +0000
committertknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-12-14 13:43:36 +0000
commit86d58bef746c914139f7189f2b4dfe5f77b45fb5 (patch)
tree1f6c990b71b6d784a6215f15bf854052c20621e7 /src/main/java
parentc0ea288869c5c21d93c59702148305eefa3f1f51 (diff)
downloadpdf-as-3-86d58bef746c914139f7189f2b4dfe5f77b45fb5.tar.gz
pdf-as-3-86d58bef746c914139f7189f2b4dfe5f77b45fb5.tar.bz2
pdf-as-3-86d58bef746c914139f7189f2b4dfe5f77b45fb5.zip
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@707 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/demo/SignatureVerificationDemo.java18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/main/java/demo/SignatureVerificationDemo.java b/src/main/java/demo/SignatureVerificationDemo.java
index 4b17f11..f7b8d53 100644
--- a/src/main/java/demo/SignatureVerificationDemo.java
+++ b/src/main/java/demo/SignatureVerificationDemo.java
@@ -15,6 +15,7 @@ import at.gv.egiz.pdfas.api.commons.Constants;
import at.gv.egiz.pdfas.api.commons.SignatureInformation;
import at.gv.egiz.pdfas.api.exceptions.PdfAsException;
import at.gv.egiz.pdfas.api.io.DataSource;
+import at.gv.egiz.pdfas.api.verify.VerifyAfterAnalysisParameters;
import at.gv.egiz.pdfas.api.verify.VerifyAfterReconstructXMLDsigParameters;
import at.gv.egiz.pdfas.api.verify.VerifyResult;
import at.gv.egiz.pdfas.api.verify.VerifyResults;
@@ -113,8 +114,8 @@ public class SignatureVerificationDemo {
// retrieve reconstructed signature
ReconstructXMLDsigAfterAnalysisParameters recstrParams = new ReconstructXMLDsigAfterAnalysisParameters();
- recstrParams.setSignatureDevice(Constants.SIGNATURE_DEVICE_BKU);
recstrParams.setAnalyzeResult(analyzeResult);
+ recstrParams.setSignatureDevice(Constants.SIGNATURE_DEVICE_MOA);
ReconstructXMLDsigResult recstrResult = pdfasAPI.reconstructXMLDSIG(recstrParams);
// it is now possible to retrieve the reconstructed XMLDSig and the underlying signed
@@ -137,6 +138,7 @@ public class SignatureVerificationDemo {
*/
// setup verification
+
// verification without intermediate step of reconstruction
/*
VerifyAfterAnalysisParameters vaap = new VerifyAfterAnalysisParameters();
@@ -144,20 +146,30 @@ public class SignatureVerificationDemo {
vaap.setReturnHashInputData(true);
vaap.setSignatureDevice(Constants.SIGNATURE_DEVICE_MOA);
vaap.setVerificationTime(null);
- */
+ // try to validate all signatures (do not throw exceptions while validating single signatures)
+ // use result.isVerificationDone() in order to find out if a signatures was successfully verified
+ vaap.setSuppressVerifyExceptions(true);
+ */
+
// verification with intermediate step of reconstruction
VerifyAfterReconstructXMLDsigParameters varp = new VerifyAfterReconstructXMLDsigParameters();
varp.setReconstructXMLDsigResult(recstrResult);
varp.setReturnHashInputData(true);
- varp.setSignatureDevice(Constants.SIGNATURE_DEVICE_MOA);
+ // not needed since already set in recstrParams (the reconstruction step)
+ // varp.setSignatureDevice(Constants.SIGNATURE_DEVICE_MOA);
varp.setVerificationTime(null);
+ // try to validate all signatures (do not throw exceptions while validating single signatures)
+ // use result.isVerificationDone() in order to find out if a signatures was successfully verified
+ varp.setSuppressVerifyExceptions(true);
// invoke verification
System.out.println("Verifying...");
+
// without intermediate step of reconstruction
/*
VerifyResults verifyResults = pdfasAPI.verify(vaap);
*/
+
// with intermediate step of reconstruction
VerifyResults verifyResults = pdfasAPI.verify(varp);