aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib
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 /pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib
parent311c4a0e2d26de7bb03bd0e85641d0fc1d4775bc (diff)
downloadpdf-as-4-863f99753af19b3f5ce354d4d1ff0a5e8a4f32dd.tar.gz
pdf-as-4-863f99753af19b3f5ce354d4d1ff0a5e8a4f32dd.tar.bz2
pdf-as-4-863f99753af19b3f5ce354d4d1ff0a5e8a4f32dd.zip
added configuration for verifer classes
Diffstat (limited to 'pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib')
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/verify/VerifierDispatcher.java26
1 files changed, 21 insertions, 5 deletions
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()) {