summaryrefslogtreecommitdiff
path: root/eaaf_core_utils/src/test/java
diff options
context:
space:
mode:
authorThomas Lenz <thomas.lenz@egiz.gv.at>2020-06-19 10:28:58 +0200
committerThomas Lenz <thomas.lenz@egiz.gv.at>2020-06-19 10:28:58 +0200
commitadc58a6ecb2d3d5bb0dc17f0e4a7a0e7803ebbb1 (patch)
treec7f028252561f619db62f7b588194694f0166b45 /eaaf_core_utils/src/test/java
parent0d52fe861a46f8ba595bdd34b106c98096c4304b (diff)
downloadEAAF-Components-adc58a6ecb2d3d5bb0dc17f0e4a7a0e7803ebbb1.tar.gz
EAAF-Components-adc58a6ecb2d3d5bb0dc17f0e4a7a0e7803ebbb1.tar.bz2
EAAF-Components-adc58a6ecb2d3d5bb0dc17f0e4a7a0e7803ebbb1.zip
activates HSM-Facade, if HSM-Facade-Provider is an already loaded Java Security-Provider
Diffstat (limited to 'eaaf_core_utils/src/test/java')
-rw-r--r--eaaf_core_utils/src/test/java/at/gv/egiz/eaaf/core/test/credentials/EaafKeyStoreFactoryTest.java24
1 files changed, 23 insertions, 1 deletions
diff --git a/eaaf_core_utils/src/test/java/at/gv/egiz/eaaf/core/test/credentials/EaafKeyStoreFactoryTest.java b/eaaf_core_utils/src/test/java/at/gv/egiz/eaaf/core/test/credentials/EaafKeyStoreFactoryTest.java
index fc945fdd..6a24f6b4 100644
--- a/eaaf_core_utils/src/test/java/at/gv/egiz/eaaf/core/test/credentials/EaafKeyStoreFactoryTest.java
+++ b/eaaf_core_utils/src/test/java/at/gv/egiz/eaaf/core/test/credentials/EaafKeyStoreFactoryTest.java
@@ -4,6 +4,7 @@ import java.security.Key;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.Provider;
+import java.security.Security;
import java.security.cert.X509Certificate;
import java.util.List;
@@ -27,6 +28,7 @@ import com.google.common.base.Predicates;
import com.google.common.base.Throwables;
import com.google.common.collect.FluentIterable;
+import at.asitplus.hsmfacade.provider.HsmFacadeProvider;
import at.gv.egiz.eaaf.core.exception.EaafKeyAccessException;
import at.gv.egiz.eaaf.core.exceptions.EaafConfigurationException;
import at.gv.egiz.eaaf.core.exceptions.EaafException;
@@ -73,7 +75,8 @@ public class EaafKeyStoreFactoryTest {
@Before
public void testSetup() {
mapConfig.clearAllConfig();
-
+ Security.removeProvider(HsmFacadeProvider.getInstance().getName());
+
}
@Test
@@ -434,6 +437,14 @@ public class EaafKeyStoreFactoryTest {
Assert.assertNull("Provider is not null", key.getSecond());
}
+
+ @Test
+ @DirtiesContext
+ public void hsmFacadeNoHostConfig() {
+ context.getBean(EaafKeyStoreFactory.class);
+
+ }
+
@Test
@DirtiesContext
@@ -600,6 +611,17 @@ public class EaafKeyStoreFactoryTest {
@Test
@DirtiesContext
+ public void hsmFacadeAlreadLoaded() {
+ HsmFacadeProvider provider = HsmFacadeProvider.getInstance();
+ Security.addProvider(provider);
+
+ final EaafKeyStoreFactory keyStoreFactory = context.getBean(EaafKeyStoreFactory.class);
+ Assert.assertTrue("HSM Facade state wrong", keyStoreFactory.isHsmFacadeInitialized());
+
+ }
+
+ @Test
+ @DirtiesContext
public void hsmFacadeKeyStoreNoKeyStoreName() {
configureHsmFacade();