From 3b7eb43b0df868e492ccd7ad2daca5e4c0053bb2 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Mon, 17 Feb 2020 11:33:09 +0100 Subject: update jUnit tests to operate on HSM Facade from A-Sit+ --- .../impl/credential/KeyStoreConfiguration.java | 25 +++++++++++----------- 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'eaaf_core_utils/src/main/java/at') diff --git a/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/credential/KeyStoreConfiguration.java b/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/credential/KeyStoreConfiguration.java index 6dbbba3e..970efd22 100644 --- a/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/credential/KeyStoreConfiguration.java +++ b/eaaf_core_utils/src/main/java/at/gv/egiz/eaaf/core/impl/credential/KeyStoreConfiguration.java @@ -4,9 +4,10 @@ import java.util.Map; import javax.annotation.Nonnull; +import at.gv.egiz.eaaf.core.exceptions.EaafConfigurationException; + import org.apache.commons.lang3.StringUtils; -import at.gv.egiz.eaaf.core.exceptions.EaafConfigurationException; import lombok.Getter; import lombok.Setter; import lombok.extern.slf4j.Slf4j; @@ -139,7 +140,7 @@ public class KeyStoreConfiguration { /** * Validate the internal state of this configuration object. - * + * * @throws EaafConfigurationException In case of a configuration error */ public void validate() throws EaafConfigurationException { @@ -147,7 +148,7 @@ public class KeyStoreConfiguration { log.trace("Validate HSM-Facade KeyStore ... "); checkConfigurationValue(keyStoreName, EaafKeyStoreFactory.ERRORCODE_07, friendlyName, "Missing 'KeyName' for HSM-Facade"); - + } else if (KeyStoreType.PKCS12.equals(keyStoreType) || KeyStoreType.JKS.equals(keyStoreType)) { log.trace("Validate software KeyStore ... "); @@ -155,13 +156,13 @@ public class KeyStoreConfiguration { friendlyName, "Missing 'KeyPath' for software keystore"); checkConfigurationValue(softKeyStorePassword, EaafKeyStoreFactory.ERRORCODE_07, friendlyName, "Missing 'KeyPassword' for software keystore"); - + } else { log.info("Validation of type: {} not supported yet", keyStoreType); - + } } - + public enum KeyStoreType { PKCS12("pkcs12"), JKS("jks"), HSMFACADE("hsmfacade"), PKCS11("pkcs11"); @@ -209,16 +210,16 @@ public class KeyStoreConfiguration { final String configValue = config.get(configParamKey); checkConfigurationValue(configValue, EaafKeyStoreFactory.ERRORCODE_04, configParamKey); return configValue; - + } - private static void checkConfigurationValue(String configValue, String errorCode, String... params) + private static void checkConfigurationValue(String configValue, String errorCode, String... params) throws EaafConfigurationException { if (StringUtils.isEmpty(configValue)) { - throw new EaafConfigurationException(errorCode, - new Object[] { params}); - + throw new EaafConfigurationException(errorCode, + params); + } - + } } -- cgit v1.2.3