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