summaryrefslogtreecommitdiff
path: root/BKUAppletExt/src/main/java/at/gv
diff options
context:
space:
mode:
authorclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2009-04-02 19:13:48 +0000
committerclemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2009-04-02 19:13:48 +0000
commit2dbf2347bc78fd835c857ad438514fb6251f6f7a (patch)
treeec8eb7876dfdca86eeeec1d08ebbeb31eb464892 /BKUAppletExt/src/main/java/at/gv
parent1ad095128a98137e2b4c904814722be4ec43eebd (diff)
downloadmocca-2dbf2347bc78fd835c857ad438514fb6251f6f7a.tar.gz
mocca-2dbf2347bc78fd835c857ad438514fb6251f6f7a.tar.bz2
mocca-2dbf2347bc78fd835c857ad438514fb6251f6f7a.zip
1.1-RC7 (pinpad revisited)
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@325 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'BKUAppletExt/src/main/java/at/gv')
-rw-r--r--BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUIFacade.java3
-rw-r--r--BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/ManagementPINProviderFactory.java230
-rw-r--r--BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PINManagementRequestHandler.java43
-rw-r--r--BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PinpadPINProviderFactory.java133
-rw-r--r--BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/SoftwarePINProviderFactory.java148
5 files changed, 253 insertions, 304 deletions
diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUIFacade.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUIFacade.java
index f0cc0a27..848cd17f 100644
--- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUIFacade.java
+++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUIFacade.java
@@ -62,6 +62,9 @@ public interface PINManagementGUIFacade extends BKUGUIFacade {
public static final String ERR_RETRIES = "err.retries";
public static final String ERR_LOCKED = "err.locked";
public static final String ERR_NOT_ACTIVE = "err.not.active";
+ public static final String ERR_PIN_FORMAT = "err.pin.format";
+ public static final String ERR_PIN_CONFIRMATION = "err.pin.confirmation";
+ public static final String ERR_PIN_OPERATION_ABORTED = "err.pin.operation.aborted";
public static final String BUTTON_ACTIVATE = "button.activate";
public static final String BUTTON_UNBLOCK = "button.unblock";
diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/ManagementPINProviderFactory.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/ManagementPINProviderFactory.java
index d635b8df..090caf50 100644
--- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/ManagementPINProviderFactory.java
+++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/ManagementPINProviderFactory.java
@@ -17,38 +17,242 @@
package at.gv.egiz.bku.smccstal.ext;
+import at.gv.egiz.bku.gui.BKUGUIFacade;
import at.gv.egiz.smcc.ChangePINProvider;
import at.gv.egiz.bku.gui.PINManagementGUIFacade;
+import at.gv.egiz.bku.smccstal.AbstractPINProvider;
+import at.gv.egiz.bku.smccstal.PINProviderFactory;
+import at.gv.egiz.smcc.CancelledException;
import at.gv.egiz.smcc.ccid.CCID;
import at.gv.egiz.smcc.PINProvider;
+import at.gv.egiz.smcc.PINSpec;
import at.gv.egiz.smcc.SignatureCard;
/**
*
* @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at>
*/
-public abstract class ManagementPINProviderFactory {
-// extends at.gv.egiz.bku.smccstal.PINProviderFactory {
+public class ManagementPINProviderFactory extends PINProviderFactory {
- PINManagementGUIFacade gui;
+ public ManagementPINProviderFactory(CCID reader, PINManagementGUIFacade gui) {
+ super(reader, gui);
+ }
- public static ManagementPINProviderFactory getInstance(SignatureCard forCard,
- PINManagementGUIFacade gui) {
- if (forCard.getReader().hasFeature(CCID.FEATURE_VERIFY_PIN_DIRECT)) {
-// forCard.ifdSupportsFeature(SignatureCard.FEATURE_MODIFY_PIN_DIRECT)
- return new PinpadPINProviderFactory(gui);
+// public static ManagementPINProviderFactory getInstance(SignatureCard forCard,
+// PINManagementGUIFacade gui) {
+// if (forCard.getReader().hasFeature(CCID.FEATURE_VERIFY_PIN_DIRECT)) {
+// return new PinpadPINProviderFactory(gui);
+//
+// } else {
+// return new SoftwarePINProviderFactory(gui);
+// }
+// }
+
+ public PINProvider getVerifyPINProvider() {
+ if (reader.hasFeature(CCID.FEATURE_VERIFY_PIN_START)) {
+ return new PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG.VERIFY);
+ } else if (reader.hasFeature(CCID.FEATURE_VERIFY_PIN_DIRECT)) {
+ return new PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG.VERIFY);
+ } else {
+ return new SoftwareGenericPinProvider(PINManagementGUIFacade.DIALOG.VERIFY);
+ }
+ }
+
+ public PINProvider getActivatePINProvider() {
+ if (reader.hasFeature(CCID.FEATURE_MODIFY_PIN_START)) {
+ return new PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG.ACTIVATE);
+ } else if (reader.hasFeature(CCID.FEATURE_MODIFY_PIN_DIRECT)) {
+ return new PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG.ACTIVATE);
+ } else {
+ return new SoftwareGenericPinProvider(PINManagementGUIFacade.DIALOG.ACTIVATE);
+ }
+ }
+ public ChangePINProvider getChangePINProvider() {
+ if (reader.hasFeature(CCID.FEATURE_MODIFY_PIN_START)) {
+ return new PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG.CHANGE);
+ } else if (reader.hasFeature(CCID.FEATURE_MODIFY_PIN_DIRECT)) {
+ return new PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG.CHANGE);
} else {
- return new SoftwarePINProviderFactory(gui);
+ return new ChangePinProvider();
+ }
+ }
+
+ public PINProvider getUnblockPINProvider() {
+ if (reader.hasFeature(CCID.FEATURE_VERIFY_PIN_START)) {
+ return new PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG.UNBLOCK);
+ } else if (reader.hasFeature(CCID.FEATURE_VERIFY_PIN_DIRECT)) {
+ return new PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG.UNBLOCK);
+ } else {
+ return new SoftwareGenericPinProvider(PINManagementGUIFacade.DIALOG.UNBLOCK);
+ }
+ }
+
+ class PinpadGenericPinProvider extends AbstractPINProvider
+ implements ChangePINProvider {
+
+ protected PINManagementGUIFacade.DIALOG type;
+
+ private PinpadGenericPinProvider(PINManagementGUIFacade.DIALOG type) {
+ this.type = type;
+ }
+
+ @Override
+ public char[] providePIN(PINSpec spec, int retries)
+ throws CancelledException, InterruptedException {
+
+ showPinpadPINDialog(retries, spec);
+ retry = true;
+ return null;
+ }
+
+ /**
+ * do not call this method without calling providePIN()
+ * (no message is displayed)
+ * @param spec
+ * @param retries
+ * @return
+ */
+ @Override
+ public char[] provideOldPIN(PINSpec spec, int retries) {
+ return null;
+ }
+
+ private void showPinpadPINDialog(int retries, PINSpec pinSpec) {
+ String title, message;
+ Object[] params;
+ if (retry) {
+ title = BKUGUIFacade.TITLE_RETRY;
+ message = BKUGUIFacade.MESSAGE_RETRIES;
+ params = new Object[]{String.valueOf(retries)};
+ } else if (type == PINManagementGUIFacade.DIALOG.VERIFY) {
+ title = PINManagementGUIFacade.TITLE_VERIFY_PIN;
+ message = BKUGUIFacade.MESSAGE_ENTERPIN_PINPAD;
+ String pinSize = String.valueOf(pinSpec.getMinLength());
+ if (pinSpec.getMinLength() != pinSpec.getMaxLength()) {
+ pinSize += "-" + pinSpec.getMaxLength();
+ }
+ params = new Object[]{pinSpec.getLocalizedName(), pinSize};
+ } else if (type == PINManagementGUIFacade.DIALOG.ACTIVATE) {
+ title = PINManagementGUIFacade.TITLE_ACTIVATE_PIN;
+ message = PINManagementGUIFacade.MESSAGE_ACTIVATEPIN_PINPAD;
+ String pinSize = String.valueOf(pinSpec.getMinLength());
+ if (pinSpec.getMinLength() != pinSpec.getMaxLength()) {
+ pinSize += "-" + pinSpec.getMaxLength();
+ }
+ params = new Object[]{pinSpec.getLocalizedName(), pinSize};
+ } else if (type == PINManagementGUIFacade.DIALOG.CHANGE) {
+ title = PINManagementGUIFacade.TITLE_CHANGE_PIN;
+ message = PINManagementGUIFacade.MESSAGE_CHANGEPIN_PINPAD;
+ String pinSize = String.valueOf(pinSpec.getMinLength());
+ if (pinSpec.getMinLength() != pinSpec.getMaxLength()) {
+ pinSize += "-" + pinSpec.getMaxLength();
+ }
+ params = new Object[]{pinSpec.getLocalizedName(), pinSize};
+ } else { //if (type == DIALOG.UNBLOCK) {
+ title = PINManagementGUIFacade.TITLE_UNBLOCK_PIN;
+ message = PINManagementGUIFacade.MESSAGE_UNBLOCKPIN_PINPAD;
+ String pinSize = String.valueOf(pinSpec.getMinLength());
+ if (pinSpec.getMinLength() != pinSpec.getMaxLength()) {
+ pinSize += "-" + pinSpec.getMaxLength();
+ }
+ params = new Object[]{pinSpec.getLocalizedName(), pinSize};
+ }
+ gui.showMessageDialog(title, message, params);
}
}
- public abstract PINProvider getVerifyPINProvider();
- public abstract PINProvider getActivatePINProvider();
+ class SoftwareGenericPinProvider extends AbstractPINProvider {
+
+// protected PINManagementGUIFacade gui;
+ protected PINManagementGUIFacade.DIALOG type;
+
+ private SoftwareGenericPinProvider(PINManagementGUIFacade.DIALOG type) {
+ this.type = type;
+ }
+
+ @Override
+ public char[] providePIN(PINSpec spec, int retries)
+ throws CancelledException, InterruptedException {
+
+ ((PINManagementGUIFacade) gui).showPINDialog(type, spec,
+ (retry) ? retries : -1,
+ this, "exec",
+ this, "back");
+
+ waitForAction();
+
+ if ("exec".equals(action)) {
+ gui.showMessageDialog(BKUGUIFacade.TITLE_WAIT,
+ BKUGUIFacade.MESSAGE_WAIT);
+ retry = true;
+ return gui.getPin();
+ } else if ("back".equals(action)) {
+ throw new CancelledException();
+ } else {
+ log.error("unsupported command " + action);
+ throw new CancelledException();
+ }
+ }
+ }
+
+ class ChangePinProvider extends AbstractPINProvider
+ implements ChangePINProvider {
- public abstract ChangePINProvider getChangePINProvider();
+// protected PINManagementGUIFacade gui;
- public abstract PINProvider getUnblockPINProvider();
+ private char[] oldPin;
+ private char[] newPin;
+ private ChangePinProvider() {
+ }
+
+ @Override
+ public char[] providePIN(PINSpec spec, int retries)
+ throws CancelledException, InterruptedException {
+ if (newPin == null) {
+ getPINs(spec, retries);
+ }
+ char[] pin = newPin;
+ newPin = null;
+ return pin;
+ }
+
+ @Override
+ public char[] provideOldPIN(PINSpec spec, int retries)
+ throws CancelledException, InterruptedException {
+ if (oldPin == null) {
+ getPINs(spec, retries);
+ }
+ char[] pin = oldPin;
+ oldPin = null;
+ return pin;
+ }
+
+ private void getPINs(PINSpec spec, int retries)
+ throws InterruptedException, CancelledException {
+
+ ((PINManagementGUIFacade) gui).showPINDialog(
+ PINManagementGUIFacade.DIALOG.CHANGE, spec,
+ (retry) ? retries : -1,
+ this, "exec",
+ this, "back");
+
+ waitForAction();
+
+ if ("exec".equals(action)) {
+ gui.showMessageDialog(BKUGUIFacade.TITLE_WAIT,
+ BKUGUIFacade.MESSAGE_WAIT);
+ retry = true;
+ oldPin = ((PINManagementGUIFacade) gui).getOldPin();
+ newPin = gui.getPin();
+ } else if ("back".equals(action)) {
+ throw new CancelledException();
+ } else {
+ log.error("unsupported command " + action);
+ throw new CancelledException();
+ }
+ }
+ }
}
diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PINManagementRequestHandler.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PINManagementRequestHandler.java
index 6b565b26..72a7c4cc 100644
--- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PINManagementRequestHandler.java
+++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PINManagementRequestHandler.java
@@ -25,6 +25,9 @@ import at.gv.egiz.bku.smccstal.PINProviderFactory;
import at.gv.egiz.smcc.CancelledException;
import at.gv.egiz.smcc.LockedException;
import at.gv.egiz.smcc.NotActivatedException;
+import at.gv.egiz.smcc.PINConfirmationException;
+import at.gv.egiz.smcc.PINFormatException;
+import at.gv.egiz.smcc.PINOperationAbortedException;
import at.gv.egiz.smcc.PINProvider;
import at.gv.egiz.smcc.PINSpec;
import at.gv.egiz.smcc.STARCOSCard;
@@ -58,7 +61,6 @@ public class PINManagementRequestHandler extends AbstractRequestHandler {
protected static final Log log = LogFactory.getLog(PINManagementRequestHandler.class);
protected Map<PINSpec, STATUS> pinStatuses;
- private ManagementPINProviderFactory pinProviderFactory;
@Override
public STALResponse handleRequest(STALRequest request) throws InterruptedException {
@@ -89,16 +91,14 @@ public class PINManagementRequestHandler extends AbstractRequestHandler {
throw new NullPointerException("no PIN selected for activation/change");
}
- if (pinProviderFactory == null) {
- pinProviderFactory =
- ManagementPINProviderFactory.getInstance(card, gui);
- }
+ ManagementPINProviderFactory ppfac =
+ new ManagementPINProviderFactory(card.getReader(), gui);
try {
if ("activate_enterpin".equals(actionCommand)) {
log.info("activate " + selectedPIN.getLocalizedName());
- card.activatePIN(selectedPIN,
- pinProviderFactory.getActivatePINProvider());
+ card.activatePIN(selectedPIN,
+ ppfac.getActivatePINProvider());
updatePINStatus(selectedPIN, STATUS.ACTIV);
gui.showMessageDialog(PINManagementGUIFacade.TITLE_ACTIVATE_SUCCESS,
PINManagementGUIFacade.MESSAGE_ACTIVATE_SUCCESS,
@@ -108,7 +108,7 @@ public class PINManagementRequestHandler extends AbstractRequestHandler {
} else if ("change_enterpin".equals(actionCommand)) {
log.info("change " + selectedPIN.getLocalizedName());
card.changePIN(selectedPIN,
- pinProviderFactory.getChangePINProvider());
+ ppfac.getChangePINProvider());
updatePINStatus(selectedPIN, STATUS.ACTIV);
gui.showMessageDialog(PINManagementGUIFacade.TITLE_CHANGE_SUCCESS,
PINManagementGUIFacade.MESSAGE_CHANGE_SUCCESS,
@@ -119,11 +119,11 @@ public class PINManagementRequestHandler extends AbstractRequestHandler {
} else if ("unblock_enterpuk".equals(actionCommand)) {
log.info("unblock " + selectedPIN.getLocalizedName());
card.unblockPIN(selectedPIN,
- pinProviderFactory.getUnblockPINProvider());
+ ppfac.getUnblockPINProvider());
} else if ("verify_enterpin".equals(actionCommand)) {
log.info("verify " + selectedPIN.getLocalizedName());
card.verifyPIN(selectedPIN,
- pinProviderFactory.getVerifyPINProvider());
+ ppfac.getVerifyPINProvider());
updatePINStatus(selectedPIN, STATUS.ACTIV);
}
} catch (CancelledException ex) {
@@ -149,6 +149,29 @@ public class PINManagementRequestHandler extends AbstractRequestHandler {
new Object[] {selectedPIN.getLocalizedName()},
this, null);
waitForAction();
+ } catch (PINConfirmationException ex) {
+ log.error("confirmation pin does not match new " + selectedPIN.getLocalizedName());
+ gui.showErrorDialog(PINManagementGUIFacade.ERR_PIN_CONFIRMATION,
+ new Object[] {selectedPIN.getLocalizedName()},
+ this, null);
+ waitForAction();
+ } catch (PINOperationAbortedException ex) {
+ log.error("pin operation aborted without further details");
+ gui.showErrorDialog(PINManagementGUIFacade.ERR_PIN_OPERATION_ABORTED,
+ new Object[] {selectedPIN.getLocalizedName()},
+ this, null);
+ waitForAction();
+ } catch (PINFormatException ex) {
+ log.error("wrong format of new " + selectedPIN.getLocalizedName());
+// updatePINStatus(selectedPIN, STATUS.NOT_ACTIV);
+ String pinSize = String.valueOf(selectedPIN.getMinLength());
+ if (selectedPIN.getMinLength() != selectedPIN.getMaxLength()) {
+ pinSize += "-" + selectedPIN.getMaxLength();
+ }
+ gui.showErrorDialog(PINManagementGUIFacade.ERR_PIN_FORMAT,
+ new Object[] {selectedPIN.getLocalizedName(), pinSize},
+ this, null);
+ waitForAction();
}
} // end if
diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PinpadPINProviderFactory.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PinpadPINProviderFactory.java
deleted file mode 100644
index a9ad5ef8..00000000
--- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PinpadPINProviderFactory.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * 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.bku.smccstal.ext;
-
-import at.gv.egiz.smcc.ChangePINProvider;
-import at.gv.egiz.bku.gui.BKUGUIFacade;
-import at.gv.egiz.bku.gui.PINManagementGUIFacade;
-import at.gv.egiz.bku.gui.PINManagementGUIFacade.DIALOG;
-import at.gv.egiz.bku.smccstal.AbstractPINProvider;
-import at.gv.egiz.smcc.CancelledException;
-import at.gv.egiz.smcc.PINProvider;
-import at.gv.egiz.smcc.PINSpec;
-
-/**
- *
- * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at>
- */
-public class PinpadPINProviderFactory extends ManagementPINProviderFactory {
-
- protected PinpadPINProviderFactory(PINManagementGUIFacade gui) {
- this.gui = gui;
- }
-
- @Override
- public PINProvider getVerifyPINProvider() {
- return new SimplePinProvider(DIALOG.VERIFY);
- }
-
- @Override
- public PINProvider getActivatePINProvider() {
- return new SimplePinProvider(DIALOG.ACTIVATE);
- }
-
- @Override
- public ChangePINProvider getChangePINProvider() {
- return new SimplePinProvider(DIALOG.CHANGE);
- }
-
- @Override
- public PINProvider getUnblockPINProvider() {
- return new SimplePinProvider(DIALOG.UNBLOCK);
- }
-
-
- class SimplePinProvider extends AbstractPINProvider
- implements ChangePINProvider {
-
-// protected PINManagementGUIFacade gui;
- protected PINManagementGUIFacade.DIALOG type;
-
- private SimplePinProvider(PINManagementGUIFacade.DIALOG type) {
- this.type = type;
- }
-
- @Override
- public char[] providePIN(PINSpec spec, int retries)
- throws CancelledException, InterruptedException {
-
- showPinpadPINDialog(retries, spec);
- retry = true;
- return null;
- }
-
- /**
- * do not call this method without calling providePIN()
- * (no message is displayed)
- * @param spec
- * @param retries
- * @return
- */
- @Override
- public char[] provideOldPIN(PINSpec spec, int retries) {
- return null;
- }
-
- private void showPinpadPINDialog(int retries, PINSpec pinSpec) {
- String title, message;
- Object[] params;
- if (retry) {
- title = BKUGUIFacade.TITLE_RETRY;
- message = BKUGUIFacade.MESSAGE_RETRIES;
- params = new Object[]{String.valueOf(retries)};
- } else if (type == DIALOG.VERIFY) {
- title = PINManagementGUIFacade.TITLE_VERIFY_PIN;
- message = BKUGUIFacade.MESSAGE_ENTERPIN_PINPAD;
- String pinSize = String.valueOf(pinSpec.getMinLength());
- if (pinSpec.getMinLength() != pinSpec.getMaxLength()) {
- pinSize += "-" + pinSpec.getMaxLength();
- }
- params = new Object[]{pinSpec.getLocalizedName(), pinSize};
- } else if (type == DIALOG.ACTIVATE) {
- title = PINManagementGUIFacade.TITLE_ACTIVATE_PIN;
- message = PINManagementGUIFacade.MESSAGE_ACTIVATEPIN_PINPAD;
- String pinSize = String.valueOf(pinSpec.getMinLength());
- if (pinSpec.getMinLength() != pinSpec.getMaxLength()) {
- pinSize += "-" + pinSpec.getMaxLength();
- }
- params = new Object[]{pinSpec.getLocalizedName(), pinSize};
- } else if (type == DIALOG.CHANGE) {
- title = PINManagementGUIFacade.TITLE_CHANGE_PIN;
- message = PINManagementGUIFacade.MESSAGE_CHANGEPIN_PINPAD;
- String pinSize = String.valueOf(pinSpec.getMinLength());
- if (pinSpec.getMinLength() != pinSpec.getMaxLength()) {
- pinSize += "-" + pinSpec.getMaxLength();
- }
- params = new Object[]{pinSpec.getLocalizedName(), pinSize};
- } else { //if (type == DIALOG.UNBLOCK) {
- title = PINManagementGUIFacade.TITLE_UNBLOCK_PIN;
- message = PINManagementGUIFacade.MESSAGE_UNBLOCKPIN_PINPAD;
- String pinSize = String.valueOf(pinSpec.getMinLength());
- if (pinSpec.getMinLength() != pinSpec.getMaxLength()) {
- pinSize += "-" + pinSpec.getMaxLength();
- }
- params = new Object[]{pinSpec.getLocalizedName(), pinSize};
- }
- gui.showMessageDialog(title, message, params);
- }
- }
-}
diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/SoftwarePINProviderFactory.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/SoftwarePINProviderFactory.java
deleted file mode 100644
index e87512d0..00000000
--- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/SoftwarePINProviderFactory.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * 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.bku.smccstal.ext;
-
-import at.gv.egiz.bku.gui.BKUGUIFacade;
-import at.gv.egiz.smcc.ChangePINProvider;
-import at.gv.egiz.bku.gui.PINManagementGUIFacade;
-import at.gv.egiz.bku.gui.PINManagementGUIFacade.DIALOG;
-import at.gv.egiz.bku.smccstal.AbstractPINProvider;
-import at.gv.egiz.smcc.CancelledException;
-import at.gv.egiz.smcc.PINProvider;
-import at.gv.egiz.smcc.PINSpec;
-
-/**
- *
- * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at>
- */
-public class SoftwarePINProviderFactory extends ManagementPINProviderFactory {
-
- protected SoftwarePINProviderFactory(PINManagementGUIFacade gui) {
- this.gui = gui;
- }
-
- @Override
- public PINProvider getVerifyPINProvider() {
- return new SimplePinProvider(DIALOG.VERIFY);
- }
-
- @Override
- public PINProvider getActivatePINProvider() {
- return new SimplePinProvider(DIALOG.ACTIVATE);
- }
-
- @Override
- public ChangePINProvider getChangePINProvider() {
- return new ChangePinProvider();
- }
-
- @Override
- public PINProvider getUnblockPINProvider() {
- return new SimplePinProvider(DIALOG.UNBLOCK);
- }
-
- class SimplePinProvider extends AbstractPINProvider {
-
-// protected PINManagementGUIFacade gui;
- protected PINManagementGUIFacade.DIALOG type;
-
- private SimplePinProvider(DIALOG type) {
- this.type = type;
- }
-
- @Override
- public char[] providePIN(PINSpec spec, int retries)
- throws CancelledException, InterruptedException {
-
- gui.showPINDialog(type, spec, (retry) ? retries : -1,
- this, "exec",
- this, "back");
-
- waitForAction();
-
- if ("exec".equals(action)) {
- gui.showMessageDialog(BKUGUIFacade.TITLE_WAIT,
- BKUGUIFacade.MESSAGE_WAIT);
- retry = true;
- return gui.getPin();
- } else if ("back".equals(action)) {
- throw new CancelledException();
- } else {
- log.error("unsupported command " + action);
- throw new CancelledException();
- }
- }
- }
-
- class ChangePinProvider extends AbstractPINProvider
- implements ChangePINProvider {
-
-// protected PINManagementGUIFacade gui;
-
- private char[] oldPin;
- private char[] newPin;
-
- private ChangePinProvider() {
- }
-
- @Override
- public char[] providePIN(PINSpec spec, int retries)
- throws CancelledException, InterruptedException {
- if (newPin == null) {
- getPINs(spec, retries);
- }
- char[] pin = newPin;
- newPin = null;
- return pin;
- }
-
- @Override
- public char[] provideOldPIN(PINSpec spec, int retries)
- throws CancelledException, InterruptedException {
- if (oldPin == null) {
- getPINs(spec, retries);
- }
- char[] pin = oldPin;
- oldPin = null;
- return pin;
- }
-
- private void getPINs(PINSpec spec, int retries)
- throws InterruptedException, CancelledException {
-
- gui.showPINDialog(PINManagementGUIFacade.DIALOG.CHANGE, spec,
- (retry) ? retries : -1,
- this, "exec",
- this, "back");
-
- waitForAction();
-
- if ("exec".equals(action)) {
- gui.showMessageDialog(BKUGUIFacade.TITLE_WAIT,
- BKUGUIFacade.MESSAGE_WAIT);
- retry = true;
- oldPin = gui.getOldPin();
- newPin = gui.getPin();
- } else if ("back".equals(action)) {
- throw new CancelledException();
- } else {
- log.error("unsupported command " + action);
- throw new CancelledException();
- }
- }
- }
-}