diff options
author | Andreas Abraham <andreas.abraham@egiz.gv.at> | 2018-09-17 15:58:34 +0200 |
---|---|---|
committer | Andreas Abraham <andreas.abraham@egiz.gv.at> | 2018-09-17 15:58:34 +0200 |
commit | 6b9c41a422b93a0f98275cbe9c90b2773864b2ae (patch) | |
tree | aad175b2010408a0bcabb8a94130d3cbbed40f44 /bkucommon/src | |
parent | 57c8c593114afab458c61f64e0c3b8c9e5afb45a (diff) | |
download | mocca-6b9c41a422b93a0f98275cbe9c90b2773864b2ae.tar.gz mocca-6b9c41a422b93a0f98275cbe9c90b2773864b2ae.tar.bz2 mocca-6b9c41a422b93a0f98275cbe9c90b2773864b2ae.zip |
certstore converter integrated
Diffstat (limited to 'bkucommon/src')
-rw-r--r-- | bkucommon/src/main/java/at/gv/egiz/bku/spring/PKIProfileFactoryBean.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/spring/PKIProfileFactoryBean.java b/bkucommon/src/main/java/at/gv/egiz/bku/spring/PKIProfileFactoryBean.java index cdb9c24b..35a5c55a 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/spring/PKIProfileFactoryBean.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/spring/PKIProfileFactoryBean.java @@ -63,6 +63,7 @@ import org.springframework.core.io.ResourceLoader; import at.gv.egiz.bku.conf.IAIKLogAdapterFactory;
import at.gv.egiz.bku.conf.MoccaConfigurationFacade;
import at.gv.egiz.bku.utils.ConfigurationUtil;
+import iaik.pki.store.certstore.utils.DirectoryCertStoreConverter;
public class PKIProfileFactoryBean implements FactoryBean, ResourceLoaderAware {
@@ -206,9 +207,16 @@ public class PKIProfileFactoryBean implements FactoryBean, ResourceLoaderAware { "CS", certDirectory.getAbsolutePath(), true, false) };
DefaultPKIConfiguration pkiConfiguration = new DefaultPKIConfiguration(certStoreParameters);
+ if (url != null && url.toString().contains("file")) {
+ URL subjectdnUrl = new URL(url.toString() + "/subjectdn");
+ File subjectdn = resourceLoader.getResource(subjectdnUrl.toString()).getFile();
+ if (!subjectdn.exists() && !subjectdn.isDirectory()) {
+ log.info("Certificate Store is being converted");
+ DirectoryCertStoreConverter converter = new DirectoryCertStoreConverter();
+ converter.convert(certDirectory.getAbsolutePath(), certDirectory.getAbsolutePath(), true, true, null, null);
+ }
+ }
-
-// do it here
TransactionId tid = new TransactionIdImpl("Configure-PKI");
Configurator.initCommon(null, tid);
if (PKIFactory.getInstance().isAlreadyConfigured()) {
@@ -216,7 +224,7 @@ public class PKIProfileFactoryBean implements FactoryBean, ResourceLoaderAware { } else {
PKIFactory.getInstance().configure(pkiConfiguration, tid);
}
-
+
}
protected TrustStoreProfile createDirectoryTrustStoreProfile() throws MalformedURLException, IOException {
|