summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2009-06-25 17:01:14 +0000
committerclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2009-06-25 17:01:14 +0000
commite75f30d8d51fa33fc778c31c1b0312cf10de8e45 (patch)
treeab5e46d09ef8b139781a3b754e245a0669750df3
parent69e0dbee3567fc3a710d7bffad4d03e64edd7daa (diff)
downloadmocca-e75f30d8d51fa33fc778c31c1b0312cf10de8e45.tar.gz
mocca-e75f30d8d51fa33fc778c31c1b0312cf10de8e45.tar.bz2
mocca-e75f30d8d51fa33fc778c31c1b0312cf10de8e45.zip
disable pinpad
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@376 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
-rw-r--r--BKULocal/src/main/webapp/WEB-INF/applicationContext.xml9
-rw-r--r--BKUOnline/src/main/webapp/WEB-INF/applicationContext.xml7
-rw-r--r--BKUOnline/src/main/webapp/WEB-INF/mocca-conf.xml39
-rw-r--r--BKUOnline/src/main/webapp/WEB-INF/web.xml2
-rw-r--r--BKUOnline/src/main/webapp/index.html2
-rw-r--r--BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/BKULauncher.java4
-rw-r--r--BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/conf/configuration.zipbin0 -> 25738 bytes
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/AbstractSignatureCard.java2
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/SWCard.java5
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/ccid/CCID.java2
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/ccid/DefaultReader.java8
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/ccid/ReaderFactory.java50
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/conf/SMCCConfiguration.java33
13 files changed, 149 insertions, 14 deletions
diff --git a/BKULocal/src/main/webapp/WEB-INF/applicationContext.xml b/BKULocal/src/main/webapp/WEB-INF/applicationContext.xml
index 2ddd46a1..b219fdd8 100644
--- a/BKULocal/src/main/webapp/WEB-INF/applicationContext.xml
+++ b/BKULocal/src/main/webapp/WEB-INF/applicationContext.xml
@@ -98,6 +98,11 @@
<property name="resource" value="file:${user.home}/.mocca/conf/defaultConf.properties"/>
<property name="certValidator" ref="certValidator"></property>
</bean>
-
-
+
+ <!-- Begin MOCCA Configuration [REFACTORED]
+ | Configuration beans (no conf properties file) should be injected directly to module configurators.
+ | Currently, only the ReaderFactory configuration is considered.
+ |-->
+ <import resource="file:${user.home}/.mocca/conf/mocca-conf.xml"/>
+
</beans> \ No newline at end of file
diff --git a/BKUOnline/src/main/webapp/WEB-INF/applicationContext.xml b/BKUOnline/src/main/webapp/WEB-INF/applicationContext.xml
index 6a234b73..5681fa89 100644
--- a/BKUOnline/src/main/webapp/WEB-INF/applicationContext.xml
+++ b/BKUOnline/src/main/webapp/WEB-INF/applicationContext.xml
@@ -103,4 +103,11 @@
<bean id="shutdown" class="at.gv.egiz.bku.online.webapp.ShutdownHandler">
<property name="bindingProcessorManager" ref="bindingProcessorManager"></property>
</bean>
+
+ <!-- Begin MOCCA Configuration [REFACTORED]
+ | Configuration beans (no conf properties file) should be injected directly to module configurators.
+ | Currently, only the ReaderFactory configuration is considered.
+ |-->
+ <import resource="mocca-conf.xml"/>
+
</beans> \ No newline at end of file
diff --git a/BKUOnline/src/main/webapp/WEB-INF/mocca-conf.xml b/BKUOnline/src/main/webapp/WEB-INF/mocca-conf.xml
new file mode 100644
index 00000000..54e08e9b
--- /dev/null
+++ b/BKUOnline/src/main/webapp/WEB-INF/mocca-conf.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2008 Federal Chancellery Austria and
+ Graz University of Technology
+
+ 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.
+-->
+
+<!--
+ | User configuration file. (defaultConf.properties is migrated to this file)
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
+
+ <!--
+ | ReaderFactory configuration not available in Applet
+ |
+ <bean id="smccConfiguration" class="at.gv.egiz.smcc.conf.SMCCConfiguration">
+ <property name="disablePinpad" value="true"/>
+ </bean>
+
+ <bean id="readerFactory" class="at.gv.egiz.smcc.ccid.ReaderFactory" factory-method="getInstance">
+ <property name="configuration" ref="smccConfiguration"/>
+ </bean>
+ |-->
+
+</beans>
diff --git a/BKUOnline/src/main/webapp/WEB-INF/web.xml b/BKUOnline/src/main/webapp/WEB-INF/web.xml
index a164a384..e41e2265 100644
--- a/BKUOnline/src/main/webapp/WEB-INF/web.xml
+++ b/BKUOnline/src/main/webapp/WEB-INF/web.xml
@@ -111,7 +111,7 @@
<!-- End STAL Config -->
<!-- Begin BKU Web Start Config
- | (activate 'include-webstart' profile)
+ | (activate 'include-webstart' profile)
<servlet>
<servlet-name>JnlpDownloadServlet</servlet-name>
<servlet-class>jnlp.sample.servlet.JnlpDownloadServlet</servlet-class>
diff --git a/BKUOnline/src/main/webapp/index.html b/BKUOnline/src/main/webapp/index.html
index e5180aa9..2ec41746 100644
--- a/BKUOnline/src/main/webapp/index.html
+++ b/BKUOnline/src/main/webapp/index.html
@@ -39,7 +39,7 @@
</div>
<!-- MOCCA Web Start
- | (activate 'include-webstart' profile)
+ | (activate 'include-webstart' profile)
<div id="animDiv" class="box">
<p>
<h1>MOCCA Web Start</h1>
diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/BKULauncher.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/BKULauncher.java
index 36c9cbb2..5e4ab634 100644
--- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/BKULauncher.java
+++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/BKULauncher.java
@@ -56,8 +56,8 @@ public class BKULauncher implements BKUControllerInterface {
/** configurations with less than this (major) version will be backuped and updated */
public static final String MIN_CONFIG_VERSION = "1.0.3";
public static final String CONFIG_DIR = ".mocca/conf/";
- public static final String CONF_TEMPLATE_FILE = "template.zip";
- public static final String CONF_TEMPLATE_RESOURCE = "at/gv/egiz/bku/webstart/conf/template.zip";
+ public static final String CONF_TEMPLATE_FILE = "configuration.zip";
+ public static final String CONF_TEMPLATE_RESOURCE = "at/gv/egiz/bku/webstart/conf/configuration.zip";
public static final String WEBAPP_RESOURCE = "BKULocal.war";
public static final String WEBAPP_FILE = "BKULocal.war";
public static final String KEYSTORE_FILE = "keystore.ks";
diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/conf/configuration.zip b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/conf/configuration.zip
new file mode 100644
index 00000000..74465445
--- /dev/null
+++ b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/conf/configuration.zip
Binary files differ
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/AbstractSignatureCard.java b/smcc/src/main/java/at/gv/egiz/smcc/AbstractSignatureCard.java
index 7dd3ee78..f0f8b8c8 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/AbstractSignatureCard.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/AbstractSignatureCard.java
@@ -455,7 +455,7 @@ public abstract class AbstractSignatureCard implements SignatureCard {
@Override
public void init(Card card, CardTerminal cardTerminal) {
this.card_ = card;
- this.reader = ReaderFactory.getReader(card, cardTerminal);
+ this.reader = ReaderFactory.getInstance().getReader(card, cardTerminal);
ATR atr = card.getATR();
byte[] atrBytes = atr.getBytes();
if (atrBytes.length >= 6) {
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/SWCard.java b/smcc/src/main/java/at/gv/egiz/smcc/SWCard.java
index 2ed1fe64..da084e0d 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/SWCard.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/SWCard.java
@@ -483,6 +483,11 @@ public class SWCard implements SignatureCard {
public byte[] modifyPinDirect(byte[] PIN_MODIFY) throws CardException {
throw new UnsupportedOperationException("Not supported yet.");
}
+
+ @Override
+ public void setDisablePinpad(boolean disable) {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
};
}
}
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/ccid/CCID.java b/smcc/src/main/java/at/gv/egiz/smcc/ccid/CCID.java
index 56ebaffe..2972f3b8 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/ccid/CCID.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/ccid/CCID.java
@@ -62,6 +62,8 @@ public interface CCID {
Card connect() throws CardException;
+ void setDisablePinpad(boolean disable);
+
boolean hasFeature(Byte feature);
/**
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/ccid/DefaultReader.java b/smcc/src/main/java/at/gv/egiz/smcc/ccid/DefaultReader.java
index 0de6bb17..580b9379 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/ccid/DefaultReader.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/ccid/DefaultReader.java
@@ -55,6 +55,7 @@ public class DefaultReader implements CCID {
protected Card icc;
protected CardTerminal ct;
+ protected boolean disablePinpad = false;
/**
* supported features and respective control codes
@@ -78,6 +79,11 @@ public class DefaultReader implements CCID {
log.debug("setting max pin length: " + getwPINMaxExtraDigitL());
}
+ @Override
+ public void setDisablePinpad(boolean disable) {
+ disablePinpad = disable;
+ }
+
/**
*
* @return the card terminals name
@@ -137,7 +143,7 @@ public class DefaultReader implements CCID {
@Override
public boolean hasFeature(Byte feature) {
- if (features != null) {
+ if (features != null && !disablePinpad) {
return features.containsKey(feature);
}
return false;
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/ccid/ReaderFactory.java b/smcc/src/main/java/at/gv/egiz/smcc/ccid/ReaderFactory.java
index ae21e5e0..5b94de05 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/ccid/ReaderFactory.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/ccid/ReaderFactory.java
@@ -17,8 +17,11 @@
package at.gv.egiz.smcc.ccid;
+import at.gv.egiz.smcc.conf.SMCCConfiguration;
import javax.smartcardio.Card;
import javax.smartcardio.CardTerminal;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
*
@@ -26,9 +29,33 @@ import javax.smartcardio.CardTerminal;
*/
public class ReaderFactory {
- public static CCID getReader(Card icc, CardTerminal ct) {
+ protected final static Log log = LogFactory.getLog(ReaderFactory.class);
+
+ protected SMCCConfiguration configuration;
+ private static ReaderFactory instance;
+
+ private ReaderFactory() {
+ }
+
+ public static ReaderFactory getInstance() {
+ if (instance == null) {
+ instance = new ReaderFactory();
+ }
+ return instance;
+ }
+
+ /**
+ * @param configuration the configuration to set
+ */
+ public void setConfiguration(SMCCConfiguration configuration) {
+ this.configuration = configuration;
+ }
+
+ public CCID getReader(Card icc, CardTerminal ct) {
+ CCID reader;
String name = ct.getName();
if (name != null) {
+ log.info("creating reader " + name);
name = name.toLowerCase();
//ReinerSCT: http://support.reiner-sct.de/downloads/LINUX
// http://www.linux-club.de/viewtopic.php?f=61&t=101287&start=0
@@ -36,15 +63,26 @@ public class ReaderFactory {
//new (CCID): 0C4B/0300 Reiner-SCT cyberJack pinpad(a) 00 00
//display: REINER SCT CyberJack 00 00
if(name.startsWith("gemplus gempc pinpad")) {
- return new GemplusGemPCPinpad(icc, ct);
+ reader = new GemplusGemPCPinpad(icc, ct);
} else if (name.startsWith("omnikey cardman 3621")) {
- return new OMNIKEYCardMan3621(icc, ct);
+ reader = new OMNIKEYCardMan3621(icc, ct);
} else if (name.startsWith("scm microsystems inc. sprx32 usb smart card reader")) {
- return new SCMMicrosystemsSPRx32(icc, ct);
+ reader = new SCMMicrosystemsSPRx32(icc, ct);
} else if (name.startsWith("cherry smartboard xx44")) {
- return new CherrySmartBoardXX44(icc, ct);
+ reader = new CherrySmartBoardXX44(icc, ct);
+ } else {
+ log.info("no suitable implementation found, using default");
+ reader = new DefaultReader(icc, ct);
}
+ } else {
+ reader = new DefaultReader(icc, ct);
+ }
+
+ if (configuration != null) {
+ String disablePinpad = configuration.getProperty(SMCCConfiguration.DISABLE_PINPAD_P);
+ log.debug("setting disablePinpad to " + Boolean.parseBoolean(disablePinpad));
+ reader.setDisablePinpad(Boolean.parseBoolean(disablePinpad));
}
- return new DefaultReader(icc, ct);
+ return reader;
}
}
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/conf/SMCCConfiguration.java b/smcc/src/main/java/at/gv/egiz/smcc/conf/SMCCConfiguration.java
new file mode 100644
index 00000000..8ea49ca6
--- /dev/null
+++ b/smcc/src/main/java/at/gv/egiz/smcc/conf/SMCCConfiguration.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2008 Federal Chancellery Austria and
+ * Graz University of Technology
+ *
+ * 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.egiz.smcc.conf;
+
+import java.util.Properties;
+
+/**
+ *
+ * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at>
+ */
+public class SMCCConfiguration extends Properties {
+
+ public static final String DISABLE_PINPAD_P = "disable.pinpad";
+
+ public void setDisablePinpad(String value) {
+ this.setProperty(DISABLE_PINPAD_P, value);
+ }
+}