aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2013-12-12 13:25:11 +0100
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2013-12-12 13:25:11 +0100
commit863f99753af19b3f5ce354d4d1ff0a5e8a4f32dd (patch)
tree6f70b194beba37ef22234d53b60532b5afbb5e90
parent311c4a0e2d26de7bb03bd0e85641d0fc1d4775bc (diff)
downloadpdf-as-4-863f99753af19b3f5ce354d4d1ff0a5e8a4f32dd.tar.gz
pdf-as-4-863f99753af19b3f5ce354d4d1ff0a5e8a4f32dd.tar.bz2
pdf-as-4-863f99753af19b3f5ce354d4d1ff0a5e8a4f32dd.zip
added configuration for verifer classes
-rw-r--r--pdf-as-lib/src/configuration/cfg/advancedconfig.properties5
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/verify/VerifierDispatcher.java26
2 files changed, 26 insertions, 5 deletions
diff --git a/pdf-as-lib/src/configuration/cfg/advancedconfig.properties b/pdf-as-lib/src/configuration/cfg/advancedconfig.properties
index c2fd1dfd..02ed4fbe 100644
--- a/pdf-as-lib/src/configuration/cfg/advancedconfig.properties
+++ b/pdf-as-lib/src/configuration/cfg/advancedconfig.properties
@@ -76,3 +76,8 @@
# Standard Alternativer Text fuer den Signaturblock (WAI) (globale Einstellung)
#default.sigLogoAltText=Abgebildet ist eine Standard-Signaturbildmarke.
+
+#register Verificators
+
+default.verifier.01=at.gv.egiz.pdfas.sigs.pkcs7detached.PKCS7DetachedVerifier
+default.verifier.02=at.gv.egiz.pdfas.sigs.pades.PAdESVerifier
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/verify/VerifierDispatcher.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/verify/VerifierDispatcher.java
index 9a830097..e0b57262 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/verify/VerifierDispatcher.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/verify/VerifierDispatcher.java
@@ -1,6 +1,5 @@
package at.gv.egiz.pdfas.lib.impl.verify;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -18,22 +17,39 @@ public class VerifierDispatcher {
private static final Logger logger = LoggerFactory
.getLogger(VerifierDispatcher.class);
- public static final String[] currentClasses = new String[] {
+ public static final String[] defaultClasses = new String[] {
"at.gv.egiz.pdfas.sigs.pkcs7detached.PKCS7DetachedVerifier",
- // Uncomment to verify via MOA conncetor
"at.gv.egiz.pdfas.sigs.pades.PAdESVerifier" };
+ public static final String CONF_VERIFIER = "default.verifier";
+
public Map<String, HashMap<String, IVerifyFilter>> filterMap = new HashMap<String, HashMap<String, IVerifyFilter>>();
public VerifierDispatcher(ISettings settings) {
- // TODO: read config build verify filter
+ // TODO: add configuration parameter to set verifier
+
+ Map<String, String> verifierClasses = settings
+ .getValuesPrefix(CONF_VERIFIER);
+ String[] currentClasses = null;
+ if (verifierClasses == null || verifierClasses.isEmpty()) {
+ logger.info("No verifier configured using default");
+ currentClasses = defaultClasses;
+ } else {
+ currentClasses = new String[verifierClasses.values().size()];
+ Iterator<String> classIt = verifierClasses.values().iterator();
+ int j = 0;
+ while (classIt.hasNext()) {
+ currentClasses[j] = classIt.next();
+ j++;
+ }
+ }
try {
for (int i = 0; i < currentClasses.length; i++) {
String clsName = currentClasses[i];
Class<? extends IVerifyFilter> cls = (Class<? extends IVerifyFilter>) Class
.forName(clsName);
IVerifyFilter filter = cls.newInstance();
- filter.setConfiguration((Configuration)settings);
+ filter.setConfiguration((Configuration) settings);
List<FilterEntry> entries = filter.getFiters();
Iterator<FilterEntry> it = entries.iterator();
while (it.hasNext()) {