summaryrefslogtreecommitdiff
path: root/smccSTALExt/src/main/java/at/gv/egiz
diff options
context:
space:
mode:
Diffstat (limited to 'smccSTALExt/src/main/java/at/gv/egiz')
-rw-r--r--smccSTALExt/src/main/java/at/gv/egiz/bku/pin/gui/ManagementPINGUI.java16
-rw-r--r--smccSTALExt/src/main/java/at/gv/egiz/bku/pin/gui/ManagementPINProvider.java20
-rw-r--r--smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/CardMgmtRequestHandler.java35
-rw-r--r--smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/GetPINStatusException.java41
-rw-r--r--smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/PINManagementRequestHandler.java188
5 files changed, 123 insertions, 177 deletions
diff --git a/smccSTALExt/src/main/java/at/gv/egiz/bku/pin/gui/ManagementPINGUI.java b/smccSTALExt/src/main/java/at/gv/egiz/bku/pin/gui/ManagementPINGUI.java
index 26a24609..eadecc11 100644
--- a/smccSTALExt/src/main/java/at/gv/egiz/bku/pin/gui/ManagementPINGUI.java
+++ b/smccSTALExt/src/main/java/at/gv/egiz/bku/pin/gui/ManagementPINGUI.java
@@ -20,14 +20,14 @@ 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.smcc.CancelledException;
-import at.gv.egiz.smcc.PINSpec;
+import at.gv.egiz.smcc.PinInfo;
import at.gv.egiz.smcc.pin.gui.ModifyPINGUI;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class ManagementPINGUI extends ManagementPINProvider implements ModifyPINGUI {
- protected static final Log log = LogFactory.getLog(ManagementPINGUI.class);
+ protected static final Logger log = LoggerFactory.getLogger(ManagementPINGUI.class);
private boolean retry = false;
@@ -36,7 +36,7 @@ public class ManagementPINGUI extends ManagementPINProvider implements ModifyPIN
}
@Override
- public void modifyPINDirect(PINSpec spec, int retries)
+ public void modifyPINDirect(PinInfo spec, int retries)
throws CancelledException, InterruptedException {
gui.showModifyPINDirect(type, spec, (retry) ? retries : -1);
retry = true;
@@ -48,19 +48,19 @@ public class ManagementPINGUI extends ManagementPINProvider implements ModifyPIN
}
@Override
- public void enterCurrentPIN(PINSpec spec, int retries) {
+ public void enterCurrentPIN(PinInfo spec, int retries) {
gui.showEnterCurrentPIN(type, spec, (retry) ? retries : -1);
retry = true;
}
@Override
- public void enterNewPIN(PINSpec spec) {
+ public void enterNewPIN(PinInfo spec) {
gui.showEnterNewPIN(type, spec);
retry = true;
}
@Override
- public void confirmNewPIN(PINSpec spec) {
+ public void confirmNewPIN(PinInfo spec) {
gui.showConfirmNewPIN(type, spec);
retry = true;
}
diff --git a/smccSTALExt/src/main/java/at/gv/egiz/bku/pin/gui/ManagementPINProvider.java b/smccSTALExt/src/main/java/at/gv/egiz/bku/pin/gui/ManagementPINProvider.java
index 8d842d13..488ea754 100644
--- a/smccSTALExt/src/main/java/at/gv/egiz/bku/pin/gui/ManagementPINProvider.java
+++ b/smccSTALExt/src/main/java/at/gv/egiz/bku/pin/gui/ManagementPINProvider.java
@@ -19,14 +19,14 @@ package at.gv.egiz.bku.pin.gui;
import at.gv.egiz.bku.gui.BKUGUIFacade;
import at.gv.egiz.bku.gui.PINManagementGUIFacade;
import at.gv.egiz.smcc.CancelledException;
-import at.gv.egiz.smcc.PINSpec;
+import at.gv.egiz.smcc.PinInfo;
import at.gv.egiz.smcc.pin.gui.ModifyPINProvider;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class ManagementPINProvider extends AbstractPINProvider implements ModifyPINProvider {
- protected static final Log log = LogFactory.getLog(ManagementPINProvider.class);
+ private final Logger log = LoggerFactory.getLogger(ManagementPINProvider.class);
protected PINManagementGUIFacade gui;
protected PINManagementGUIFacade.DIALOG type;
private boolean retry = false;
@@ -37,16 +37,16 @@ public class ManagementPINProvider extends AbstractPINProvider implements Modify
}
@Override
- public char[] provideCurrentPIN(PINSpec spec, int retries)
+ public char[] provideCurrentPIN(PinInfo spec, int retries)
throws CancelledException, InterruptedException {
gui.showPINDialog(type, spec, (retry) ? retries : -1,
this, "change",
this, "cancel");
- log.trace("[" + Thread.currentThread().getName() + "] wait for action");
+ log.trace("[{}] wait for action.", Thread.currentThread().getName());
waitForAction();
- log.trace("[" + Thread.currentThread().getName() + "] received action " + action);
+ log.trace("[{}] received action {}.", Thread.currentThread().getName(), action);
gui.showMessageDialog(BKUGUIFacade.TITLE_WAIT,
BKUGUIFacade.MESSAGE_WAIT);
@@ -60,7 +60,7 @@ public class ManagementPINProvider extends AbstractPINProvider implements Modify
}
@Override
- public char[] provideNewPIN(PINSpec spec)
+ public char[] provideNewPIN(PinInfo spec)
throws CancelledException, InterruptedException {
char[] pin = gui.getPin();
@@ -73,9 +73,9 @@ public class ManagementPINProvider extends AbstractPINProvider implements Modify
this, "activate",
this, "cancel");
- log.trace("[" + Thread.currentThread().getName() + "] wait for action");
+ log.trace("[{}] wait for action.", Thread.currentThread().getName());
waitForAction();
- log.trace("[" + Thread.currentThread().getName() + "] received action " + action);
+ log.trace("[{}] received action {}.", Thread.currentThread().getName(), action);
gui.showMessageDialog(BKUGUIFacade.TITLE_WAIT,
BKUGUIFacade.MESSAGE_WAIT);
diff --git a/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/CardMgmtRequestHandler.java b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/CardMgmtRequestHandler.java
index 533206b3..b39a451a 100644
--- a/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/CardMgmtRequestHandler.java
+++ b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/CardMgmtRequestHandler.java
@@ -30,10 +30,9 @@ import javax.smartcardio.CardException;
import javax.smartcardio.CommandAPDU;
import javax.smartcardio.ResponseAPDU;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-import at.gv.egiz.bku.smccstal.AbstractRequestHandler;
import at.gv.egiz.smcc.SignatureCardException;
import at.gv.egiz.stal.ErrorResponse;
import at.gv.egiz.stal.STALRequest;
@@ -57,7 +56,7 @@ public class CardMgmtRequestHandler extends AbstractRequestHandler implements Ac
/**
* Logging facility.
*/
- private static Log log = LogFactory.getLog(CardMgmtRequestHandler.class);
+ private final Logger log = LoggerFactory.getLogger(CardMgmtRequestHandler.class);
/**
* The sequence counter.
@@ -77,12 +76,13 @@ public class CardMgmtRequestHandler extends AbstractRequestHandler implements Ac
if (request instanceof APDUScriptRequest) {
currentActivationScript++;
- log.debug("handling APDU script " + currentActivationScript);
+ log.debug("Handling APDU script {}.", currentActivationScript);
Card icc = card.getCard();
if (icc == null) {
- log.error("SignatureCard instance '" + card.getClass().getName() + "' does not support card management requests.");
+ log.error("SignatureCard instance '{}' does not support card management requests.",
+ card.getClass().getName());
return new ErrorResponse(1000);
}
@@ -92,22 +92,22 @@ public class CardMgmtRequestHandler extends AbstractRequestHandler implements Ac
((ActivationGUIFacade) gui).showActivationProgressDialog(currentActivationScript, script.size(), this, "cancel");
try {
- log.trace("begin exclusive");
+ log.trace("Begin exclusive.");
icc.beginExclusive();
for (RequestScriptElement scriptElement : script) {
((ActivationGUIFacade) gui).incrementProgress();
if (scriptElement instanceof Command) {
- log.trace("handling APDU script element COMMAND");
+ log.trace("Handling APDU script element COMMAND.");
Command command = (Command) scriptElement;
CommandAPDU commandAPDU = new CommandAPDU(command.getCommandAPDU());
- log.trace("get basicchannel");
+ log.trace("Get basicchannel.");
CardChannel channel = icc.getBasicChannel();
sequenceNum = command.getSequence();
- log.debug("Transmit APDU (sequence=" + sequenceNum + ")");
+ log.debug("Transmit APDU (sequence={}).", sequenceNum);
log.trace(commandAPDU.toString());
ResponseAPDU responseAPDU = channel.transmit(commandAPDU);
log.trace(responseAPDU.toString());
@@ -127,14 +127,14 @@ public class CardMgmtRequestHandler extends AbstractRequestHandler implements Ac
} else if (scriptElement instanceof Reset) {
- log.trace("handling APDU script element RESET");
+ log.trace("Handling APDU script element RESET.");
sequenceNum = 0;
card.reset();
javax.smartcardio.ATR atr = icc.getATR();
- log.trace("got ATR: " + atr.toString());
+ log.trace("Got ATR: {}.", atr.toString());
responses.add(new ATR(atr.getBytes()));
- log.trace("regain exclusive access to card");
+ log.trace("Regain exclusive access to card.");
icc = card.getCard();
icc.beginExclusive();
}
@@ -148,22 +148,23 @@ public class CardMgmtRequestHandler extends AbstractRequestHandler implements Ac
log.info("Failed to reset smart card.", e);
responses.add(new Response(sequenceNum, null, null, Response.RC_UNSPECIFIED));
} catch (RuntimeException e) {
- log.error(e);
+ log.error(e.getMessage(), e);
throw e;
} finally {
try {
icc.endExclusive();
} catch (CardException e) {
- log.info(e);
+ log.info(e.getMessage(), e);
}
}
- log.trace("done handling APDU script " + currentActivationScript + ", return response containing " + responses.size() + " elements");
+ log.trace("Done handling APDU script {}, return response containing {} elements.",
+ currentActivationScript, responses.size());
((ActivationGUIFacade) gui).showIdleDialog(this, "cancel");
return new APDUScriptResponse(responses);
} else {
- log.error("Got unexpected STAL request: " + request);
+ log.error("Got unexpected STAL request: {}.", request);
return new ErrorResponse(1000);
}
diff --git a/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/GetPINStatusException.java b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/GetPINStatusException.java
deleted file mode 100644
index 66b15887..00000000
--- a/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/GetPINStatusException.java
+++ /dev/null
@@ -1,41 +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;
-
-import at.gv.egiz.smcc.SignatureCardException;
-
-/**
- *
- * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at>
- */
-public class GetPINStatusException extends SignatureCardException {
-
- /**
- * Creates a new instance of <code>GetStatusException</code> without detail message.
- */
- public GetPINStatusException() {
- }
-
-
- /**
- * Constructs an instance of <code>GetStatusException</code> with the specified detail message.
- * @param msg the detail message.
- */
- public GetPINStatusException(String msg) {
- super(msg);
- }
-}
diff --git a/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/PINManagementRequestHandler.java b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/PINManagementRequestHandler.java
index f87f43f7..961e7f26 100644
--- a/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/PINManagementRequestHandler.java
+++ b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/PINManagementRequestHandler.java
@@ -16,16 +16,11 @@
*/
package at.gv.egiz.bku.smccstal;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import at.gv.egiz.bku.gui.BKUGUIFacade;
-import at.gv.egiz.bku.gui.PINManagementGUI;
import at.gv.egiz.bku.gui.PINManagementGUIFacade;
-import at.gv.egiz.bku.gui.PINManagementGUIFacade.STATUS;
import at.gv.egiz.bku.pin.gui.ManagementPINGUI;
import at.gv.egiz.bku.pin.gui.VerifyPINGUI;
import at.gv.egiz.smcc.CancelledException;
@@ -35,11 +30,9 @@ import at.gv.egiz.smcc.PINConfirmationException;
import at.gv.egiz.smcc.PINFormatException;
import at.gv.egiz.smcc.PINMgmtSignatureCard;
import at.gv.egiz.smcc.PINOperationAbortedException;
-import at.gv.egiz.smcc.PINSpec;
+import at.gv.egiz.smcc.PinInfo;
import at.gv.egiz.smcc.SignatureCardException;
import at.gv.egiz.smcc.TimeoutException;
-import at.gv.egiz.smcc.PINMgmtSignatureCard.PIN_STATE;
-import at.gv.egiz.smcc.SignatureCard.KeyboxName;
import at.gv.egiz.stal.ErrorResponse;
import at.gv.egiz.stal.STALRequest;
import at.gv.egiz.stal.STALResponse;
@@ -52,9 +45,7 @@ import at.gv.egiz.stal.ext.PINManagementResponse;
*/
public class PINManagementRequestHandler extends AbstractRequestHandler {
- protected static final Log log = LogFactory.getLog(PINManagementRequestHandler.class);
-
- protected Map<PINSpec, STATUS> pinStates = new HashMap<PINSpec, STATUS>();
+ private final Logger log = LoggerFactory.getLogger(PINManagementRequestHandler.class);
@Override
public STALResponse handleRequest(STALRequest request) throws InterruptedException {
@@ -62,27 +53,21 @@ public class PINManagementRequestHandler extends AbstractRequestHandler {
PINManagementGUIFacade gui = (PINManagementGUIFacade) this.gui;
- PINSpec selectedPIN = null;
+ PinInfo selectedPIN = null;
try {
+ PinInfo[] pinInfos = null;
+
if (card instanceof PINMgmtSignatureCard) {
try {
- // check if activated
- card.getCertificate(KeyboxName.SECURE_SIGNATURE_KEYPAIR);
-
- // update all PIN states
- for (PINSpec pinSpec : ((PINMgmtSignatureCard) card).getPINSpecs()) {
- updatePINState(pinSpec, STATUS.UNKNOWN);
- }
-
- gui.showPINManagementDialog(pinStates, this, "activate_enterpin",
- "change_enterpin", "unblock_enterpuk", "verify_enterpin", this,
- "cancel");
-
- } catch (NotActivatedException ex) {
- log.error("pin management not allowed, card not activated");
+ pinInfos = ((PINMgmtSignatureCard) card).getPinInfos();
+ gui.showPINManagementDialog(pinInfos, this, "activate_enterpin",
+ "change_enterpin", "unblock_enterpuk", "verify_enterpin",
+ this, "cancel");
+ } catch (SignatureCardException ex) {
+ log.error("Card not activated, pin management not available (STARCOS G3).");
gui.showErrorDialog(PINManagementGUIFacade.ERR_CARD_NOTACTIVATED,
null, this, "cancel");
}
@@ -99,13 +84,16 @@ public class PINManagementRequestHandler extends AbstractRequestHandler {
waitForAction();
if ("cancel".equals(actionCommand)) {
- log.debug("pin management cancel");
+ log.debug("Pin management cancel.");
return new PINManagementResponse();
} else {
- selectedPIN = gui.getSelectedPINSpec();
+ selectedPIN = gui.getSelectedPinInfo();
if (selectedPIN == null) {
- throw new NullPointerException("no PIN selected for activation/change");
+ log.error("No PIN selected for activation/change.");
+ gui.showErrorDialog(PINManagementGUIFacade.ERR_UNKNOWN_WITH_PARAM,
+ new Object[] {"no pin selected"}, this, "cancel");
+ continue;
}
try {
@@ -119,24 +107,24 @@ public class PINManagementRequestHandler extends AbstractRequestHandler {
verifyPIN(selectedPIN);
}
} catch (CancelledException ex) {
- log.trace("cancelled");
+ log.trace("Cancelled.");
} catch (TimeoutException ex) {
- log.error("Timeout during pin entry");
+ log.error("Timeout during pin entry.");
gui.showMessageDialog(BKUGUIFacade.TITLE_ENTRY_TIMEOUT,
BKUGUIFacade.ERR_PIN_TIMEOUT,
new Object[] {selectedPIN.getLocalizedName()},
BKUGUIFacade.BUTTON_OK, this, null);
waitForAction();
} catch (LockedException ex) {
- log.error(selectedPIN.getLocalizedName() + " locked");
- updatePINState(selectedPIN, STATUS.BLOCKED);
+ log.error("{} locked.", selectedPIN.getLocalizedName());
+// updatePINState(selectedPIN, STATUS.BLOCKED);
gui.showErrorDialog(PINManagementGUIFacade.ERR_LOCKED,
new Object[] {selectedPIN.getLocalizedName()},
this, null);
waitForAction();
} catch (NotActivatedException ex) {
- log.error(selectedPIN.getLocalizedName() + " not active");
- updatePINState(selectedPIN, STATUS.NOT_ACTIV);
+ log.error("{} not active.", selectedPIN.getLocalizedName());
+// updatePINState(selectedPIN, STATUS.NOT_ACTIV);
gui.showErrorDialog(PINManagementGUIFacade.ERR_NOT_ACTIVE,
new Object[] {selectedPIN.getLocalizedName()},
this, null);
@@ -147,7 +135,7 @@ public class PINManagementRequestHandler extends AbstractRequestHandler {
// } catch (PINFormatException ex) {
} catch (PINOperationAbortedException ex) {
- log.error("pin operation aborted without further details");
+ log.error("Pin operation aborted without further details.");
gui.showErrorDialog(PINManagementGUIFacade.ERR_PIN_OPERATION_ABORTED,
new Object[] {selectedPIN.getLocalizedName()},
this, null);
@@ -156,18 +144,18 @@ public class PINManagementRequestHandler extends AbstractRequestHandler {
} // end if
selectedPIN = null;
- gui.showPINManagementDialog(pinStates,
+ gui.showPINManagementDialog(pinInfos,
this, "activate_enterpin", "change_enterpin", "unblock_enterpuk", "verify_enterpin",
this, "cancel");
} // end while
- } catch (GetPINStatusException ex) {
- String pin = (selectedPIN != null) ? selectedPIN.getLocalizedName() : "pin";
- log.error("failed to get " + pin + " status: " + ex.getMessage());
- gui.showErrorDialog(PINManagementGUIFacade.ERR_STATUS, null,
- this, "ok");
- waitForAction();
- return new ErrorResponse(1000);
+// } catch (GetPINStatusException ex) {
+// String pin = (selectedPIN != null) ? selectedPIN.getLocalizedName() : "pin";
+// log.error("failed to get " + pin + " status: " + ex.getMessage());
+// gui.showErrorDialog(PINManagementGUIFacade.ERR_STATUS, null,
+// this, "ok");
+// waitForAction();
+// return new ErrorResponse(1000);
} catch (SignatureCardException ex) {
log.error(ex.getMessage(), ex);
gui.showErrorDialog(PINManagementGUIFacade.ERR_UNKNOWN, null,
@@ -176,33 +164,33 @@ public class PINManagementRequestHandler extends AbstractRequestHandler {
return new ErrorResponse(1000);
}
} else {
- log.error("Got unexpected STAL request: " + request);
+ log.error("Got unexpected STAL request: {}.", request);
return new ErrorResponse(1000);
}
}
- private void activatePIN(PINSpec selectedPIN)
- throws InterruptedException, SignatureCardException, GetPINStatusException {
+ private void activatePIN(PinInfo selectedPIN)
+ throws InterruptedException, SignatureCardException {
- log.info("activate " + selectedPIN.getLocalizedName());
+ log.info("Activate {}.", selectedPIN.getLocalizedName());
ManagementPINGUI pinGUI = new ManagementPINGUI((PINManagementGUIFacade) gui,
PINManagementGUIFacade.DIALOG.ACTIVATE);
- boolean reentry;
+ boolean reentry = false;
do {
try {
- reentry = false;
((PINMgmtSignatureCard) card).activatePIN(selectedPIN, pinGUI);
} catch (PINConfirmationException ex) {
reentry = true;
- log.error("confirmation pin does not match new " + selectedPIN.getLocalizedName());
+ log.error("Confirmation pin does not match new {}.", selectedPIN
+ .getLocalizedName());
gui.showErrorDialog(PINManagementGUIFacade.ERR_PIN_CONFIRMATION,
new Object[] {selectedPIN.getLocalizedName()},
this, null);
waitForAction();
} catch (PINFormatException ex) {
reentry = true;
- log.error("wrong format of new " + selectedPIN.getLocalizedName());
+ log.error("Wrong format of new {}.", selectedPIN.getLocalizedName());
String pinSize = String.valueOf(selectedPIN.getMinLength());
if (selectedPIN.getMinLength() != selectedPIN.getMaxLength()) {
pinSize += "-" + selectedPIN.getMaxLength();
@@ -214,7 +202,7 @@ public class PINManagementRequestHandler extends AbstractRequestHandler {
}
} while (reentry);
- updatePINState(selectedPIN, STATUS.ACTIV);
+// updatePINState(selectedPIN, STATUS.ACTIV);
gui.showMessageDialog(PINManagementGUIFacade.TITLE_ACTIVATE_SUCCESS,
PINManagementGUIFacade.MESSAGE_ACTIVATE_SUCCESS,
new Object[]{selectedPIN.getLocalizedName()},
@@ -222,20 +210,19 @@ public class PINManagementRequestHandler extends AbstractRequestHandler {
waitForAction();
}
- private void verifyPIN(PINSpec selectedPIN)
- throws InterruptedException, SignatureCardException, GetPINStatusException {
+ private void verifyPIN(PinInfo selectedPIN)
+ throws InterruptedException, SignatureCardException {
- log.info("verify " + selectedPIN.getLocalizedName());
+ log.info("Verify {}.", selectedPIN.getLocalizedName());
VerifyPINGUI pinGUI = new VerifyPINGUI(gui);
- boolean reentry;
+ boolean reentry = false;
do {
try {
- reentry = false;
((PINMgmtSignatureCard) card).verifyPIN(selectedPIN, pinGUI);
} catch (PINFormatException ex) {
reentry = true;
- log.error("wrong format of new " + selectedPIN.getLocalizedName());
+ log.error("Wrong format of new {}.", selectedPIN.getLocalizedName());
String pinSize = String.valueOf(selectedPIN.getMinLength());
if (selectedPIN.getMinLength() != selectedPIN.getMaxLength()) {
pinSize += "-" + selectedPIN.getMaxLength();
@@ -247,31 +234,30 @@ public class PINManagementRequestHandler extends AbstractRequestHandler {
}
} while (reentry);
- updatePINState(selectedPIN, STATUS.ACTIV);
+// updatePINState(selectedPIN, STATUS.ACTIV);
}
- private void changePIN(PINSpec selectedPIN)
- throws SignatureCardException, GetPINStatusException, InterruptedException {
+ private void changePIN(PinInfo selectedPIN)
+ throws SignatureCardException, InterruptedException {
- log.info("change " + selectedPIN.getLocalizedName());
+ log.info("Change {}.", selectedPIN.getLocalizedName());
ManagementPINGUI pinGUI = new ManagementPINGUI((PINManagementGUIFacade) gui,
PINManagementGUIFacade.DIALOG.CHANGE);
- boolean reentry;
+ boolean reentry = false;
do {
try {
- reentry = false;
((PINMgmtSignatureCard) card).changePIN(selectedPIN, pinGUI);
} catch (PINConfirmationException ex) {
reentry = true;
- log.error("confirmation pin does not match new " + selectedPIN.getLocalizedName());
+ log.error("Confirmation pin does not match new {}.", selectedPIN.getLocalizedName());
gui.showErrorDialog(PINManagementGUIFacade.ERR_PIN_CONFIRMATION,
new Object[] {selectedPIN.getLocalizedName()},
this, null);
waitForAction();
} catch (PINFormatException ex) {
reentry = true;
- log.error("wrong format of new " + selectedPIN.getLocalizedName());
+ log.error("Wrong format of new {}.", selectedPIN.getLocalizedName());
String pinSize = String.valueOf(selectedPIN.getMinLength());
if (selectedPIN.getMinLength() != selectedPIN.getMaxLength()) {
pinSize += "-" + selectedPIN.getMaxLength();
@@ -283,7 +269,7 @@ public class PINManagementRequestHandler extends AbstractRequestHandler {
}
} while (reentry);
- updatePINState(selectedPIN, STATUS.ACTIV);
+// updatePINState(selectedPIN, STATUS.ACTIV);
gui.showMessageDialog(PINManagementGUIFacade.TITLE_CHANGE_SUCCESS,
PINManagementGUIFacade.MESSAGE_CHANGE_SUCCESS,
new Object[]{selectedPIN.getLocalizedName()},
@@ -291,28 +277,28 @@ public class PINManagementRequestHandler extends AbstractRequestHandler {
waitForAction();
}
- private void unblockPIN(PINSpec selectedPIN)
- throws SignatureCardException, GetPINStatusException, InterruptedException {
+ private void unblockPIN(PinInfo selectedPIN)
+ throws SignatureCardException, InterruptedException {
- log.info("unblock " + selectedPIN.getLocalizedName());
+ log.info("Unblock {}.", selectedPIN.getLocalizedName());
ManagementPINGUI pinGUI = new ManagementPINGUI((PINManagementGUIFacade) gui,
PINManagementGUIFacade.DIALOG.UNBLOCK);
- boolean reentry;
+ boolean reentry = false;
do {
try {
- reentry = false;
((PINMgmtSignatureCard) card).unblockPIN(selectedPIN, pinGUI);
} catch (PINConfirmationException ex) {
reentry = true;
- log.error("confirmation pin does not match new " + selectedPIN.getLocalizedName());
+ log.error("Confirmation pin does not match new {}.", selectedPIN
+ .getLocalizedName());
gui.showErrorDialog(PINManagementGUIFacade.ERR_PIN_CONFIRMATION,
new Object[] {selectedPIN.getLocalizedName()},
this, null);
waitForAction();
} catch (PINFormatException ex) {
reentry = true;
- log.error("wrong format of new " + selectedPIN.getLocalizedName());
+ log.error("Wrong format of new {}.", selectedPIN.getLocalizedName());
String pinSize = String.valueOf(selectedPIN.getMinLength());
if (selectedPIN.getMinLength() != selectedPIN.getMaxLength()) {
pinSize += "-" + selectedPIN.getMaxLength();
@@ -324,7 +310,7 @@ public class PINManagementRequestHandler extends AbstractRequestHandler {
}
} while (reentry);
- updatePINState(selectedPIN, STATUS.ACTIV);
+// updatePINState(selectedPIN, STATUS.ACTIV);
gui.showMessageDialog(PINManagementGUIFacade.TITLE_UNBLOCK_SUCCESS,
PINManagementGUIFacade.MESSAGE_UNBLOCK_SUCCESS,
new Object[]{selectedPIN.getLocalizedName()},
@@ -344,28 +330,28 @@ public class PINManagementRequestHandler extends AbstractRequestHandler {
* @param status
* @throws at.gv.egiz.smcc.SignatureCardException if query status fails
*/
- private void updatePINState(PINSpec pinSpec, STATUS status)
- throws GetPINStatusException {
-
- PINMgmtSignatureCard pmCard = ((PINMgmtSignatureCard) card);
- PIN_STATE pinState;
- try {
- pinState = pmCard.getPINState(pinSpec);
- } catch (SignatureCardException e) {
- String msg = "Failed to get PIN status for pin '"
- + pinSpec.getLocalizedName() + "'.";
- log.info(msg, e);
- throw new GetPINStatusException(msg);
- }
- if (pinState == PIN_STATE.ACTIV) {
- pinStates.put(pinSpec, STATUS.ACTIV);
- } else if (pinState == PIN_STATE.NOT_ACTIV) {
- pinStates.put(pinSpec, STATUS.NOT_ACTIV);
- } else if (pinState == PIN_STATE.BLOCKED) {
- pinStates.put(pinSpec, STATUS.BLOCKED);
- } else {
- pinStates.put(pinSpec, status);
- }
- }
+// private void updatePINState(PINSpec pinSpec, STATUS status)
+// throws GetPINStatusException {
+//
+// PINMgmtSignatureCard pmCard = ((PINMgmtSignatureCard) card);
+// PIN_STATE pinState;
+// try {
+// pinState = pmCard.getPINState(pinSpec);
+// } catch (SignatureCardException e) {
+// String msg = "Failed to get PIN status for pin '"
+// + pinSpec.getLocalizedName() + "'.";
+// log.info(msg, e);
+// throw new GetPINStatusException(msg);
+// }
+// if (pinState == PIN_STATE.ACTIV) {
+// pinStates.put(pinSpec, STATUS.ACTIV);
+// } else if (pinState == PIN_STATE.NOT_ACTIV) {
+// pinStates.put(pinSpec, STATUS.NOT_ACTIV);
+// } else if (pinState == PIN_STATE.BLOCKED) {
+// pinStates.put(pinSpec, STATUS.BLOCKED);
+// } else {
+// pinStates.put(pinSpec, status);
+// }
+// }
}