aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authortknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-12-07 09:46:55 +0000
committertknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2010-12-07 09:46:55 +0000
commitcded133a98ae8402ea56213fa0e3549222dfd3ec (patch)
tree4e62e3649bc0d6ef41f250df40592c8fc63ae032 /src/main/java
parent79777d04cf64aa06388bb2027f5e1001015471f3 (diff)
downloadpdf-as-3-cded133a98ae8402ea56213fa0e3549222dfd3ec.tar.gz
pdf-as-3-cded133a98ae8402ea56213fa0e3549222dfd3ec.tar.bz2
pdf-as-3-cded133a98ae8402ea56213fa0e3549222dfd3ec.zip
Updates in order to benefit from
at.gv.egiz.pdfas.api.verify.VerifyResult.isVerificationDone() at.gv.egiz.pdfas.api.verify.VerifyResult.getVerificationException() git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@691 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/gv/egiz/pdfas/commandline/Main.java41
-rw-r--r--src/main/java/demo/SignatureVerificationDemo.java9
2 files changed, 32 insertions, 18 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/commandline/Main.java b/src/main/java/at/gv/egiz/pdfas/commandline/Main.java
index 2dc551f..3595ef1 100644
--- a/src/main/java/at/gv/egiz/pdfas/commandline/Main.java
+++ b/src/main/java/at/gv/egiz/pdfas/commandline/Main.java
@@ -1247,24 +1247,29 @@ public abstract class Main
public static void formatVerifyResult(VerifyResult result, PrintWriter writer) throws SettingNotFoundException
{
- writer.println(" Zertifikat:");
- writer.println(" Signator: " + result.getSignerCertificate().getSubjectDN().toString());
- writer.println(" Aussteller: " + result.getSignerCertificate().getIssuerDN().toString());
- writer.println(" Seriennummer: " + result.getSignerCertificate().getSerialNumber());
- List public_properties = result.getPublicProperties();
- Iterator it = public_properties.iterator();
- while (it.hasNext())
- {
- String public_property = (String) it.next();
- writer.println(" Eigenschaft: " + public_property);
- }
-
- writer.println(" Zertifikat-Check:");
- writer.println(" " + result.getCertificateCheck().getCode() + " - " + result.getCertificateCheck().getMessage());
- writer.println(" Signatur-Check:");
- writer.println(" " + result.getValueCheckCode().getCode() + " - " + result.getValueCheckCode().getMessage());
- writer.println(" Manifest-Check:");
- writer.println(" " + result.getManifestCheckCode().getCode() + " - " + result.getManifestCheckCode().getMessage());
+ if (result.isVerificationDone()) {
+ writer.println(" Zertifikat:");
+ writer.println(" Signator: " + result.getSignerCertificate().getSubjectDN().toString());
+ writer.println(" Aussteller: " + result.getSignerCertificate().getIssuerDN().toString());
+ writer.println(" Seriennummer: " + result.getSignerCertificate().getSerialNumber());
+ List public_properties = result.getPublicProperties();
+ Iterator it = public_properties.iterator();
+ while (it.hasNext())
+ {
+ String public_property = (String) it.next();
+ writer.println(" Eigenschaft: " + public_property);
+ }
+
+ writer.println(" Zertifikat-Check:");
+ writer.println(" " + result.getCertificateCheck().getCode() + " - " + result.getCertificateCheck().getMessage());
+ writer.println(" Signatur-Check:");
+ writer.println(" " + result.getValueCheckCode().getCode() + " - " + result.getValueCheckCode().getMessage());
+ writer.println(" Manifest-Check:");
+ writer.println(" " + result.getManifestCheckCode().getCode() + " - " + result.getManifestCheckCode().getMessage());
+ } else {
+ PdfAsException ex = result.getVerificationException();
+ writer.println("\n Signaturprüfung für diese Signatur nicht möglich: " + ErrorCodeHelper.formErrorMessage(ex));
+ }
}
}
diff --git a/src/main/java/demo/SignatureVerificationDemo.java b/src/main/java/demo/SignatureVerificationDemo.java
index d794028..e89c394 100644
--- a/src/main/java/demo/SignatureVerificationDemo.java
+++ b/src/main/java/demo/SignatureVerificationDemo.java
@@ -20,6 +20,7 @@ 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.exceptions.ErrorCodeHelper;
import at.gv.egiz.pdfas.framework.config.SettingsHelper;
import at.gv.egiz.pdfas.framework.vfilter.VerificationFilterParameters;
import at.gv.egiz.pdfas.io.FileBasedDataSource;
@@ -120,6 +121,14 @@ public class SignatureVerificationDemo {
counter++;
VerifyResult result = (VerifyResult) it.next();
out.println("\n------------------------ SIGNATURE #" + counter + " ------------------------\n");
+
+ // check if signature verification of the current signature was successfully completed (independent from result)
+ if (!result.isVerificationDone()) {
+ PdfAsException ex = result.getVerificationException();
+ out.println(ErrorCodeHelper.formErrorMessage(ex));
+ continue;
+ }
+
Main.formatVerifyResult(result, out);
// check if there are timestamps