aboutsummaryrefslogtreecommitdiff
path: root/moaSig/moa-sig-lib/src/main/java/at
diff options
context:
space:
mode:
authorThomas <>2022-09-27 16:27:04 +0200
committerThomas <>2022-09-27 16:27:04 +0200
commit2288715938cfd407883516f83dec941a645ea371 (patch)
tree8cff224928adba297b16071d4314a01b92a9e441 /moaSig/moa-sig-lib/src/main/java/at
parent0267ac70b63cbb4cbed7803f9cd577dcc8f54fa3 (diff)
downloadmoa-sig-2288715938cfd407883516f83dec941a645ea371.tar.gz
moa-sig-2288715938cfd407883516f83dec941a645ea371.tar.bz2
moa-sig-2288715938cfd407883516f83dec941a645ea371.zip
refact(iaik-pki): only configurate PKI commons if they are not set yet
Diffstat (limited to 'moaSig/moa-sig-lib/src/main/java/at')
-rw-r--r--moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfigurator.java38
1 files changed, 28 insertions, 10 deletions
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfigurator.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfigurator.java
index 3472419..c9a76f4 100644
--- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfigurator.java
+++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/IaikConfigurator.java
@@ -44,6 +44,7 @@ import at.gv.egovernment.moa.spss.util.SecProviderUtils;
import at.gv.egovernment.moaspss.logging.LogMsg;
import at.gv.egovernment.moaspss.logging.Logger;
import iaik.logging.LogFactory;
+import iaik.pki.PKIException;
import iaik.pki.store.revocation.RevocationFactory;
import iaik.pki.store.revocation.RevocationSourceStore;
import iaik.pki.store.truststore.TrustStoreFactory;
@@ -52,6 +53,7 @@ import iaik.server.Configurator;
import iaik.server.modules.keys.KeyEntryID;
import iaik.server.modules.keys.KeyModule;
import iaik.server.modules.keys.KeyModuleFactory;
+import iaik.util.logging.Log;
/**
* A class responsible for configuring the IAIK MOA modules.
@@ -89,16 +91,11 @@ public class IaikConfigurator {
LogFactory.configure(configData.getLoggerConfig());
- try {
- iaik.pki.Configurator.initCommon(configData.getLoggerConfig(),
- transId);
- // SecProviderUtils.dumpSecProviders("initCommon");
- final String certStoreRoot = moaConfig.getCertStoreLocation();
- CertStoreConverter.convert(certStoreRoot, transId);
- } finally {
- // Security.removeProvider(ECCelerate.getInstance().getName());
- }
-
+
+ // initialize PKI commons
+ initializePkiCommons(moaConfig, transId, configData);
+
+ // initialze IAIK MOA
Configurator.init(configData, transId);
SecProviderUtils.dumpSecProviders("Fully configured!");
@@ -125,6 +122,27 @@ public class IaikConfigurator {
}
}
+ private static void initializePkiCommons(ConfigurationProvider moaConfig, TransactionId transId, ConfigurationData configData) throws PKIException {
+ if (!iaik.pki.Configurator.isInitialized()) {
+ logger.info("Initializing IAIK PKI-Commons ... ");
+ try {
+ iaik.pki.Configurator.initCommon(configData.getLoggerConfig(),
+ transId);
+
+ final String certStoreRoot = moaConfig.getCertStoreLocation();
+ CertStoreConverter.convert(certStoreRoot, transId);
+
+ } finally {
+ // Security.removeProvider(ECCelerate.getInstance().getName());
+ }
+
+ } else {
+ logger.debug("IAIK PKI-Commons already initialized");
+
+ }
+
+ }
+
private static void logException(Throwable e) {
final StringWriter out = new StringWriter();
final PrintWriter writer = new PrintWriter(out);