aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-05-14 11:35:43 +0200
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-05-14 11:35:43 +0200
commit87cd5e8be869b19e6b37dbb13056882efff976a0 (patch)
tree4941cc941b9a791037869967b47df6fa56effe30
parent1d5e1f5f429d225e14f4ce9e6e82a403eac10b6b (diff)
downloadpdf-as-4-87cd5e8be869b19e6b37dbb13056882efff976a0.tar.gz
pdf-as-4-87cd5e8be869b19e6b37dbb13056882efff976a0.tar.bz2
pdf-as-4-87cd5e8be869b19e6b37dbb13056882efff976a0.zip
Added Verification Messages
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/messages/CodesResolver.java44
-rw-r--r--pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/TempFileHelper.java8
-rw-r--r--pdf-as-common/src/main/resources/resources/messages/verify.properties10
-rw-r--r--pdf-as-common/src/main/resources/resources/messages/verify_de.properties10
4 files changed, 70 insertions, 2 deletions
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/messages/CodesResolver.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/messages/CodesResolver.java
new file mode 100644
index 00000000..f98e8d07
--- /dev/null
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/messages/CodesResolver.java
@@ -0,0 +1,44 @@
+package at.gv.egiz.pdfas.common.messages;
+
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class CodesResolver {
+ private static final String messageResource = "resources.messages.verify";
+ private static final String missingMsg = "Unknown ";
+
+ private static final Logger logger = LoggerFactory.getLogger(MessageResolver.class);
+
+ private static ResourceBundle bundle;
+
+ static {
+ bundle = ResourceBundle.getBundle(messageResource);
+ if(bundle == null) {
+ logger.error("Failed to load resource bundle!!");
+ System.err.println("Failed to load resource bundle!!");
+ //Runtime.getRuntime().exit(-1);
+ }
+ }
+
+ public static void forceLocale(Locale locale) {
+ bundle = ResourceBundle.getBundle(messageResource, locale);
+ }
+
+ public static String resolveMessage(String msgId) {
+ if(bundle == null) {
+ return missingMsg + msgId;
+ }
+ if(bundle.containsKey(msgId)) {
+ String value = bundle.getString(msgId);
+ if(value == null) {
+ return missingMsg + msgId;
+ }
+ return value;
+ }
+ return missingMsg + msgId;
+ }
+
+}
diff --git a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/TempFileHelper.java b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/TempFileHelper.java
index 3a9284cc..0a1c0c1a 100644
--- a/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/TempFileHelper.java
+++ b/pdf-as-common/src/main/java/at/gv/egiz/pdfas/common/utils/TempFileHelper.java
@@ -70,7 +70,7 @@ public class TempFileHelper implements IProfileConstants {
needsDeletion = true;
}
- logger.info("TempDirHelper for TempDirectory: " + tmpDir);
+ logger.debug("TempDirHelper for TempDirectory: " + tmpDir);
createTmpDir();
}
@@ -81,6 +81,10 @@ public class TempFileHelper implements IProfileConstants {
super.finalize();
}
+ public void clear() {
+ this.deleteTmpDir();
+ }
+
private void deleteTmpDir() {
try {
File tmpdir = new File(tmpDir);
@@ -133,7 +137,7 @@ public class TempFileHelper implements IProfileConstants {
String uuidString = UUID.randomUUID().toString();
logger.debug("Generated UUID " + uuidString);
String tmpFilename = tmpDir + getHashedHexString(uuidString) + tmpFileSuffix;
- logger.info("Temporary filename " + tmpFilename);
+ logger.debug("Temporary filename " + tmpFilename);
tmpFiles.add(tmpFilename);
return tmpFilename;
}
diff --git a/pdf-as-common/src/main/resources/resources/messages/verify.properties b/pdf-as-common/src/main/resources/resources/messages/verify.properties
new file mode 100644
index 00000000..bea0cf4f
--- /dev/null
+++ b/pdf-as-common/src/main/resources/resources/messages/verify.properties
@@ -0,0 +1,10 @@
+verify.value.0=The value of the signature has been verified successfully.
+verify.value.1=An error has occurred while verifying the value of the signature.
+
+verify.cert.0=It was possible to construct a formally correct certificate chain from the signatory certificate to a trustworthy root certificate. Each certificate in this chain is valid at the check time specified in the request.
+verify.cert.1=It was not possible to construct a formally correct certificate chain from the signatory certificate to a trustworthy root certificate.
+verify.cert.2=It was possible to construct a formally correct certificate chain from the signatory certificate to a trustworthy root certificate. The check time for at least one certificate in this chain is outside the period of validity.
+verify.cert.3=It was possible to construct a formally correct certificate chain from the signatory certificate to a trustworthy root certificate. The check time for all certificates in this chain is within the validity period. It was not possible to determine the certificate status for at least one certificate.
+verify.cert.4=It was possible to construct a formally correct certificate chain from the signatory certificate to a trustworthy root certificate. The check time for all certificates in this chain is within the validity period. At least one certificate is revoked at the check time.
+verify.cert.5=It was possible to construct a formally correct certificate chain from the signatory certificate to a trustworthy root certificate. The check time for all certificates in this chain is within the validity period. None of the certificates in this chain is revoked at the check time. At least one certificate is disabled at the check time.
+verify.cert.99=The signature verification data has not been checked as an error has occurred while checking the validity of the signature. \ No newline at end of file
diff --git a/pdf-as-common/src/main/resources/resources/messages/verify_de.properties b/pdf-as-common/src/main/resources/resources/messages/verify_de.properties
new file mode 100644
index 00000000..cf739863
--- /dev/null
+++ b/pdf-as-common/src/main/resources/resources/messages/verify_de.properties
@@ -0,0 +1,10 @@
+verify.value.0=Die Überprüfung des Werts der Signatur konnte erfolgreich durchgeführt werden.
+verify.value.1=Bei der Überprüfung des Werts der Signatur ist ein Fehler aufgetreten.
+
+verify.cert.0=Eine formal korrekte Zertifikatskette vom Signatorzertifikat zu einem vertrauenswürdigen Wurzelzertifikat konnte konstruiert werden. Jedes Zertifikat dieser Kette ist zum in der Anfrage angegebenen Prüfzeitpunkt gültig.
+verify.cert.1=Es konnte keine formal korrekte Zertifikatskette vom Signatorzertifikat zu einem vertrauenswürdigen Wurzelzertifikat konstruiert werden.
+verify.cert.2=Eine formal korrekte Zertifikatskette vom Signatorzertifikat zu einem vertrauenswürdigen Wurzelzertifikat konnte konstruiert werden. Für zumindest ein Zertifikat dieser Kette fällt der Prüfzeitpunkt nicht in das Gültigkeitsintervall.
+verify.cert.3=Eine formal korrekte Zertifikatskette vom Signatorzertifikat zu einem vertrauenswürdigen Wurzelzertifikat konnte konstruiert werden. Für alle Zertifikate dieser Kette fällt der Prüfzeitpunkt in das jeweilige Gültigkeitsintervall. Für zumindest ein Zertifikat konnte der Zertifikatstatus nicht festgestellt werden.
+verify.cert.4=Eine formal korrekte Zertifikatskette vom Signatorzertifikat zu einem vertrauenswürdigen Wurzelzertifikat konnte konstruiert werden. Für alle Zertifikate dieser Kette fällt der Prüfzeitpunkt in das jeweilige Gültigkeitsintervall. Zumindest ein Zertifikat ist zum Prüfzeitpunkt widerrufen.
+verify.cert.5=Eine formal korrekte Zertifikatskette vom Signatorzertifikat zu einem vertrauenswürdigen Wurzelzertifikat konnte konstruiert werden. Für alle Zertifikate dieser Kette fällt der Prüfzeitpunkt in das jeweilige Gültigkeitsintervall. Kein Zertifikat dieser Kette ist zum Prüfzeitpunkt widerrufen. Zumindest ein Zertifikat ist zum Prüfzeitpunkt gesperrt.
+verify.cert.99=Die Prüfung der Signaturprüfdaten wurde nicht durchgeführt, da bei der Prüfung der Gültigkeit der Signatur ein Fehler aufgetreten ist. \ No newline at end of file