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 --- .../gv/egiz/bku/spring/PKIProfileFactoryBean.java | 14 +++++++-- .../main/java/at/gv/egiz/updater/Constants.java | 22 ++++++++++++++ .../main/java/at/gv/egiz/updater/MoccaUpdater.java | 34 ++++++++++++++++++---- .../java/at/gv/egiz/updater/NewVersionDialog.java | 23 ++++++++++++++- 4 files changed, 83 insertions(+), 10 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 { diff --git a/utils/src/main/java/at/gv/egiz/updater/Constants.java b/utils/src/main/java/at/gv/egiz/updater/Constants.java index e836bae7..89a75ee0 100644 --- a/utils/src/main/java/at/gv/egiz/updater/Constants.java +++ b/utils/src/main/java/at/gv/egiz/updater/Constants.java @@ -1,3 +1,25 @@ +/* + * Copyright 2018 by Graz University of Technology, Austria + * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint + * initiative of the Federal Chancellery Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ package at.gv.egiz.updater; public class Constants { diff --git a/utils/src/main/java/at/gv/egiz/updater/MoccaUpdater.java b/utils/src/main/java/at/gv/egiz/updater/MoccaUpdater.java index 1e1bc6c6..ad8f8d84 100644 --- a/utils/src/main/java/at/gv/egiz/updater/MoccaUpdater.java +++ b/utils/src/main/java/at/gv/egiz/updater/MoccaUpdater.java @@ -1,3 +1,25 @@ +/* + * Copyright 2018 by Graz University of Technology, Austria + * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint + * initiative of the Federal Chancellery Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ package at.gv.egiz.updater; import java.io.BufferedReader; @@ -43,10 +65,10 @@ public class MoccaUpdater { public void run() { -// if (getMoccaVersionLocal().toLowerCase().equals("unknown")) { -// // we are finished here -// return; -// } + if (getMoccaVersionLocal().toLowerCase().equals("unknown")) { + // we are finished here + return; + } gatherOnlineMoccaVersion(); boolean isOnlineNewer = isOnlineVersionNewer(); @@ -96,11 +118,11 @@ public class MoccaUpdater { } + public static void main(String[] args) { - + // only for testing purposes MoccaUpdater updater = new MoccaUpdater("1.2.3"); updater.run(); - } diff --git a/utils/src/main/java/at/gv/egiz/updater/NewVersionDialog.java b/utils/src/main/java/at/gv/egiz/updater/NewVersionDialog.java index 99ff6907..02b80fa7 100644 --- a/utils/src/main/java/at/gv/egiz/updater/NewVersionDialog.java +++ b/utils/src/main/java/at/gv/egiz/updater/NewVersionDialog.java @@ -1,3 +1,25 @@ +/* + * Copyright 2018 by Graz University of Technology, Austria + * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint + * initiative of the Federal Chancellery Austria and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ package at.gv.egiz.updater; import java.awt.BorderLayout; @@ -22,7 +44,6 @@ import java.awt.image.BufferedImage; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; -import java.net.URLClassLoader; import java.text.MessageFormat; import java.util.Locale; import java.util.ResourceBundle; -- cgit v1.2.3