From 6b9c41a422b93a0f98275cbe9c90b2773864b2ae Mon Sep 17 00:00:00 2001 From: Andreas Abraham Date: Mon, 17 Sep 2018 15:58:34 +0200 Subject: certstore converter integrated --- .../java/at/gv/egiz/bku/spring/PKIProfileFactoryBean.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'bkucommon/src') 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 { -- cgit v1.2.3