diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/demo/SignatureVerificationDemo.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main/java/demo/SignatureVerificationDemo.java b/src/main/java/demo/SignatureVerificationDemo.java index 950472e..d794028 100644 --- a/src/main/java/demo/SignatureVerificationDemo.java +++ b/src/main/java/demo/SignatureVerificationDemo.java @@ -19,6 +19,7 @@ import at.gv.egiz.pdfas.api.verify.VerifyAfterAnalysisParameters; import at.gv.egiz.pdfas.api.verify.VerifyResult;
import at.gv.egiz.pdfas.api.verify.VerifyResults;
import at.gv.egiz.pdfas.commandline.Main;
+import at.gv.egiz.pdfas.exceptions.ErrorCode;
import at.gv.egiz.pdfas.framework.config.SettingsHelper;
import at.gv.egiz.pdfas.framework.vfilter.VerificationFilterParameters;
import at.gv.egiz.pdfas.io.FileBasedDataSource;
@@ -40,6 +41,8 @@ public class SignatureVerificationDemo { File configdir = new File("./work");
File signedFile = new File(args[0]);
+
+ AnalyzeResult analyzeResult = null;
try {
@@ -69,7 +72,7 @@ public class SignatureVerificationDemo { // analyze
System.out.println("Analyzing...");
- AnalyzeResult analyzeResult = pdfasAPI.analyze(analyzeParameters);
+ analyzeResult = pdfasAPI.analyze(analyzeParameters);
System.out.println("Successfully analyzed.");
// information on non-textual objects can be used after analysis step and/or after verification
@@ -141,7 +144,11 @@ public class SignatureVerificationDemo { out.flush();
} catch (PdfAsException e) {
- e.printStackTrace();
+ if (ErrorCode.DOCUMENT_NOT_SIGNED == e.getErrorCode() && analyzeResult != null && analyzeResult.hasBeenCorrected()) {
+ System.err.println("\nThe document could not been processed, maybe due to modification by third party tools. An attempt to correct the document was successful but no verifiable signatures could be found. This/these signature(s) - if any - might got lost.");
+ } else {
+ e.printStackTrace();
+ }
} catch (IOException e) {
e.printStackTrace();
}
|