summaryrefslogtreecommitdiff
path: root/smccSTAL/src/main/java/at/gv/egiz/bku
diff options
context:
space:
mode:
Diffstat (limited to 'smccSTAL/src/main/java/at/gv/egiz/bku')
-rw-r--r--smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/InfoBoxReadRequestHandler.java12
-rw-r--r--smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/PINProviderFactory.java298
-rw-r--r--smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/PinpadPINProviderFactory.java186
-rw-r--r--smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java10
-rw-r--r--smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SoftwarePINProviderFactory.java137
5 files changed, 296 insertions, 347 deletions
diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/InfoBoxReadRequestHandler.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/InfoBoxReadRequestHandler.java
index 94444922..eeb97290 100644
--- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/InfoBoxReadRequestHandler.java
+++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/InfoBoxReadRequestHandler.java
@@ -37,21 +37,20 @@ public class InfoBoxReadRequestHandler extends AbstractRequestHandler {
private static Log log = LogFactory.getLog(InfoBoxReadRequestHandler.class);
- protected PINProviderFactory pinProviderFactory;
+// protected PINProviderFactory pinProviderFactory;
@Override
public STALResponse handleRequest(STALRequest request) throws InterruptedException {
if (request instanceof InfoboxReadRequest) {
InfoboxReadRequest infoBox = (InfoboxReadRequest) request;
- if (pinProviderFactory == null) {
- pinProviderFactory = PINProviderFactory.getInstance(card, gui);
- }
+
try {
if (infoBox.getInfoboxIdentifier().equals("IdentityLink")) {
newSTALMessage("Message.RequestCaption", "Message.IdentityLink");
log.debug("Handling identitylink infobox");
byte[] resp = card.getInfobox(infoBox.getInfoboxIdentifier(),
- pinProviderFactory.getCardPINProvider(),
+ new PINProviderFactory(card.getReader(), gui)
+ .getCardPINProvider(),
infoBox.getDomainIdentifier());
if (resp == null) {
log.info("Got null as result->user cancelled");
@@ -98,7 +97,8 @@ public class InfoBoxReadRequestHandler extends AbstractRequestHandler {
log.warn("Unknown infobox identifier: "
+ infoBox.getInfoboxIdentifier() + " trying generic request");
byte[] resp = card.getInfobox(infoBox.getInfoboxIdentifier(),
- pinProviderFactory.getCardPINProvider(),
+ new PINProviderFactory(card.getReader(), gui)
+ .getCardPINProvider(),
infoBox.getDomainIdentifier());
if (resp == null) {
return new ErrorResponse(6001);
diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/PINProviderFactory.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/PINProviderFactory.java
index ce1b2d00..78ae6c2b 100644
--- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/PINProviderFactory.java
+++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/PINProviderFactory.java
@@ -18,31 +18,305 @@
package at.gv.egiz.bku.smccstal;
import at.gv.egiz.bku.gui.BKUGUIFacade;
+import at.gv.egiz.smcc.CancelledException;
import at.gv.egiz.smcc.ccid.CCID;
import at.gv.egiz.smcc.PINProvider;
-import at.gv.egiz.smcc.SignatureCard;
+import at.gv.egiz.smcc.PINSpec;
import at.gv.egiz.stal.signedinfo.SignedInfoType;
+import java.security.DigestException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
*
* @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at>
*/
-public abstract class PINProviderFactory {
+public class PINProviderFactory {
+
+ protected static final Log log = LogFactory.getLog(PINProviderFactory.class);
+
+ protected CCID reader;
+ protected BKUGUIFacade gui;
+
+ /**
+ * don't reuse the instance if the card reader might have changed!
+ * @param reader
+ * @param gui
+ */
+ public PINProviderFactory(CCID reader, BKUGUIFacade gui) {
+ log.trace("PINProviderFactory for " + reader.getName());
+ this.reader = reader;
+ this.gui = gui;
+ }
+
- BKUGUIFacade gui;
- public static PINProviderFactory getInstance(SignatureCard forCard,
- BKUGUIFacade gui) {
- if (forCard.getReader().hasFeature(CCID.FEATURE_VERIFY_PIN_DIRECT)) {
- return new PinpadPINProviderFactory(gui);
+// public static PINProviderFactory getInstance(SignatureCard forCard,
+// BKUGUIFacade gui) {
+// if (forCard.getReader().hasFeature(CCID.FEATURE_VERIFY_PIN_DIRECT) ||
+// forCard.getReader().hasFeature(CCID.FEATURE_VERIFY_PIN_DIRECT)) {
+// return new PinpadPINProviderFactory(gui);
+// } else {
+// return new SoftwarePINProviderFactory(gui);
+// }
+// }
+
+ /**
+ * don't reuse the instance if the card reader might have changed!
+ * @param reader
+ * @param gui
+ * @return
+ */
+// public static PINProviderFactory getInstance(CCID reader, BKUGUIFacade gui) {
+// log.trace("PINProviderFactory for " + reader.getName());
+// return new PINProviderFactory(reader, gui);
+// }
+
+ public PINProvider getSignaturePINProvider(SecureViewer viewer,
+ SignedInfoType signedInfo) {
+ if (reader.hasFeature(CCID.FEATURE_VERIFY_PIN_START) ||
+ reader.hasFeature(CCID.FEATURE_VERIFY_PIN_DIRECT)) {
+ log.debug("pinpad signature-pin provider");
+ return new PinpadSignaturePinProvider(viewer, signedInfo);
} else {
- return new SoftwarePINProviderFactory(gui);
+ log.debug("software signature-pin provider");
+ return new SoftwareSignaturePinProvider(viewer, signedInfo);
}
}
- public abstract PINProvider getSignaturePINProvider(SecureViewer viewer,
- SignedInfoType signedInfo);
-
- public abstract PINProvider getCardPINProvider();
+ public PINProvider getCardPINProvider() {
+ if (reader.hasFeature(CCID.FEATURE_VERIFY_PIN_START) ||
+ reader.hasFeature(CCID.FEATURE_VERIFY_PIN_DIRECT)) {
+ log.debug("pinpad card-pin provider");
+ return new PinpadCardPinProvider();
+ } else {
+ log.debug("software card-pin provider");
+ return new SoftwareCardPinProvider();
+ }
+ }
+
+ class SoftwareSignaturePinProvider extends AbstractPINProvider {
+
+ protected SecureViewer viewer;
+ protected SignedInfoType signedInfo;
+
+ private SoftwareSignaturePinProvider(SecureViewer viewer,
+ SignedInfoType signedInfo) {
+ this.viewer = viewer;
+ this.signedInfo = signedInfo;
+ }
+
+ @Override
+ public char[] providePIN(PINSpec spec, int retries)
+ throws CancelledException, InterruptedException {
+
+ gui.showSignaturePINDialog(spec, (retry) ? retries : -1,
+ this, "sign",
+ this, "cancel",
+ this, "secureViewer");
+
+ do {
+ waitForAction();
+
+ if ("secureViewer".equals(action)) {
+ try {
+ viewer.displayDataToBeSigned(signedInfo, this, "pinEntry");
+ } catch (DigestException ex) {
+ log.error("Bad digest value: " + ex.getMessage());
+ gui.showErrorDialog(BKUGUIFacade.ERR_INVALID_HASH,
+ new Object[]{ex.getMessage()},
+ this, "error");
+ } catch (Exception ex) {
+ log.error("Could not display hashdata inputs: " +
+ ex.getMessage());
+ gui.showErrorDialog(BKUGUIFacade.ERR_DISPLAY_HASHDATA,
+ new Object[]{ex.getMessage()},
+ this, "error");
+ }
+ } else if ("sign".equals(action)) {
+ gui.showMessageDialog(BKUGUIFacade.TITLE_WAIT,
+ BKUGUIFacade.MESSAGE_WAIT);
+ retry = true;
+ return gui.getPin();
+ } else if ("pinEntry".equals(action)) {
+ gui.showSignaturePINDialog(spec, (retry) ? retries : -1,
+ this, "sign",
+ this, "cancel",
+ this, "secureViewer");
+ } else if ("cancel".equals(action) ||
+ "error".equals(action)) {
+ gui.showMessageDialog(BKUGUIFacade.TITLE_WAIT,
+ BKUGUIFacade.MESSAGE_WAIT);
+ throw new CancelledException(spec.getLocalizedName() +
+ " entry cancelled");
+ } else {
+ log.error("unknown action command " + action);
+ }
+ } while (true);
+ }
+ }
+
+ class SoftwareCardPinProvider extends AbstractPINProvider {
+
+ private SoftwareCardPinProvider() {
+ }
+
+ @Override
+ public char[] providePIN(PINSpec spec, int retries)
+ throws CancelledException, InterruptedException {
+
+ gui.showCardPINDialog(spec, (retry) ? retries : -1,
+ this, "ok",
+ this, "cancel");
+
+ waitForAction();
+
+ gui.showMessageDialog(BKUGUIFacade.TITLE_WAIT,
+ BKUGUIFacade.MESSAGE_WAIT);
+
+ if ("cancel".equals(action)) {
+ throw new CancelledException(spec.getLocalizedName() +
+ " entry cancelled");
+ }
+ retry = true;
+ return gui.getPin();
+ }
+ }
+
+ class PinpadSignaturePinProvider extends AbstractPINProvider {
+// protected BKUGUIFacade gui;
+ protected SecureViewer viewer;
+ protected ViewerThread viewerThread;
+ protected SignedInfoType signedInfo;
+
+
+ private PinpadSignaturePinProvider(SecureViewer viewer,
+ SignedInfoType signedInfo) {
+ this.viewer = viewer;
+ this.signedInfo = signedInfo;
+ }
+
+ protected class ViewerThread extends Thread {
+
+ PINSpec pinSpec;
+ int retries;
+
+ public ViewerThread(PINSpec pinSpec, int retries) {
+ this.pinSpec = pinSpec;
+ this.retries = retries;
+ }
+
+ @Override
+ public void run() {
+
+ try {
+
+ gui.showPinpadSignaturePINDialog(pinSpec, retries,
+ PinpadSignaturePinProvider.this, "secureViewer");
+
+ while (true) {
+ waitForAction();
+
+ if ("secureViewer".equals(action)) {
+ viewer.displayDataToBeSigned(signedInfo,
+ PinpadSignaturePinProvider.this, "pinEntry");
+ } else if ("pinEntry".equals(action)) {
+ gui.showPinpadSignaturePINDialog(pinSpec, retries,
+ PinpadSignaturePinProvider.this, "secureViewer");
+ } else {
+ log.error("unsupported action command: " + action);
+ }
+ }
+
+ } catch (DigestException ex) {
+ log.error("Bad digest value: " + ex.getMessage());
+ gui.showErrorDialog(BKUGUIFacade.ERR_INVALID_HASH,
+ new Object[]{ex.getMessage()});
+ } catch (InterruptedException ex) {
+ log.info("pinpad secure viewer thread interrupted");
+ } catch (Exception ex) {
+ log.error("Could not display hashdata inputs: " +
+ ex.getMessage());
+ gui.showErrorDialog(BKUGUIFacade.ERR_DISPLAY_HASHDATA,
+ new Object[]{ex.getMessage()});
+ }
+ }
+ }
+
+ @Override
+ public char[] providePIN(PINSpec spec, int retries)
+ throws CancelledException, InterruptedException {
+
+ if (viewerThread != null) {
+ updateViewerThread(retries);
+ } else {
+ viewerThread = new ViewerThread(spec, -1);
+ viewerThread.start();
+ }
+// if (viewerThread != null) {
+// log.trace("interrupt old secure viewer thread");
+// viewerThread.interrupt();
+// }
+// viewerThread = new ViewerThread(spec, (retry) ? retries : -1);
+// log.trace("start new secure viewer thread");
+// viewerThread.start();
+
+ retry = true;
+ return null;
+ }
+
+ private synchronized void updateViewerThread(int retries) {
+ log.trace("update viewer thread");
+ viewerThread.retries = retries;
+ action = "pinEntry";
+ actionPerformed = true;
+ notify();
+ }
+
+
+// @Override
+// protected void finalize() throws Throwable {
+// if (viewerThread != null) {
+// viewerThread.interrupt();
+// }
+// log.info("finalizing Pinpad SignaturePinProvider");
+// super.finalize();
+// }
+ }
+
+ class PinpadCardPinProvider extends AbstractPINProvider {
+
+ private PinpadCardPinProvider() {
+ }
+
+ @Override
+ public char[] providePIN(PINSpec spec, int retries)
+ throws CancelledException, InterruptedException {
+
+ showPinpadPINDialog(retries, spec);
+ retry = true;
+ 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 {
+ title = BKUGUIFacade.TITLE_CARDPIN;
+ 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};
+ }
+ gui.showMessageDialog(title, message, params);
+ }
+ }
}
diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/PinpadPINProviderFactory.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/PinpadPINProviderFactory.java
deleted file mode 100644
index c109ceba..00000000
--- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/PinpadPINProviderFactory.java
+++ /dev/null
@@ -1,186 +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.bku.gui.BKUGUIFacade;
-import at.gv.egiz.smcc.CancelledException;
-import at.gv.egiz.smcc.PINProvider;
-import at.gv.egiz.smcc.PINSpec;
-import at.gv.egiz.stal.signedinfo.SignedInfoType;
-import java.security.DigestException;
-
-/**
- *
- * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at>
- */
-public class PinpadPINProviderFactory extends PINProviderFactory {
-
- protected PinpadPINProviderFactory(BKUGUIFacade gui) {
- this.gui = gui;
- }
-
- @Override
- public PINProvider getSignaturePINProvider(SecureViewer viewer,
- SignedInfoType signedInfo) {
-
- return new SignaturePinProvider(viewer, signedInfo);
- }
-
- @Override
- public PINProvider getCardPINProvider() {
- return new CardPinProvider();
- }
-
- class SignaturePinProvider extends AbstractPINProvider {
-
-// protected BKUGUIFacade gui;
- protected SecureViewer viewer;
- protected ViewerThread viewerThread;
- protected SignedInfoType signedInfo;
-
-
- private SignaturePinProvider(SecureViewer viewer,
- SignedInfoType signedInfo) {
- this.viewer = viewer;
- this.signedInfo = signedInfo;
- }
-
- protected class ViewerThread extends Thread {
-
- PINSpec pinSpec;
- int retries;
-
- public ViewerThread(PINSpec pinSpec, int retries) {
- this.pinSpec = pinSpec;
- this.retries = retries;
- }
-
- @Override
- public void run() {
-
- try {
-
- gui.showPinpadSignaturePINDialog(pinSpec, retries,
- SignaturePinProvider.this, "secureViewer");
-
- while (true) {
- waitForAction();
-
- if ("secureViewer".equals(action)) {
- viewer.displayDataToBeSigned(signedInfo,
- SignaturePinProvider.this, "pinEntry");
- } else if ("pinEntry".equals(action)) {
- gui.showPinpadSignaturePINDialog(pinSpec, retries,
- SignaturePinProvider.this, "secureViewer");
- } else {
- log.error("unsupported action command: " + action);
- }
- }
-
- } catch (DigestException ex) {
- log.error("Bad digest value: " + ex.getMessage());
- gui.showErrorDialog(BKUGUIFacade.ERR_INVALID_HASH,
- new Object[]{ex.getMessage()});
- } catch (InterruptedException ex) {
- log.info("pinpad secure viewer thread interrupted");
- } catch (Exception ex) {
- log.error("Could not display hashdata inputs: " +
- ex.getMessage());
- gui.showErrorDialog(BKUGUIFacade.ERR_DISPLAY_HASHDATA,
- new Object[]{ex.getMessage()});
- }
- }
- }
-
- @Override
- public char[] providePIN(PINSpec spec, int retries)
- throws CancelledException, InterruptedException {
-
- if (viewerThread != null) {
- updateViewerThread(retries);
- } else {
- viewerThread = new ViewerThread(spec, -1);
- viewerThread.start();
- }
-// if (viewerThread != null) {
-// log.trace("interrupt old secure viewer thread");
-// viewerThread.interrupt();
-// }
-// viewerThread = new ViewerThread(spec, (retry) ? retries : -1);
-// log.trace("start new secure viewer thread");
-// viewerThread.start();
-
- retry = true;
- return null;
- }
-
- private synchronized void updateViewerThread(int retries) {
- log.trace("update viewer thread");
- viewerThread.retries = retries;
- action = "pinEntry";
- actionPerformed = true;
- notify();
- }
-
-
-// @Override
-// protected void finalize() throws Throwable {
-// if (viewerThread != null) {
-// viewerThread.interrupt();
-// }
-// log.info("finalizing Pinpad SignaturePinProvider");
-// super.finalize();
-// }
- }
-
- class CardPinProvider extends AbstractPINProvider {
-
- private CardPinProvider() {
- }
-
- @Override
- public char[] providePIN(PINSpec spec, int retries)
- throws CancelledException, InterruptedException {
-
- showPinpadPINDialog(retries, spec);
- retry = true;
- 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 {
- title = BKUGUIFacade.TITLE_CARDPIN;
- 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};
- }
- gui.showMessageDialog(title, message, params);
- }
- }
- }
-
diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java
index 7a4f6572..56fc8804 100644
--- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java
+++ b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SignRequestHandler.java
@@ -50,7 +50,7 @@ public class SignRequestHandler extends AbstractRequestHandler {
private static Log log = LogFactory.getLog(SignRequestHandler.class);
private static JAXBContext jaxbContext;
- private PINProviderFactory pinProviderFactory;
+// private PINProviderFactory pinProviderFactory;
private SecureViewer secureViewer;
static {
@@ -86,11 +86,9 @@ public class SignRequestHandler extends AbstractRequestHandler {
md.update(signReq.getSignedInfo());
KeyboxName kb = SignatureCard.KeyboxName.getKeyboxName(signReq.getKeyIdentifier());
- if (pinProviderFactory == null) {
- pinProviderFactory = PINProviderFactory.getInstance(card, gui);
- }
- byte[] resp = card.createSignature(md.digest(), kb,
- pinProviderFactory.getSignaturePINProvider(secureViewer, si.getValue()));
+ byte[] resp = card.createSignature(md.digest(), kb,
+ new PINProviderFactory(card.getReader(), gui)
+ .getSignaturePINProvider(secureViewer, si.getValue()));
if (resp == null) {
return new ErrorResponse(6001);
}
diff --git a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SoftwarePINProviderFactory.java b/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SoftwarePINProviderFactory.java
deleted file mode 100644
index 7d36c2c3..00000000
--- a/smccSTAL/src/main/java/at/gv/egiz/bku/smccstal/SoftwarePINProviderFactory.java
+++ /dev/null
@@ -1,137 +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.bku.gui.BKUGUIFacade;
-import at.gv.egiz.smcc.*;
-import at.gv.egiz.stal.HashDataInput;
-import at.gv.egiz.stal.signedinfo.SignedInfoType;
-import java.security.DigestException;
-import java.util.List;
-
-/**
- *
- * @author Clemens Orthacker <clemens.orthacker@iaik.tugraz.at>
- */
-public class SoftwarePINProviderFactory extends PINProviderFactory {
-
- protected SoftwarePINProviderFactory(BKUGUIFacade gui) {
- this.gui = gui;
- }
-
- @Override
- public PINProvider getSignaturePINProvider(SecureViewer viewer,
- SignedInfoType signedInfo) {
- return new SignaturePinProvider(viewer, signedInfo);
- }
-
- @Override
- public PINProvider getCardPINProvider() {
- return new CardPinProvider();
- }
-
- class SignaturePinProvider extends AbstractPINProvider {
-
-// protected BKUGUIFacade gui;
- protected SecureViewer viewer;
- protected SignedInfoType signedInfo;
-
- private SignaturePinProvider(SecureViewer viewer,
- SignedInfoType signedInfo) {
- this.viewer = viewer;
- this.signedInfo = signedInfo;
- }
-
- @Override
- public char[] providePIN(PINSpec spec, int retries)
- throws CancelledException, InterruptedException {
-
- gui.showSignaturePINDialog(spec, (retry) ? retries : -1,
- this, "sign",
- this, "cancel",
- this, "secureViewer");
-
- do {
- waitForAction();
-
- if ("secureViewer".equals(action)) {
- try {
- viewer.displayDataToBeSigned(signedInfo, this, "pinEntry");
- } catch (DigestException ex) {
- log.error("Bad digest value: " + ex.getMessage());
- gui.showErrorDialog(BKUGUIFacade.ERR_INVALID_HASH,
- new Object[]{ex.getMessage()},
- this, "error");
- } catch (Exception ex) {
- log.error("Could not display hashdata inputs: " +
- ex.getMessage());
- gui.showErrorDialog(BKUGUIFacade.ERR_DISPLAY_HASHDATA,
- new Object[]{ex.getMessage()},
- this, "error");
- }
- } else if ("sign".equals(action)) {
- gui.showMessageDialog(BKUGUIFacade.TITLE_WAIT,
- BKUGUIFacade.MESSAGE_WAIT);
- retry = true;
- return gui.getPin();
- } else if ("pinEntry".equals(action)) {
- gui.showSignaturePINDialog(spec, (retry) ? retries : -1,
- this, "sign",
- this, "cancel",
- this, "secureViewer");
- } else if ("cancel".equals(action) ||
- "error".equals(action)) {
- gui.showMessageDialog(BKUGUIFacade.TITLE_WAIT,
- BKUGUIFacade.MESSAGE_WAIT);
- throw new CancelledException(spec.getLocalizedName() +
- " entry cancelled");
- } else {
- log.error("unknown action command " + action);
- }
- } while (true);
- }
- }
-
- class CardPinProvider extends AbstractPINProvider {
-
-// protected BKUGUIFacade gui;
-
- private CardPinProvider() {
- }
-
- @Override
- public char[] providePIN(PINSpec spec, int retries)
- throws CancelledException, InterruptedException {
-
- gui.showCardPINDialog(spec, (retry) ? retries : -1,
- this, "ok",
- this, "cancel");
-
- waitForAction();
-
- gui.showMessageDialog(BKUGUIFacade.TITLE_WAIT,
- BKUGUIFacade.MESSAGE_WAIT);
-
- if ("cancel".equals(action)) {
- throw new CancelledException(spec.getLocalizedName() +
- " entry cancelled");
- }
- retry = true;
- return gui.getPin();
- }
- }
-}