aboutsummaryrefslogtreecommitdiff
path: root/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/SoftwareKeyModuleConfigurationImpl.java
diff options
context:
space:
mode:
Diffstat (limited to 'spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/SoftwareKeyModuleConfigurationImpl.java')
-rw-r--r--spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/SoftwareKeyModuleConfigurationImpl.java90
1 files changed, 90 insertions, 0 deletions
diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/SoftwareKeyModuleConfigurationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/SoftwareKeyModuleConfigurationImpl.java
new file mode 100644
index 000000000..1b8d85538
--- /dev/null
+++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/SoftwareKeyModuleConfigurationImpl.java
@@ -0,0 +1,90 @@
+/*
+* Copyright 2003 Federal Chancellery Austria
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package at.gv.egovernment.moa.spss.server.iaik.config;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+
+import iaik.server.modules.keys.ConfigurationException;
+import iaik.server.modules.keys.SoftwareKeyModuleConfiguration;
+
+import at.gv.egovernment.moa.logging.LogMsg;
+import at.gv.egovernment.moa.logging.Logger;
+
+import at.gv.egovernment.moa.spss.server.config.SoftwareKeyModule;
+import at.gv.egovernment.moa.spss.util.MessageProvider;
+
+/**
+ * An implementation of the <code>SoftwareKeyModuleConfiguration</code> wrapping
+ * a <code>SoftwareKeyModule</code> from the MOA configuration.
+ *
+ * @see iaik.server.modules.keys.SoftwareKeyModuleConfiguration
+ * @author Patrick Peck
+ * @version $Id$
+ */
+public class SoftwareKeyModuleConfigurationImpl
+ extends AbstractKeyModuleConfigurationImpl
+ implements SoftwareKeyModuleConfiguration {
+
+ /** The wrapped <code>SoftwareKeyModule</code>. */
+ private SoftwareKeyModule keyModule;
+
+ /**
+ * Create a new <code>SoftwareKeyModuleConfigurationImpl</code>.
+ *
+ * @param keyModule The <code>SoftwareKeyModule</code> from the underlying MOA
+ * configuration.
+ */
+ public SoftwareKeyModuleConfigurationImpl(SoftwareKeyModule keyModule) {
+ super(keyModule.getId());
+ this.keyModule = keyModule;
+ }
+
+ /**
+ * @see iaik.server.modules.keys.SoftwareKeyModuleConfiguration#getKeyStoreTypeName()
+ */
+ public String getKeyStoreTypeName() {
+ return KEY_STORE_TYPE_NAME_PKCS12;
+ }
+
+ /**
+ * @see iaik.server.modules.keys.SoftwareKeyModuleConfiguration#getKeyStoreAsStream()
+ */
+ public InputStream getKeyStoreAsStream() {
+ MessageProvider msg = MessageProvider.getInstance();
+
+ try {
+ String message =
+ msg.getMessage("config.18", new Object[] { keyModule.getFileName()});
+ Logger.info(new LogMsg(message));
+ return new FileInputStream(keyModule.getFileName());
+ } catch (FileNotFoundException e) {
+ String message =
+ msg.getMessage("config.09", new Object[] { keyModule.getFileName()});
+
+ throw new ConfigurationException(message, e, null);
+ }
+ }
+
+ /**
+ * @see iaik.server.modules.keys.SoftwareKeyModuleConfiguration#getKeyStoreAuthenticationData()
+ */
+ public char[] getKeyStoreAuthenticationData() {
+ return keyModule.getPassWord().toCharArray();
+ }
+
+}