aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);