From 04cd51a31e54cea00d53417ceb4d82fc068c4d75 Mon Sep 17 00:00:00 2001
From: Thomas Lenz <thomas.lenz@egiz.gv.at>
Date: Mon, 22 Jun 2020 09:01:10 +0200
Subject: rename test

---
 .../sl20/utils/JsonSecurityUtilsHsmKeyTest.java    | 75 ++++++++++++++++++++++
 1 file changed, 75 insertions(+)
 create mode 100644 eaaf_modules/eaaf_module_auth_sl20/src/test/java/at/gv/egiz/eaaf/modules/auth/sl20/utils/JsonSecurityUtilsHsmKeyTest.java

(limited to 'eaaf_modules/eaaf_module_auth_sl20/src/test/java/at')

diff --git a/eaaf_modules/eaaf_module_auth_sl20/src/test/java/at/gv/egiz/eaaf/modules/auth/sl20/utils/JsonSecurityUtilsHsmKeyTest.java b/eaaf_modules/eaaf_module_auth_sl20/src/test/java/at/gv/egiz/eaaf/modules/auth/sl20/utils/JsonSecurityUtilsHsmKeyTest.java
new file mode 100644
index 00000000..d9406b2d
--- /dev/null
+++ b/eaaf_modules/eaaf_module_auth_sl20/src/test/java/at/gv/egiz/eaaf/modules/auth/sl20/utils/JsonSecurityUtilsHsmKeyTest.java
@@ -0,0 +1,75 @@
+package at.gv.egiz.eaaf.modules.auth.sl20.utils;
+
+import java.security.KeyStore;
+import java.security.Provider;
+
+import org.apache.commons.lang3.StringUtils;
+import org.junit.runner.RunWith;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+import at.gv.egiz.eaaf.core.exceptions.EaafException;
+import at.gv.egiz.eaaf.core.impl.credential.KeyStoreConfiguration;
+import at.gv.egiz.eaaf.core.impl.credential.KeyStoreConfiguration.KeyStoreType;
+import at.gv.egiz.eaaf.core.impl.data.Pair;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration("/spring/test_eaaf_sl20_hsm.beans.xml")
+public class JsonSecurityUtilsHsmKeyTest extends AbstractJsonSecurityUtilsTest {
+
+  @Override
+  protected void setRsaSigningKey() {
+    config.putConfigValue("modules.sl20.security.sign.alias", "rsa-key-1");
+    
+  }
+
+  @Override
+  protected void setEcSigningKey() {
+    config.putConfigValue("modules.sl20.security.sign.alias", "ec-key-1");
+    
+  }
+
+  @Override
+  protected void setRsaEncryptionKey() {
+    config.putConfigValue("modules.sl20.security.encryption.alias", "rsa-key-1");
+    
+  }
+
+  @Override
+  protected void setEcEncryptionKey() {
+    config.putConfigValue("modules.sl20.security.encryption.alias", "ec-key-1");
+    
+  }
+
+  @Override
+  protected Pair<KeyStore, Provider> getEncryptionKeyStore() throws EaafException {    
+    KeyStoreConfiguration keyConfig = new KeyStoreConfiguration();
+    keyConfig.setFriendlyName("Junit Enc Key Rsa");
+    keyConfig.setKeyStoreType(KeyStoreType.HSMFACADE);
+    keyConfig.setKeyStoreName("eid-junit");
+    
+    return keyStoreFactory.buildNewKeyStore(keyConfig);
+  }
+
+  @Override
+  protected String getRsaKeyAlias() {
+    return "rsa-key-1";
+  }
+
+  @Override
+  protected String getRsaKeyPassword() {
+    return StringUtils.EMPTY;
+  }
+
+  @Override
+  protected String getEcKeyAlias() {
+    return "ec-key-1";
+  }
+
+  @Override
+  protected String getEcKeyPassword() {
+    return StringUtils.EMPTY;
+  }
+
+  
+}
-- 
cgit v1.2.3