From f3ba184673d938677696a3cb7c8e620822aef181 Mon Sep 17 00:00:00 2001 From: clemenso Date: Wed, 28 Jan 2009 19:40:53 +0000 Subject: activation git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@292 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/keystore.ks | Bin 0 -> 5635 bytes BKUAppletExt/pom.xml | 97 +++++++++++++ .../egiz/bku/online/applet/ext/BKUAppletExt.java | 80 +++++++++++ .../bku/smccstal/ext/CardMgmtRequestHandler.java | 151 +++++++++++++++++++++ BKUAppletExt/src/test/resources/appletTest.html | 34 +++++ 5 files changed, 362 insertions(+) create mode 100644 BKUAppletExt/keystore.ks create mode 100644 BKUAppletExt/pom.xml create mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ext/BKUAppletExt.java create mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/CardMgmtRequestHandler.java create mode 100644 BKUAppletExt/src/test/resources/appletTest.html (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/keystore.ks b/BKUAppletExt/keystore.ks new file mode 100644 index 00000000..824c3a40 Binary files /dev/null and b/BKUAppletExt/keystore.ks differ diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml new file mode 100644 index 00000000..3ff88ed8 --- /dev/null +++ b/BKUAppletExt/pom.xml @@ -0,0 +1,97 @@ + + + + bku + at.gv.egiz + 1.0.5-SNAPSHOT + + 4.0.0 + at.gv.egiz + BKUAppletExt + BKU Applet Extension + 1.0.2-SNAPSHOT + + + + at.gv.egiz + STALExt + 1.0.2-SNAPSHOT + + + at.gv.egiz + STALXService + 1.0.2-SNAPSHOT + + + at.gv.egiz + smccSTAL + 1.0.5-SNAPSHOT + + + at.gv.egiz + BKUApplet + 1.0.5-SNAPSHOT + + + + + + maven-jar-plugin + + + + sign + + + + + + false + false + + false + true + + + test-applet signer + ./keystore.ks + storepass + keypass + true + + + + maven-dependency-plugin + + + unpack + + unpack-dependencies + + + at.gv.egiz + true + ${project.build.outputDirectory} + META-INF\/ + + + + + copy_testapplet + + copy-dependencies + + + ${project.build.directory}/test-classes + commons-logging,iaik + commons-logging,iaik_jce_me4se + true + + + + + + + \ No newline at end of file diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ext/BKUAppletExt.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ext/BKUAppletExt.java new file mode 100644 index 00000000..d9df5536 --- /dev/null +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ext/BKUAppletExt.java @@ -0,0 +1,80 @@ +/* + * 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.online.applet.ext; + +import at.gv.egiz.stal.service.translator.STALTranslator; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import at.gv.egiz.bku.online.applet.BKUApplet; +import at.gv.egiz.bku.smccstal.AbstractBKUWorker; +import at.gv.egiz.bku.smccstal.ext.CardMgmtRequestHandler; +import at.gv.egiz.stal.ext.APDUScriptRequest; +import at.gv.egiz.stal.service.STALPortType; +import at.gv.egiz.stalx.service.STALService; +import at.gv.egiz.stalx.service.translator.STALXTranslationHandler; +import java.net.MalformedURLException; +import java.net.URL; +import javax.xml.namespace.QName; + +/** + * @author mcentner + */ +public class BKUAppletExt extends BKUApplet { + + private static final long serialVersionUID = 1L; + private static Log log = LogFactory.getLog(BKUAppletExt.class); + + @Override + public void init() { + super.init(); + if (worker instanceof AbstractBKUWorker) { + CardMgmtRequestHandler handler = new CardMgmtRequestHandler(); + ((AbstractBKUWorker) worker).addRequestHandler(APDUScriptRequest.class, handler); + log.debug("Registered CardMgmtRequestHandler"); + } else { + log.warn("Cannot register CardMgmtRequestHandler."); + } + } + + /** + * creates a STAL-X enabled webservice port + * @return + * @throws java.net.MalformedURLException + */ + @Override + protected STALPortType getSTALPort() throws MalformedURLException { + URL wsdlURL = getURLParameter(WSDL_URL, null); + log.debug("setting STAL WSDL: " + wsdlURL); + QName endpointName = new QName(STAL_WSDL_NS, STAL_SERVICE); + log.info("creating STAL-X enabled webservice port"); + STALService stal = new STALService(wsdlURL, endpointName); + return stal.getSTALPort(); + } + + @Override + protected STALTranslator getSTALTranslator() { + STALTranslator translator = super.getSTALTranslator(); + translator.registerTranslationHandler(new STALXTranslationHandler()); + return translator; + } + + +} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/CardMgmtRequestHandler.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/CardMgmtRequestHandler.java new file mode 100644 index 00000000..f499de7e --- /dev/null +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/CardMgmtRequestHandler.java @@ -0,0 +1,151 @@ +/* +* 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 java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import javax.smartcardio.Card; +import javax.smartcardio.CardChannel; +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 at.gv.egiz.bku.smccstal.AbstractRequestHandler; +import at.gv.egiz.smcc.SignatureCardException; +import at.gv.egiz.stal.ErrorResponse; +import at.gv.egiz.stal.STALRequest; +import at.gv.egiz.stal.STALResponse; +import at.gv.egiz.stal.ext.APDUScriptRequest; +import at.gv.egiz.stal.ext.APDUScriptResponse; +import at.gv.egiz.stal.ext.APDUScriptRequest.Command; +import at.gv.egiz.stal.ext.APDUScriptRequest.RequestScriptElement; +import at.gv.egiz.stal.ext.APDUScriptRequest.Reset; +import at.gv.egiz.stal.ext.APDUScriptResponse.Response; +import at.gv.egiz.stal.ext.APDUScriptResponse.ATR; +import at.gv.egiz.stal.ext.APDUScriptResponse.ResponseScriptElement; + +/** + * @author mcentner + * + */ +public class CardMgmtRequestHandler extends AbstractRequestHandler { + + /** + * Logging facility. + */ + private static Log log = LogFactory.getLog(CardMgmtRequestHandler.class); + + /** + * The sequence counter. + */ + private int sequenceNum = 0; + + @Override + public STALResponse handleRequest(STALRequest request) + throws InterruptedException { + + // APDU Script Request + if (request instanceof APDUScriptRequest) { + + gui.showWaitDialog("CardChannel"); + + Card icc = card.getCard(); + + if (icc == null) { + log.error("SignatureCard instance '" + card.getClass().getName() + "' does not support card management requests."); + return new ErrorResponse(1000); + } + + List script = ((APDUScriptRequest) request).getScript(); + ArrayList responses = new ArrayList(script.size()); + + try { + icc.beginExclusive(); + + for (RequestScriptElement scriptElement : script) { + if (scriptElement instanceof Command) { + Command command = (Command) scriptElement; + CommandAPDU commandAPDU = new CommandAPDU(command.getCommandAPDU()); + + CardChannel channel = icc.getBasicChannel(); + + sequenceNum = command.getSequence(); + log.debug("Transmit " + sequenceNum + " " + commandAPDU.toString()); + ResponseAPDU responseAPDU = channel.transmit(commandAPDU); + log.debug("" + responseAPDU); + + byte[] sw = new byte[] { + (byte) (0xFF & responseAPDU.getSW1()), + (byte) (0xFF & responseAPDU.getSW2()) }; + + responses.add(new Response(sequenceNum, responseAPDU.getData(), sw, 0)); + + if (command.getExpectedSW() != null && + !Arrays.equals(sw, command.getExpectedSW())) { + // unexpected SW + log.info("Got unexpected SW. APDU-script execution stopped."); + break; + } + + } else if (scriptElement instanceof Reset) { + + sequenceNum = 0; + card.reset(); + responses.add(new ATR(icc.getATR().getBytes())); + + } + + } + + } catch (CardException e) { + log.info("Failed to execute APDU script.", e); + responses.add(new Response(sequenceNum, null, null, Response.RC_UNSPECIFIED)); + } catch (SignatureCardException e) { + log.info("Failed to reset smart card.", e); + responses.add(new Response(sequenceNum, null, null, Response.RC_UNSPECIFIED)); + } finally { + try { + icc.endExclusive(); + } catch (CardException e) { + log.info(e); + } + } + + gui.showWaitDialog("wait for server..."); + return new APDUScriptResponse(responses); + + } else { + log.error("Got unexpected STAL request: " + request); + return new ErrorResponse(1000); + } + + } + + @Override + public boolean requireCard() { + return true; + } + +} diff --git a/BKUAppletExt/src/test/resources/appletTest.html b/BKUAppletExt/src/test/resources/appletTest.html new file mode 100644 index 00000000..f7a47d0a --- /dev/null +++ b/BKUAppletExt/src/test/resources/appletTest.html @@ -0,0 +1,34 @@ + + + +
+ + + + + + + + + + +
+ + \ No newline at end of file -- cgit v1.2.3 From d7fde6fc92f36a7cc8b8d412724951b12193bb9b Mon Sep 17 00:00:00 2001 From: clemenso Date: Wed, 11 Feb 2009 20:01:17 +0000 Subject: activation applet (NO PINMgmt yet) git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@295 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/nbactions.xml | 13 + .../java/at/gv/egiz/bku/gui/ActivationGUI.java | 249 ++++++++++++ .../at/gv/egiz/bku/gui/ActivationGUIFacade.java | 33 ++ .../main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java | 52 +++ .../java/at/gv/egiz/bku/gui/PINManagementGUI.java | 159 ++++++++ .../at/gv/egiz/bku/gui/PINManagementGUIFacade.java | 34 ++ .../java/at/gv/egiz/bku/gui/PINStatusProvider.java | 32 ++ .../egiz/bku/online/applet/ActivationApplet.java | 90 +++++ .../bku/online/applet/PINManagementApplet.java | 50 +++ .../bku/online/applet/PINManagementBKUWorker.java | 112 ++++++ .../egiz/bku/online/applet/ext/BKUAppletExt.java | 80 ---- .../bku/smccstal/ext/CardMgmtRequestHandler.java | 48 ++- .../bku/smccstal/ext/PINMgmtRequestHandler.java | 93 +++++ .../gv/egiz/bku/gui/ActivationMessages.properties | 24 ++ .../egiz/bku/gui/ActivationMessages_en.properties | 24 ++ .../java/at/gv/egiz/bku/gui/ActivationGuiTest.java | 62 +++ .../test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java | 204 ++++++++++ .../gv/egiz/bku/smccstal/ext/FileSystemTest.java | 434 +++++++++++++++++++++ BKUAppletExt/src/test/resources/appletTest.html | 4 +- 19 files changed, 1704 insertions(+), 93 deletions(-) create mode 100644 BKUAppletExt/nbactions.xml create mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUI.java create mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUIFacade.java create mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java create mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java create mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUIFacade.java create mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusProvider.java create mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java create mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java create mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ext/BKUAppletExt.java create mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PINMgmtRequestHandler.java create mode 100644 BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties create mode 100644 BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties create mode 100644 BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/ActivationGuiTest.java create mode 100644 BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java create mode 100644 BKUAppletExt/src/test/java/at/gv/egiz/bku/smccstal/ext/FileSystemTest.java (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/nbactions.xml b/BKUAppletExt/nbactions.xml new file mode 100644 index 00000000..286e3ba6 --- /dev/null +++ b/BKUAppletExt/nbactions.xml @@ -0,0 +1,13 @@ + + + + CUSTOM-PackageNoTests + PackageNoTests + + package + + + true + + + diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUI.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUI.java new file mode 100644 index 00000000..8134ac5f --- /dev/null +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUI.java @@ -0,0 +1,249 @@ +/* + * 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.gui; + +import java.awt.Container; +import java.awt.Cursor; +import java.awt.event.ActionListener; +import java.net.URL; +import java.text.MessageFormat; +import java.util.Locale; +import java.util.ResourceBundle; +import javax.swing.GroupLayout; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JProgressBar; +import javax.swing.LayoutStyle; +import javax.swing.SwingUtilities; + +/** + * + * @author Clemens Orthacker + */ +public class ActivationGUI extends CardMgmtGUI implements ActivationGUIFacade { + + public static final String TITLE_ACTIVATION = "title.activation"; + public static final String LABEL_ACTIVATION = "label.activation"; + public static final String LABEL_ACTIVATION_STEP = "label.activation.step"; + public static final String LABEL_ACTIVATION_IDLE = "label.activation.idle"; + + public static final String HELP_ACTIVATION = "help.activation"; + + protected JProgressBar progressBar; + + public ActivationGUI(Container contentPane, + Locale locale, + Style guiStyle, + URL backgroundImgURL, + AbstractHelpListener helpListener) { + super(contentPane, locale, guiStyle, backgroundImgURL, helpListener); + + progressBar = new JProgressBar(); + } + + @Override + public void showActivationProgressDialog(final int currentStep, final int maxProgress, final ActionListener cancelListener, final String cancelCommand) { + + log.debug("scheduling activation progress dialog (step " + currentStep + ")"); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + log.debug("show activation progress dialog (step " + currentStep + ")"); + + mainPanel.removeAll(); + buttonPanel.removeAll(); + + mainPanel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + + + JLabel infoLabel = new JLabel(); + infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + + if (renderHeaderPanel) { + titleLabel.setText(cardmgmtMessages.getString(TITLE_ACTIVATION)); + infoLabel.setText(cardmgmtMessages.getString(LABEL_ACTIVATION)); + } else { + infoLabel.setText(cardmgmtMessages.getString(TITLE_ACTIVATION)); + } + + helpListener.setHelpTopic(HELP_ACTIVATION); + + progressBar.setIndeterminate(false); + progressBar.setStringPainted(true); + progressBar.setString(null); //reset to percentage + progressBar.setMinimum(0); + progressBar.setMaximum(maxProgress); + + JLabel stepLabel = new JLabel(); + stepLabel.setFont(stepLabel.getFont().deriveFont(stepLabel.getFont().getStyle() & ~java.awt.Font.BOLD, stepLabel.getFont().getSize()-2)); + String stepPattern = cardmgmtMessages.getString(LABEL_ACTIVATION_STEP); + stepLabel.setText(MessageFormat.format(stepPattern, new Object[]{ currentStep })); + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + GroupLayout.SequentialGroup infoHorizontal = mainPanelLayout.createSequentialGroup().addComponent(infoLabel); + GroupLayout.ParallelGroup infoVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(infoLabel); + + if (!renderHeaderPanel) { + infoHorizontal.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE).addComponent(helpLabel); + infoVertical.addComponent(helpLabel); + } + + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(infoHorizontal) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(stepLabel) + .addComponent(progressBar))); + + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createSequentialGroup() + .addGroup(infoVertical) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(mainPanelLayout.createSequentialGroup() + .addComponent(stepLabel) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(progressBar))); + + JButton cancelButton = new JButton(); + cancelButton.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD)); + cancelButton.setText(messages.getString(BUTTON_CANCEL)); + cancelButton.addActionListener(cancelListener); + cancelButton.setActionCommand(cancelCommand); + + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); + + buttonPanelLayout.setHorizontalGroup( + buttonPanelLayout.createSequentialGroup() + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); + buttonPanelLayout.setVerticalGroup( + buttonPanelLayout.createSequentialGroup() + .addComponent(cancelButton)); + + contentPanel.validate(); + + } + }); + + } + + @Override + public void incrementProgress() { + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + progressBar.setValue(progressBar.getValue() + 1); + } + }); + + } + + @Override + public void showIdleDialog(final ActionListener cancelListener, final String cancelCommand) { + log.debug("scheduling idle dialog"); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + log.debug("show idle dialog"); + + mainPanel.removeAll(); + buttonPanel.removeAll(); + + mainPanel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + + + JLabel infoLabel = new JLabel(); + infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + + if (renderHeaderPanel) { + titleLabel.setText(cardmgmtMessages.getString(TITLE_ACTIVATION)); + infoLabel.setText(cardmgmtMessages.getString(LABEL_ACTIVATION)); + } else { + infoLabel.setText(cardmgmtMessages.getString(TITLE_ACTIVATION)); + } + + helpListener.setHelpTopic(HELP_ACTIVATION); + + progressBar.setIndeterminate(true); + progressBar.setStringPainted(true); + progressBar.setString(""); //not string painted progressbar is smaller + + JLabel stepLabel = new JLabel(); + stepLabel.setFont(stepLabel.getFont().deriveFont(stepLabel.getFont().getStyle() & ~java.awt.Font.BOLD, stepLabel.getFont().getSize()-2)); + stepLabel.setText(cardmgmtMessages.getString(LABEL_ACTIVATION_IDLE)); + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + GroupLayout.SequentialGroup infoHorizontal = mainPanelLayout.createSequentialGroup().addComponent(infoLabel); + GroupLayout.ParallelGroup infoVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(infoLabel); + + if (!renderHeaderPanel) { + infoHorizontal.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE).addComponent(helpLabel); + infoVertical.addComponent(helpLabel); + } + + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(infoHorizontal) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(stepLabel) + .addComponent(progressBar))); + + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createSequentialGroup() + .addGroup(infoVertical) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(mainPanelLayout.createSequentialGroup() + .addComponent(stepLabel) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(progressBar))); + + JButton cancelButton = new JButton(); + cancelButton.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD)); + cancelButton.setText(messages.getString(BUTTON_CANCEL)); + cancelButton.addActionListener(cancelListener); + cancelButton.setActionCommand(cancelCommand); + + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); + + buttonPanelLayout.setHorizontalGroup( + buttonPanelLayout.createSequentialGroup() + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); + buttonPanelLayout.setVerticalGroup( + buttonPanelLayout.createSequentialGroup() + .addComponent(cancelButton)); + + contentPanel.validate(); + + } + }); + + } +} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUIFacade.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUIFacade.java new file mode 100644 index 00000000..860a1097 --- /dev/null +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUIFacade.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.bku.gui; + +import java.awt.event.ActionListener; + +/** + * + * @author Clemens Orthacker + */ +public interface ActivationGUIFacade extends BKUGUIFacade { + + public void showActivationProgressDialog(int currentStep, int maxProgress, ActionListener cancelListener, String cancelCommand); + + public void incrementProgress(); + + public void showIdleDialog(ActionListener cancelListener, String cancelCommand); + +} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java new file mode 100644 index 00000000..4059f0e2 --- /dev/null +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java @@ -0,0 +1,52 @@ +/* + * 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.gui; + +import java.awt.Container; +import java.net.URL; +import java.util.Locale; +import java.util.ResourceBundle; + +/** + * Common superclass for Activation and PinManagement GUIs + * + * @author Clemens Orthacker + */ +public class CardMgmtGUI extends BKUGUIImpl { + + public static final String CARDMGMT_MESSAGES_BUNDLE = "at/gv/egiz/bku/gui/ActivationMessages"; + + protected ResourceBundle cardmgmtMessages; + + public CardMgmtGUI(Container contentPane, + Locale locale, + Style guiStyle, + URL backgroundImgURL, + AbstractHelpListener helpListener) { + super(contentPane, locale, guiStyle, backgroundImgURL, helpListener); + + if (locale != null) { + Locale lang = new Locale(locale.getLanguage().substring(0,2)); + log.debug("loading applet resources for language: " + lang.toString()); + cardmgmtMessages = ResourceBundle.getBundle(CARDMGMT_MESSAGES_BUNDLE, lang); + } else { + cardmgmtMessages = ResourceBundle.getBundle(CARDMGMT_MESSAGES_BUNDLE); + } + + } +} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java new file mode 100644 index 00000000..8acf051e --- /dev/null +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java @@ -0,0 +1,159 @@ +/* + * 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.gui; + +import java.awt.Container; +import java.awt.event.ActionListener; +import java.net.URL; +import java.util.Locale; +import javax.swing.GroupLayout; +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.LayoutStyle; +import javax.swing.SwingUtilities; + +/** + * TODO pull out ResourceBundle to common superclass for activationGUI and pinMgmtGUI + * @author Clemens Orthacker + */ +public class PINManagementGUI extends ActivationGUI implements PINManagementGUIFacade { + + public static final String BUTTON_ACTIVATE = "button.activate"; + public static final String BUTTON_UNBLOCK = "button.unblock"; + public static final String BUTTON_CHANGE = "button.change"; + + public PINManagementGUI(Container contentPane, + Locale locale, + Style guiStyle, + URL backgroundImgURL, + AbstractHelpListener helpListener) { + super(contentPane, locale, guiStyle, backgroundImgURL, helpListener); + } + + @Override + public void showPINManagementDialog(final PINStatusProvider pinStatusProvider, + final ActionListener activateListener, final String activateCmd, + final ActionListener changeListener, final String changeCmd, + final ActionListener unblockListener, final String unblockCmd, + final ActionListener cancelListener, final String cancelCmd) { +// try { + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + log.debug("show PIN management dialog"); + + mainPanel.removeAll(); + buttonPanel.removeAll(); + + helpListener.setHelpTopic(HELP_PINMGMT); + + JLabel mgmtLabel = new JLabel(); + mgmtLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + + if (renderHeaderPanel) { + titleLabel.setText(cardmgmtMessages.getString(TITLE_PINMGMT)); + mgmtLabel.setText(cardmgmtMessages.getString(MESSAGE_PINMGMT)); + } else { + mgmtLabel.setText(cardmgmtMessages.getString(TITLE_PINMGMT)); + } + + + + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + GroupLayout.SequentialGroup messageHorizontal = mainPanelLayout.createSequentialGroup() + .addComponent(mgmtLabel); + GroupLayout.Group messageVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(mgmtLabel); + if (!renderHeaderPanel) { + messageHorizontal + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) + .addComponent(helpLabel); + messageVertical + .addComponent(helpLabel); + } + + mainPanelLayout.setHorizontalGroup(messageHorizontal); + mainPanelLayout.setVerticalGroup(messageVertical); + + + JButton activateButton = new JButton(); + activateButton.setFont(activateButton.getFont().deriveFont(activateButton.getFont().getStyle() & ~java.awt.Font.BOLD)); + activateButton.setText(cardmgmtMessages.getString(BUTTON_ACTIVATE)); + activateButton.setEnabled(true);//false); + activateButton.setActionCommand(activateCmd); + activateButton.addActionListener(activateListener); + + JButton changeButton = new JButton(); + changeButton.setFont(activateButton.getFont().deriveFont(activateButton.getFont().getStyle() & ~java.awt.Font.BOLD)); + changeButton.setText(cardmgmtMessages.getString(BUTTON_CHANGE)); + changeButton.setEnabled(false); + changeButton.setActionCommand(changeCmd); + changeButton.addActionListener(changeListener); + + JButton unblockButton = new JButton(); + unblockButton.setFont(activateButton.getFont().deriveFont(activateButton.getFont().getStyle() & ~java.awt.Font.BOLD)); + unblockButton.setText(cardmgmtMessages.getString(BUTTON_UNBLOCK)); + unblockButton.setEnabled(false); + unblockButton.setActionCommand(unblockCmd); + unblockButton.addActionListener(unblockListener); + + JButton cancelButton = new JButton(); + cancelButton.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD)); + cancelButton.setText(messages.getString(BUTTON_CANCEL)); + cancelButton.setActionCommand(cancelCmd); + cancelButton.addActionListener(cancelListener); + + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); + + GroupLayout.SequentialGroup buttonHorizontal = buttonPanelLayout.createSequentialGroup() + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(activateButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(changeButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(unblockButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE); + + GroupLayout.Group buttonVertical = buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(activateButton) + .addComponent(changeButton) + .addComponent(unblockButton) + .addComponent(cancelButton); + + buttonPanelLayout.setHorizontalGroup(buttonHorizontal); + buttonPanelLayout.setVerticalGroup(buttonVertical); + + contentPanel.validate(); + + } + }); + +// } catch (Exception ex) { +// log.error(ex.getMessage(), ex); +// showErrorDialog(ERR_UNKNOWN_WITH_PARAM, new Object[] {ex.getMessage()}); +// } + } + + +} 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 new file mode 100644 index 00000000..3d653fab --- /dev/null +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUIFacade.java @@ -0,0 +1,34 @@ +/* + * 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.gui; + +import java.awt.event.ActionListener; + +/** + * + * @author Clemens Orthacker + */ +public interface PINManagementGUIFacade extends BKUGUIFacade { + + public static final String HELP_PINMGMT = "help.pin.mgmt"; + public static final String TITLE_PINMGMT = "title.pin.mgmt"; + public static final String MESSAGE_PINMGMT = "message.pin.mgmt"; + + public void showPINManagementDialog(PINStatusProvider pinStatusProvider, ActionListener activateListener, String activateCmd, ActionListener changeListener, String changeCmd, ActionListener unblockListener, String unblockCmd, ActionListener cancelListener, String cancelCmd); + +} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusProvider.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusProvider.java new file mode 100644 index 00000000..73fa0920 --- /dev/null +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusProvider.java @@ -0,0 +1,32 @@ +/* + * 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.gui; + +import at.gv.egiz.smcc.SignatureCardException; + +/** + * + * @author Clemens Orthacker + */ +public interface PINStatusProvider { + + public enum STATUS { ACTIV, NOT_ACTIV, BLOCKED }; + + public STATUS getPINStatus(int pin) throws SignatureCardException; + +} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java new file mode 100644 index 00000000..68f0cb72 --- /dev/null +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java @@ -0,0 +1,90 @@ +/* + * 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.online.applet; + +import at.gv.egiz.bku.gui.AbstractHelpListener; +import at.gv.egiz.bku.gui.ActivationGUI; +import at.gv.egiz.bku.gui.BKUGUIFacade; +import at.gv.egiz.bku.gui.BKUGUIFacade.Style; +import at.gv.egiz.bku.online.applet.BKUApplet; +import at.gv.egiz.bku.smccstal.AbstractSMCCSTAL; +import at.gv.egiz.bku.smccstal.ext.CardMgmtRequestHandler; +import at.gv.egiz.stal.ext.APDUScriptRequest; +import at.gv.egiz.stal.service.STALPortType; +import at.gv.egiz.stal.service.translator.STALTranslator; +import at.gv.egiz.stalx.service.STALService; +import at.gv.egiz.stalx.service.translator.STALXTranslationHandler; +import java.awt.Container; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Locale; +import javax.xml.namespace.QName; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * + * @author Clemens Orthacker + */ +public class ActivationApplet extends BKUApplet { + + private static final long serialVersionUID = 1L; + private static Log log = LogFactory.getLog(ActivationApplet.class); + + @Override + public void init() { + super.init(); + if (worker instanceof AbstractSMCCSTAL) { + CardMgmtRequestHandler handler = new CardMgmtRequestHandler(); + ((AbstractSMCCSTAL) worker).addRequestHandler(APDUScriptRequest.class, handler); + log.debug("Registered CardMgmtRequestHandler"); + } else { + log.warn("Cannot register CardMgmtRequestHandler."); + } + } + + /** + * creates a STAL-X enabled webservice port + * @return + * @throws java.net.MalformedURLException + */ + @Override + public STALPortType getSTALPort() throws MalformedURLException { + URL wsdlURL = getURLParameter(WSDL_URL, null); + log.debug("setting STAL WSDL: " + wsdlURL); + QName endpointName = new QName(STAL_WSDL_NS, STAL_SERVICE); + log.info("creating STAL-X enabled webservice port"); + STALService stal = new STALService(wsdlURL, endpointName); + return stal.getSTALPort(); + } + + @Override + public STALTranslator getSTALTranslator() { + STALTranslator translator = super.getSTALTranslator(); + translator.registerTranslationHandler(new STALXTranslationHandler()); + return translator; + } + + @Override + protected BKUGUIFacade createGUI(Container contentPane, + Locale locale, + Style guiStyle, + URL backgroundImgURL, + AbstractHelpListener helpListener) { + return new ActivationGUI(contentPane, locale, guiStyle, backgroundImgURL, helpListener); + } +} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java new file mode 100644 index 00000000..72d06618 --- /dev/null +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java @@ -0,0 +1,50 @@ +/* + * 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.online.applet; + +import at.gv.egiz.bku.gui.AbstractHelpListener; +import at.gv.egiz.bku.gui.BKUGUIFacade; +import at.gv.egiz.bku.gui.PINManagementGUI; +import java.awt.Container; +import java.net.URL; +import java.util.Locale; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * + * @author Clemens Orthacker + */ +public class PINManagementApplet extends BKUApplet { + + private static final long serialVersionUID = 1L; + private static Log log = LogFactory.getLog(PINManagementApplet.class); + + @Override + protected BKUGUIFacade createGUI(Container contentPane, + Locale locale, + BKUGUIFacade.Style guiStyle, + URL backgroundImgURL, + AbstractHelpListener helpListener) { + return new PINManagementGUI(contentPane, locale, guiStyle, backgroundImgURL, helpListener); + } + + @Override + protected AppletBKUWorker createBKUWorker(BKUApplet applet, BKUGUIFacade gui) { + return new PINManagementBKUWorker(applet, gui); + } +} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java new file mode 100644 index 00000000..e65d98ca --- /dev/null +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java @@ -0,0 +1,112 @@ +/* + * 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.online.applet; + +import at.gv.egiz.bku.gui.BKUGUIFacade; +import at.gv.egiz.bku.gui.PINManagementGUIFacade; +import at.gv.egiz.bku.smccstal.ext.PINMgmtRequestHandler; +import at.gv.egiz.stal.STALResponse; +import at.gv.egiz.stal.ext.ActivatePINRequest; +import at.gv.egiz.stal.ext.ChangePINRequest; +import at.gv.egiz.stal.ext.UnblockPINRequest; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * + * @author Clemens Orthacker + */ +public class PINManagementBKUWorker extends AppletBKUWorker { + + protected PINMgmtRequestHandler handler = new PINMgmtRequestHandler(); + protected PINManagementActionListener listener = new PINManagementActionListener(); + + public PINManagementBKUWorker(BKUApplet applet, BKUGUIFacade gui) { + super(applet, gui); + handlerMap.clear(); +// PINMgmtRequestHandler handler = new PINMgmtRequestHandler(); +// addRequestHandler(ActivatePINRequest.class, handler); +// addRequestHandler(ChangePINRequest.class, handler); +// addRequestHandler(UnblockPINRequest.class, handler); + } + + @Override + public void run() { + gui.showWelcomeDialog(); + + try { + + if (waitForCard()) { + gui.showErrorDialog("no card, canceled PIN mgmt dialog", null); + } + + actionCommandList.clear(); + actionCommandList.add("cancel"); + + ((PINManagementGUIFacade) gui).showPINManagementDialog(handler, + listener, "activate", + listener, "change", + listener, "unblock", + this, "cancel"); + + waitForAction(); + + } catch (Exception ex) { + log.error(ex.getMessage(), ex); + showErrorDialog(BKUGUIFacade.ERR_UNKNOWN_WITH_PARAM, ex); + } finally { + if (signatureCard != null) { + signatureCard.disconnect(false); + } + } + + applet.sendRedirect(sessionId); + } + + protected class PINManagementActionListener implements ActionListener { + + @Override + public void actionPerformed(ActionEvent e) { + try { + String cmd = e.getActionCommand(); + if ("activate".equals(cmd)) { + //create STAL request, call handle(req) + ActivatePINRequest stalReq = new ActivatePINRequest(); + STALResponse stalResp = handler.handleRequest(stalReq); + gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN_WITH_PARAM, new Object[]{"debug"}, this, "back"); + } else if ("change".equals(cmd)) { + } else if ("unblock".equals(cmd)) { + } else if ("back".equals(cmd)) { + + ((PINManagementGUIFacade) gui).showPINManagementDialog(handler, + this, "activate", + this, "change", + this, "unblock", + PINManagementBKUWorker.this, "cancel"); + + } + } catch (InterruptedException ex) { + log.fatal(ex); + } + } + } +} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ext/BKUAppletExt.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ext/BKUAppletExt.java deleted file mode 100644 index d9df5536..00000000 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ext/BKUAppletExt.java +++ /dev/null @@ -1,80 +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.online.applet.ext; - -import at.gv.egiz.stal.service.translator.STALTranslator; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import at.gv.egiz.bku.online.applet.BKUApplet; -import at.gv.egiz.bku.smccstal.AbstractBKUWorker; -import at.gv.egiz.bku.smccstal.ext.CardMgmtRequestHandler; -import at.gv.egiz.stal.ext.APDUScriptRequest; -import at.gv.egiz.stal.service.STALPortType; -import at.gv.egiz.stalx.service.STALService; -import at.gv.egiz.stalx.service.translator.STALXTranslationHandler; -import java.net.MalformedURLException; -import java.net.URL; -import javax.xml.namespace.QName; - -/** - * @author mcentner - */ -public class BKUAppletExt extends BKUApplet { - - private static final long serialVersionUID = 1L; - private static Log log = LogFactory.getLog(BKUAppletExt.class); - - @Override - public void init() { - super.init(); - if (worker instanceof AbstractBKUWorker) { - CardMgmtRequestHandler handler = new CardMgmtRequestHandler(); - ((AbstractBKUWorker) worker).addRequestHandler(APDUScriptRequest.class, handler); - log.debug("Registered CardMgmtRequestHandler"); - } else { - log.warn("Cannot register CardMgmtRequestHandler."); - } - } - - /** - * creates a STAL-X enabled webservice port - * @return - * @throws java.net.MalformedURLException - */ - @Override - protected STALPortType getSTALPort() throws MalformedURLException { - URL wsdlURL = getURLParameter(WSDL_URL, null); - log.debug("setting STAL WSDL: " + wsdlURL); - QName endpointName = new QName(STAL_WSDL_NS, STAL_SERVICE); - log.info("creating STAL-X enabled webservice port"); - STALService stal = new STALService(wsdlURL, endpointName); - return stal.getSTALPort(); - } - - @Override - protected STALTranslator getSTALTranslator() { - STALTranslator translator = super.getSTALTranslator(); - translator.registerTranslationHandler(new STALXTranslationHandler()); - return translator; - } - - -} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/CardMgmtRequestHandler.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/CardMgmtRequestHandler.java index f499de7e..769342e7 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/CardMgmtRequestHandler.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/CardMgmtRequestHandler.java @@ -19,6 +19,7 @@ */ package at.gv.egiz.bku.smccstal.ext; +import at.gv.egiz.bku.gui.ActivationGUIFacade; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -45,12 +46,13 @@ import at.gv.egiz.stal.ext.APDUScriptRequest.Reset; import at.gv.egiz.stal.ext.APDUScriptResponse.Response; import at.gv.egiz.stal.ext.APDUScriptResponse.ATR; import at.gv.egiz.stal.ext.APDUScriptResponse.ResponseScriptElement; +import java.awt.event.ActionListener; /** * @author mcentner * */ -public class CardMgmtRequestHandler extends AbstractRequestHandler { +public class CardMgmtRequestHandler extends AbstractRequestHandler implements ActionListener { /** * Logging facility. @@ -61,7 +63,12 @@ public class CardMgmtRequestHandler extends AbstractRequestHandler { * The sequence counter. */ private int sequenceNum = 0; - + + /** + * display script num + */ + private int currentActivationScript = 0; + @Override public STALResponse handleRequest(STALRequest request) throws InterruptedException { @@ -69,7 +76,8 @@ public class CardMgmtRequestHandler extends AbstractRequestHandler { // APDU Script Request if (request instanceof APDUScriptRequest) { - gui.showWaitDialog("CardChannel"); + currentActivationScript++; + log.debug("handling APDU script " + currentActivationScript); Card icc = card.getCard(); @@ -81,20 +89,28 @@ public class CardMgmtRequestHandler extends AbstractRequestHandler { List script = ((APDUScriptRequest) request).getScript(); ArrayList responses = new ArrayList(script.size()); + ((ActivationGUIFacade) gui).showActivationProgressDialog(currentActivationScript, script.size(), this, "cancel"); + try { + log.trace("begin exclusive"); icc.beginExclusive(); for (RequestScriptElement scriptElement : script) { + ((ActivationGUIFacade) gui).incrementProgress(); + if (scriptElement instanceof Command) { + log.trace("handling APDU script element COMMAND"); Command command = (Command) scriptElement; CommandAPDU commandAPDU = new CommandAPDU(command.getCommandAPDU()); - + + log.trace("get basicchannel"); CardChannel channel = icc.getBasicChannel(); sequenceNum = command.getSequence(); - log.debug("Transmit " + sequenceNum + " " + commandAPDU.toString()); + log.debug("Transmit APDU (sequence=" + sequenceNum + ")"); + log.trace(commandAPDU.toString()); ResponseAPDU responseAPDU = channel.transmit(commandAPDU); - log.debug("" + responseAPDU); + log.trace(responseAPDU.toString()); byte[] sw = new byte[] { (byte) (0xFF & responseAPDU.getSW1()), @@ -105,16 +121,22 @@ public class CardMgmtRequestHandler extends AbstractRequestHandler { if (command.getExpectedSW() != null && !Arrays.equals(sw, command.getExpectedSW())) { // unexpected SW - log.info("Got unexpected SW. APDU-script execution stopped."); + log.warn("Got unexpected SW. APDU-script execution stopped."); break; } } else if (scriptElement instanceof Reset) { - + + log.trace("handling APDU script element RESET"); sequenceNum = 0; card.reset(); - responses.add(new ATR(icc.getATR().getBytes())); - + javax.smartcardio.ATR atr = icc.getATR(); + log.trace("got ATR: " + atr.toString()); + responses.add(new ATR(atr.getBytes())); + + log.trace("regain exclusive access to card"); + icc = card.getCard(); + icc.beginExclusive(); } } @@ -125,6 +147,9 @@ public class CardMgmtRequestHandler extends AbstractRequestHandler { } catch (SignatureCardException e) { log.info("Failed to reset smart card.", e); responses.add(new Response(sequenceNum, null, null, Response.RC_UNSPECIFIED)); + } catch (RuntimeException e) { + log.error(e); + throw e; } finally { try { icc.endExclusive(); @@ -133,7 +158,8 @@ public class CardMgmtRequestHandler extends AbstractRequestHandler { } } - gui.showWaitDialog("wait for server..."); + log.trace("done handling APDU script " + currentActivationScript + ", return response containing " + responses.size() + " elements"); + ((ActivationGUIFacade) gui).showIdleDialog(this, "cancel"); return new APDUScriptResponse(responses); } else { diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PINMgmtRequestHandler.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PINMgmtRequestHandler.java new file mode 100644 index 00000000..b2d34ff2 --- /dev/null +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PINMgmtRequestHandler.java @@ -0,0 +1,93 @@ +/* + * 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.PINStatusProvider; +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; +import at.gv.egiz.stal.STALResponse; +import at.gv.egiz.stal.ext.ActivatePINRequest; +import at.gv.egiz.stal.ext.ChangePINRequest; +import at.gv.egiz.stal.ext.UnblockPINRequest; +import java.util.logging.Level; +import java.util.logging.Logger; +import javax.smartcardio.Card; +import javax.smartcardio.CardChannel; +import javax.smartcardio.CardException; +import javax.smartcardio.CommandAPDU; +import javax.smartcardio.ResponseAPDU; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * + * @author Clemens Orthacker + */ +public class PINMgmtRequestHandler extends AbstractRequestHandler implements PINStatusProvider { + + protected static final Log log = LogFactory.getLog(PINMgmtRequestHandler.class); + + @Override + public STALResponse handleRequest(STALRequest request) throws InterruptedException { + if (request instanceof ActivatePINRequest) { + log.error("not implemented yet"); + return new ErrorResponse(1000); + + } else if (request instanceof ChangePINRequest) { + log.error("not implemented yet"); + return new ErrorResponse(1000); + + } else if (request instanceof UnblockPINRequest) { + log.error("not implemented yet"); + return new ErrorResponse(1000); + + } else { + log.error("Got unexpected STAL request: " + request); + return new ErrorResponse(1000); + } + } + + @Override + public boolean requireCard() { + return true; + } + + @Override + public STATUS getPINStatus(int pin) throws SignatureCardException { + try { + Card icc = card.getCard(); + icc.beginExclusive(); + CardChannel channel = icc.getBasicChannel(); + CommandAPDU verifyAPDU = new CommandAPDU(new byte[] {(byte) 0x00} ); + ResponseAPDU responseAPDU = channel.transmit(verifyAPDU); + byte sw1 = (byte) responseAPDU.getSW1(); + byte[] sw = new byte[] { + (byte) (0xFF & responseAPDU.getSW1()), + (byte) (0xFF & responseAPDU.getSW2()) }; + + icc.endExclusive(); + return STATUS.ACTIV; + } catch (CardException ex) { + log.error("Failed to get PIN status: " + ex.getMessage()); + throw new SignatureCardException("Failed to get PIN status", ex); + } + } + +} diff --git a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties new file mode 100644 index 00000000..469af15f --- /dev/null +++ b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties @@ -0,0 +1,24 @@ +# 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. + +title.activation=Aktivierung +title.pin.mgmt=PIN Verwaltung +message.pin.mgmt=under construction +label.activation=e-card Aktivierungsprozess +label.activation.step=Schritt {0} +label.activation.idle=Warte auf Server... +button.activate=Aktivieren +button.change=\u00C4ndern +button.unblock=Entsperren \ No newline at end of file diff --git a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties new file mode 100644 index 00000000..16ac7d0b --- /dev/null +++ b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties @@ -0,0 +1,24 @@ +# 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. + +title.activation=Aktivation +title.pin.mgmt=PIN Management +message.pin.mgmt=under construction +label.activation=e-card activation process +label.activation.step=Step {0} +label.activation.idle=Wait for server... +button.activate=Activate +button.change=Change +button.unblock=Unblock \ No newline at end of file diff --git a/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/ActivationGuiTest.java b/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/ActivationGuiTest.java new file mode 100644 index 00000000..95c5c678 --- /dev/null +++ b/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/ActivationGuiTest.java @@ -0,0 +1,62 @@ +/* +* 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. +*/ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package at.gv.egiz.bku.gui; + +import java.awt.Container; +import java.awt.Dimension; +import javax.swing.JFrame; +import org.junit.Ignore; +import org.junit.Test; + + +/** + * + * @author clemens + */ +@Ignore +public class ActivationGuiTest { + + @Test + public void testBKUGUI() { + JFrame testFrame = new JFrame("BKUGUITest"); + Container contentPane = testFrame.getContentPane(); + contentPane.setPreferredSize(new Dimension(152, 145)); +// contentPane.setPreferredSize(new Dimension(300, 190)); + ActivationGUIFacade gui = new ActivationGUI(contentPane, null, BKUGUIFacade.Style.tiny, null, null); + BKUGUIWorker worker = new BKUGUIWorker(); + worker.init(gui); + testFrame.pack(); + testFrame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + testFrame.setVisible(true); + new Thread(worker).start(); + + while(true) ; + } + + @Test + public void dummyTest() { + } + +// public static void main(String[] args) { +// new BKUGUITest().testBKUGUI(); +// } +} diff --git a/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java new file mode 100644 index 00000000..669a63fc --- /dev/null +++ b/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java @@ -0,0 +1,204 @@ +/* + * 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. + */ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package at.gv.egiz.bku.gui; + +import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.stal.HashDataInput; +import at.gv.egiz.stal.impl.ByteArrayHashDataInput; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; + +/** + * + * @author clemens + */ +public class BKUGUIWorker implements Runnable { + + ActivationGUIFacade gui; + + public void init(ActivationGUIFacade gui) { + this.gui = gui; + } + + @Override + public void run() { + try { + + final PINSpec signPinSpec = new PINSpec(6, 10, "[0-9]", "Signatur-PIN"); + + + final ActionListener cancelListener = new ActionListener() { + + public void actionPerformed(ActionEvent e) { + System.out.println("CANCEL EVENT OCCURED: " + e); + } + }; + ActionListener okListener = new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + System.out.println("OK EVENT OCCURED: " + e); + } + }; + final ActionListener signListener = new ActionListener() { + + public void actionPerformed(ActionEvent e) { + System.out.println("SIGN EVENT OCCURED: " + e); + } + }; + ActionListener hashdataListener = new ActionListener() { + + public void actionPerformed(ActionEvent e) { + System.out.println("HASHDATA EVENT OCCURED: " + e); + ActionListener returnListener = new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", null, "hashdata"); + } + }; + HashDataInput signedRef1 = new ByteArrayHashDataInput( + "Ich bin ein einfacher Text mit Umlauten: öäüßéç@€\n123\n456\n\tHello, world!\n\nlkjsd\nnksdjf".getBytes(), + "ref-id-0000000000000000000000001", + "text/plain", + "UTF-8"); + + HashDataInput signedRef2 = new ByteArrayHashDataInput( + "HashDataInput_002".getBytes(), + "ref-id-000000002", + "application/xhtml+xml", + "UTF-8"); + + HashDataInput signedRef3 = new ByteArrayHashDataInput( + "HashDataInput_003".getBytes(), + "ref-id-000000003", + "application/xhtml+xml", + "UTF-8"); + + HashDataInput signedRef4 = new ByteArrayHashDataInput( + "HashDataInput_004".getBytes(), + "ref-id-000000004", + "text/xml", + "UTF-8"); + + // + List signedRefs = new ArrayList(); + signedRefs.add(signedRef1); + signedRefs.add(signedRef2); + signedRefs.add(signedRef3); + signedRefs.add(signedRef4); +// signedRefs.add(signedRef4); +// signedRefs.add(signedRef4); +// signedRefs.add(signedRef4); +// signedRefs.add(signedRef4); +// signedRefs = Collections.singletonList(signedRef1); + gui.showHashDataInputDialog(signedRefs, returnListener, "return"); + } + }; + + + +// gui.showWelcomeDialog(); +// +// Thread.sleep(2000); +// +// gui.showWaitDialog(null); +// +// Thread.sleep(1000); +// +// gui.showWaitDialog("test"); +// +// Thread.sleep(1000); +// +// +// gui.showInsertCardDialog(cancelListener, "cancel"); +// +// Thread.sleep(2000); +// +// gui.showCardNotSupportedDialog(cancelListener, "cancel"); +// +// Thread.sleep(2000); +// +// PINSpec cardPinSpec = new PINSpec(4, 4, "[0-9]", "Karten-PIN"); +// +// gui.showCardPINDialog(cardPinSpec, okListener, "ok", cancelListener, "cancel"); +// +// Thread.sleep(2000); +// +// gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata"); +// +// Thread.sleep(4000); +// + +// gui.showErrorDialog(BKUGUIFacade.ERR_NO_PCSC, null, null, null); + +// gui.showSignaturePINRetryDialog(signPinSpec, 2, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata"); +// +// Thread.sleep(2000); +// +// gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, new Object[] {"Testfehler"}, null, null); +// +// Thread.sleep(2000); +// +// gui.showErrorDialog("error.test", new Object[] {"Testfehler", "noch ein TestFehler"}); +// +// Thread.sleep(2000); +// +// gui.showErrorDialog("error.no.hashdata", null); +// +// Thread.sleep(2000); +// +// gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, new Object[] {"Testfehler"}); +// +// Thread.sleep(2000); +// +// gui.showErrorDialog("error.unknown", null); + + gui.showActivationProgressDialog(1, 3, null, null); + + gui.incrementProgress(); + + Thread.sleep(1000); + + gui.incrementProgress(); + + Thread.sleep(1000); + + gui.incrementProgress(); + + + Thread.sleep(1000); + + gui.showIdleDialog(null, null); + +// gui.showTextPlainHashDataInput("hallo,\n welt!", "12345", null, "cancel", null, "save"); +// gui.showTextPlainHashDataInput("hallo,\n welt!", "12345", null, "cancel", null, "save"); +// Thread.sleep(2000); + + } catch (InterruptedException ex) { + ex.printStackTrace(); + } + } +} diff --git a/BKUAppletExt/src/test/java/at/gv/egiz/bku/smccstal/ext/FileSystemTest.java b/BKUAppletExt/src/test/java/at/gv/egiz/bku/smccstal/ext/FileSystemTest.java new file mode 100644 index 00000000..8d8b0385 --- /dev/null +++ b/BKUAppletExt/src/test/java/at/gv/egiz/bku/smccstal/ext/FileSystemTest.java @@ -0,0 +1,434 @@ +/* + * 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.FileNotFoundException; +import at.gv.egiz.smcc.LockedException; +import at.gv.egiz.smcc.NotActivatedException; +import at.gv.egiz.smcc.PINProvider; +import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.SignatureCard; +import at.gv.egiz.smcc.SignatureCardException; +import at.gv.egiz.smcc.util.SMCCHelper; +import at.gv.egiz.smcc.util.SmartCardIO; +import java.math.BigInteger; +import java.nio.ByteBuffer; +import java.util.Arrays; +import java.util.Locale; +import java.util.Map; +import javax.smartcardio.Card; +import javax.smartcardio.CardChannel; +import javax.smartcardio.CardException; +import javax.smartcardio.CardTerminal; +import javax.smartcardio.CommandAPDU; +import javax.smartcardio.ResponseAPDU; +import org.junit.Ignore; +import org.junit.Test; +import static org.junit.Assert.*; + +/** + * + * @author Clemens Orthacker + */ +public class FileSystemTest { + + /** asign premium */ + public static final byte[] AID_DEC = new byte[] { (byte) 0xA0, (byte) 0x00, + (byte) 0x00, (byte) 0x01, (byte) 0x18, (byte) 0x45, (byte) 0x4E }; + + @Test +// @Ignore + public void testCard() throws CardException, SignatureCardException, InterruptedException { + + SMCCHelper smccHelper = new SMCCHelper(); + switch (smccHelper.getResultCode()) { + case SMCCHelper.CARD_FOUND: + System.out.println("card found "); + } + SignatureCard signatureCard = smccHelper.getSignatureCard(new Locale("de")); + Card card = signatureCard.getCard(); + +// SmartCardIO scIO = new SmartCardIO(); +// Map terminalCardMap = scIO.getCards(); +// +// for (CardTerminal ct : terminalCardMap.keySet()) { +// Card card = terminalCardMap.get(ct); +// System.out.println("found card (" + ct.getName() + "): " + Formatter.byteArrayToHexString(card.getATR().getBytes())); + + System.out.println("found card " + Formatter.byteArrayToHexString(card.getATR().getBytes())); + + CardChannel cardchannel; + + //RESET + System.out.println("RESET"); + signatureCard.reset(); + card = signatureCard.getCard(); +// card.disconnect(true); +// card = ct.connect("*"); + + System.out.println("begin exclusive"); + card.beginExclusive(); + System.out.println("get cardchannel"); + cardchannel = card.getBasicChannel(); + + testECard(cardchannel, signatureCard, card); +// testASignPremium(cardchannel, signatureCard, card); + +// } + + } + + public static class TestCard { + + protected CardChannel channel; + protected int ifs_ = 254; + + public TestCard(CardChannel channel) { + this.channel = channel; + } + + protected byte[] readTLVFile(byte[] aid, byte[] ef, String pin, byte kid, int maxLength) + throws SignatureCardException, InterruptedException, CardException { + + + // SELECT FILE (AID) + selectFileAID(aid); + + // SELECT FILE (EF) + ResponseAPDU resp = selectFileFID(ef); + if (resp.getSW() == 0x6a82) { + // EF not found + throw new FileNotFoundException("EF " + toString(ef) + " not found."); + } else if (resp.getSW() != 0x9000) { + throw new SignatureCardException("SELECT FILE with " + "FID=" + toString(ef) + " failed (" + "SW=" + Integer.toHexString(resp.getSW()) + ")."); + } + + // VERIFY + if (pin != null) { + int retries = verifyPIN(pin, kid); + if (retries != -1) { + throw new at.gv.egiz.smcc.VerificationFailedException(retries); + } + } + + return readBinaryTLV(maxLength, (byte) 0x30); + } + + protected byte[] readBinary(CardChannel channel, int offset, int len) + throws CardException, SignatureCardException { + + //transmit(channel,apdu) + ResponseAPDU resp = channel.transmit(new CommandAPDU(0x00, 0xB0, + 0x7F & (offset >> 8), offset & 0xFF, len)); + if (resp.getSW() == 0x9000) { + return resp.getData(); + } else if (resp.getSW() == 0x6982) { + throw new at.gv.egiz.smcc.SecurityStatusNotSatisfiedException(); + } else { + throw new SignatureCardException("Failed to read bytes (" + offset + "+" + len + "): SW=" + Integer.toHexString(resp.getSW())); + } + + } + + protected byte[] readBinaryTLV(int maxSize, byte expectedType) throws CardException, + SignatureCardException { + +// CardChannel channel = getCardChannel(); + + // read first chunk + int len = Math.min(maxSize, ifs_); + byte[] chunk = readBinary(channel, 0, len); + if (chunk.length > 0 && chunk[0] != expectedType) { + return null; + } + int offset = chunk.length; + int actualSize = maxSize; + if (chunk.length > 3) { + if ((chunk[1] & 0x80) > 0) { + int octets = (0x0F & chunk[1]); + actualSize = 2 + octets; + for (int i = 1; i <= octets; i++) { + actualSize += (0xFF & chunk[i + 1]) << ((octets - i) * 8); + } + } else { + actualSize = 2 + chunk[1]; + } + } + ByteBuffer buffer = ByteBuffer.allocate(actualSize); + buffer.put(chunk, 0, Math.min(actualSize, chunk.length)); + while (offset < actualSize) { + len = Math.min(ifs_, actualSize - offset); + chunk = readBinary(channel, offset, len); + buffer.put(chunk); + offset += chunk.length; + } + return buffer.array(); + + } + + protected byte[] selectFileAID(byte[] dfName) throws CardException, SignatureCardException { +// CardChannel channel = getCardChannel(); + ResponseAPDU resp = channel.transmit(new CommandAPDU(0x00, 0xA4, 0x04, + 0x00, dfName, 256)); + if (resp.getSW() != 0x9000) { + throw new SignatureCardException("Failed to select application AID=" + toString(dfName) + ": SW=" + Integer.toHexString(resp.getSW()) + "."); + } else { + return resp.getBytes(); + } + } + + protected ResponseAPDU selectFileFID(byte[] fid) throws CardException, SignatureCardException { +// CardChannel channel = getCardChannel(); + return channel.transmit(new CommandAPDU(0x00, 0xA4, 0x02, + 0x04, fid, 256)); + } + + protected String toString(byte[] b) { + StringBuffer sb = new StringBuffer(); + if (b != null && b.length > 0) { + sb.append(Integer.toHexString((b[0] & 240) >> 4)); + sb.append(Integer.toHexString(b[0] & 15)); + } + for (int i = 1; i < b.length; i++) { + sb.append(':'); + sb.append(Integer.toHexString((b[i] & 240) >> 4)); + sb.append(Integer.toHexString(b[i] & 15)); + } + return sb.toString(); + } + + protected int verifyPIN(String pin, byte kid) throws CardException, SignatureCardException { + +// CardChannel channel = getCardChannel(); + + ResponseAPDU resp; + if (pin == null) { + // + resp = channel.transmit(new CommandAPDU(0x00, 0x20, 0x00, kid)); + } else { + // PIN length in bytes + int len = (int) Math.ceil(pin.length() / 2); + + // BCD encode PIN and marshal PIN block + byte[] pinBytes = new BigInteger(pin, 16).toByteArray(); + byte[] pinBlock = new byte[8]; + if (len < pinBytes.length) { + System.arraycopy(pinBytes, pinBytes.length - len, pinBlock, 1, len); + } else { + System.arraycopy(pinBytes, 0, pinBlock, len - pinBytes.length + 1, + pinBytes.length); + } + pinBlock[0] = (byte) (0x20 + len * 2); + Arrays.fill(pinBlock, len + 1, 8, (byte) 0xff); + + resp = channel.transmit(new CommandAPDU(0x00, 0x20, 0x00, kid, pinBlock));//, false); + + } + + if (resp.getSW() == 0x63c0) { + throw new LockedException("PIN locked."); + } else if (resp.getSW1() == 0x63 && resp.getSW2() >> 4 == 0xc) { + // return number of possible retries + return resp.getSW2() & 0x0f; + } else if (resp.getSW() == 0x6983) { + throw new LockedException(); + } else if (resp.getSW() == 0x6984) { + // PIN LCS = "Initialized" (-> not activated) + throw new NotActivatedException("PIN not set."); + } else if (resp.getSW() == 0x9000) { + return -1; // success + } else { + throw new SignatureCardException("Failed to verify pin: SW=" + Integer.toHexString(resp.getSW())); + } + } + } + + public static class Formatter { + + private static String[] alphabet = {"0", "1", "2", + "3", "4", "5", "6", "7", "8", + "9", "A", "B", "C", "D", "E", + "F"}; + + public static String byteArrayToHexString(byte[] bytes) { + + if (bytes == null || bytes.length <= 0) { + return null; + } + + StringBuffer buf = new StringBuffer(2 * bytes.length); + + byte c = 0x00; + + for (int i = 0; i < bytes.length; i++) { + + // high nibble + c = (byte) (bytes[i] & 0xf0); + + // shift down + c = (byte) (c >>> 4); + + // cut high order bits + c = (byte) (c & 0x0f); + + buf.append(alphabet[(int) c]); + + // low nibble + c = (byte) (bytes[i] & 0x0f); + + buf.append(alphabet[(int) c]); + if (i < bytes.length - 1) { + buf.append(':'); + } + } + + return buf.toString(); + + } + } + + protected void testASignPremium(CardChannel cardchannel, SignatureCard signatureCard, Card card) throws CardException { + byte[] selectMF = new byte[]{(byte) 0x00, (byte) 0xA4, (byte) 0x00, (byte) 0x0C, (byte) 0x02, (byte) 0x3F, (byte) 0x00}; + byte[] selectDF_DEC = new byte[] { (byte) 0x00, (byte) 0xA4, (byte) 0x00, (byte) 0x0C, (byte) 0x02, (byte) 0xdf, (byte) 0x71 }; + byte[] selectAID_DEC = new byte[] { (byte) 0x00, (byte) 0xA4, (byte) 0x04, (byte) 0x00, (byte) 0x07, (byte) 0xA0, (byte) 0x00, + (byte) 0x00, (byte) 0x01, (byte) 0x18, (byte) 0x45, (byte) 0x4E }; + + CommandAPDU cAPDU; + ResponseAPDU rAPDU; + byte[] sw; + + cAPDU = new CommandAPDU(selectMF); + rAPDU = cardchannel.transmit(cAPDU); + sw = new byte[]{(byte) (0xFF & rAPDU.getSW1()), (byte) (0xFF & rAPDU.getSW2())}; + System.out.println("cAPDU: " + Formatter.byteArrayToHexString(cAPDU.getBytes())); + System.out.println("rAPDU (sw=" + Formatter.byteArrayToHexString(sw) + "): " + Formatter.byteArrayToHexString(rAPDU.getData())); + + cAPDU = new CommandAPDU(selectAID_DEC); + rAPDU = cardchannel.transmit(cAPDU); + sw = new byte[]{(byte) (0xFF & rAPDU.getSW1()), (byte) (0xFF & rAPDU.getSW2())}; + System.out.println("cAPDU: " + Formatter.byteArrayToHexString(cAPDU.getBytes())); + System.out.println("rAPDU (sw=" + Formatter.byteArrayToHexString(sw) + "): " + Formatter.byteArrayToHexString(rAPDU.getData())); + + cAPDU = new CommandAPDU(selectDF_DEC); + rAPDU = cardchannel.transmit(cAPDU); + sw = new byte[]{(byte) (0xFF & rAPDU.getSW1()), (byte) (0xFF & rAPDU.getSW2())}; + System.out.println("cAPDU: " + Formatter.byteArrayToHexString(cAPDU.getBytes())); + System.out.println("rAPDU (sw=" + Formatter.byteArrayToHexString(sw) + "): " + Formatter.byteArrayToHexString(rAPDU.getData())); + + + } + + protected void testECard(CardChannel cardchannel, SignatureCard signatureCard, Card card) throws CardException, InterruptedException, SignatureCardException { +// if (cardTerminal != null) { +// card_ = cardTerminal.connect("*"); +// } + byte[] selectMF = new byte[]{(byte) 0x00, (byte) 0xA4, (byte) 0x00, (byte) 0x0C, (byte) 0x02, (byte) 0x3F, (byte) 0x00}; + byte[] readEF_GDO = new byte[]{(byte) 0x00, (byte) 0xB0, (byte) 0x82, (byte) 0x00, (byte) 0x00}; + CommandAPDU cAPDU; + ResponseAPDU rAPDU; + byte[] sw; + cAPDU = new CommandAPDU(selectMF); + rAPDU = cardchannel.transmit(cAPDU); + sw = new byte[]{(byte) (0xFF & rAPDU.getSW1()), (byte) (0xFF & rAPDU.getSW2())}; + System.out.println("cAPDU: " + Formatter.byteArrayToHexString(cAPDU.getBytes())); + System.out.println("rAPDU (sw=" + Formatter.byteArrayToHexString(sw) + "): " + Formatter.byteArrayToHexString(rAPDU.getData())); + cAPDU = new CommandAPDU(readEF_GDO); + rAPDU = cardchannel.transmit(cAPDU); + sw = new byte[]{(byte) (0xFF & rAPDU.getSW1()), (byte) (0xFF & rAPDU.getSW2())}; + System.out.println("cAPDU: " + Formatter.byteArrayToHexString(cAPDU.getBytes())); + System.out.println("rAPDU (sw=" + Formatter.byteArrayToHexString(sw) + "): " + Formatter.byteArrayToHexString(rAPDU.getData())); + byte[] EF_GDO = rAPDU.getData(); + //RESET + System.out.println("RESET"); + signatureCard.reset(); + card = signatureCard.getCard(); +// card.disconnect(true); +// card = ct.connect("*"); + System.out.println("begin exclusive"); + card.beginExclusive(); + System.out.println("get cardchannel"); + cardchannel = card.getBasicChannel(); + byte[] getCLC = new byte[]{(byte) 0x00, (byte) 0xCA, (byte) 0xDF, (byte) 0x20, (byte) 0x00}; + byte[] verifyKartenPIN = new byte[]{(byte) 0x00, (byte) 0x20, (byte) 0x00, (byte) 0x01}; + byte[] selectDF_SichereSignatur = new byte[]{(byte) 0x00, (byte) 0xA4, (byte) 0x04, (byte) 0x00, (byte) 0x08, (byte) 0xD0, (byte) 0x40, (byte) 0x00, (byte) 0x00, (byte) 0x17, (byte) 0x00, (byte) 0x12, (byte) 0x01, (byte) 0x00}; + byte[] verifySignaturPIN = new byte[]{(byte) 0x00, (byte) 0x20, (byte) 0x00, (byte) 0x81}; + cAPDU = new CommandAPDU(getCLC); + rAPDU = cardchannel.transmit(cAPDU); + sw = new byte[]{(byte) (0xFF & rAPDU.getSW1()), (byte) (0xFF & rAPDU.getSW2())}; + System.out.println("cAPDU: " + Formatter.byteArrayToHexString(cAPDU.getBytes())); + System.out.println("rAPDU (sw=" + Formatter.byteArrayToHexString(sw) + "): " + Formatter.byteArrayToHexString(rAPDU.getData())); + byte[] clc = rAPDU.getData(); + cAPDU = new CommandAPDU(verifyKartenPIN); + rAPDU = cardchannel.transmit(cAPDU); + sw = new byte[]{(byte) (0xFF & rAPDU.getSW1()), (byte) (0xFF & rAPDU.getSW2())}; + System.out.println("cAPDU: " + Formatter.byteArrayToHexString(cAPDU.getBytes())); + System.out.println("rAPDU (sw=" + Formatter.byteArrayToHexString(sw) + "): " + Formatter.byteArrayToHexString(rAPDU.getData())); + cAPDU = new CommandAPDU(selectDF_SichereSignatur); + rAPDU = cardchannel.transmit(cAPDU); + sw = new byte[]{(byte) (0xFF & rAPDU.getSW1()), (byte) (0xFF & rAPDU.getSW2())}; + System.out.println("cAPDU: " + Formatter.byteArrayToHexString(cAPDU.getBytes())); + System.out.println("rAPDU (sw=" + Formatter.byteArrayToHexString(sw) + "): " + Formatter.byteArrayToHexString(rAPDU.getData())); + cAPDU = new CommandAPDU(verifySignaturPIN); + rAPDU = cardchannel.transmit(cAPDU); + sw = new byte[]{(byte) (0xFF & rAPDU.getSW1()), (byte) (0xFF & rAPDU.getSW2())}; + System.out.println("cAPDU: " + Formatter.byteArrayToHexString(cAPDU.getBytes())); + System.out.println("rAPDU (sw=" + Formatter.byteArrayToHexString(sw) + "): " + Formatter.byteArrayToHexString(rAPDU.getData())); + //RESET + System.out.println("RESET"); + signatureCard.reset(); + card = signatureCard.getCard(); + System.out.println("InfoboxReadRequests..."); + PINProvider pinProvider = new PINProvider() { + + @Override + public String providePIN(PINSpec spec, int retries) throws InterruptedException { + if (retries >= 3) { + return "2540"; + } else { + throw new InterruptedException("TOO FEW PIN RETRIES LEFT, ABORTING"); + } + } + }; + byte[] ehic = signatureCard.getInfobox("EHIC", pinProvider, null); + System.out.println("EHIC: " + Formatter.byteArrayToHexString(ehic)); + byte[] grunddaten = signatureCard.getInfobox("Grunddaten", pinProvider, null); + System.out.println("Grunddaten: " + Formatter.byteArrayToHexString(grunddaten)); + //RESET + System.out.println("RESET"); + signatureCard.reset(); + card = signatureCard.getCard(); +// card.disconnect(true); +// card = ct.connect("*"); + System.out.println("begin exclusive"); + card.beginExclusive(); + System.out.println("get cardchannel"); + cardchannel = card.getBasicChannel(); + cAPDU = new CommandAPDU(getCLC); + rAPDU = cardchannel.transmit(cAPDU); + sw = new byte[]{(byte) (0xFF & rAPDU.getSW1()), (byte) (0xFF & rAPDU.getSW2())}; + System.out.println("cAPDU: " + Formatter.byteArrayToHexString(cAPDU.getBytes())); + System.out.println("rAPDU (sw=" + Formatter.byteArrayToHexString(sw) + "): " + Formatter.byteArrayToHexString(rAPDU.getData())); + assertTrue(Arrays.equals(clc, rAPDU.getData())); + cAPDU = new CommandAPDU(readEF_GDO); + rAPDU = cardchannel.transmit(cAPDU); + sw = new byte[]{(byte) (0xFF & rAPDU.getSW1()), (byte) (0xFF & rAPDU.getSW2())}; + System.out.println("cAPDU: " + Formatter.byteArrayToHexString(cAPDU.getBytes())); + System.out.println("rAPDU (sw=" + Formatter.byteArrayToHexString(sw) + "): " + Formatter.byteArrayToHexString(rAPDU.getData())); + assertTrue(Arrays.equals(EF_GDO, rAPDU.getData())); +// } + } +} diff --git a/BKUAppletExt/src/test/resources/appletTest.html b/BKUAppletExt/src/test/resources/appletTest.html index f7a47d0a..9add4309 100644 --- a/BKUAppletExt/src/test/resources/appletTest.html +++ b/BKUAppletExt/src/test/resources/appletTest.html @@ -17,10 +17,10 @@
- - + -- cgit v1.2.3 From bd18d9084fd139aaae40ad8d525c1d0e626f2e5e Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 12 Feb 2009 09:31:43 +0000 Subject: ignore test (assumes e-card) git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@308 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../src/test/java/at/gv/egiz/bku/smccstal/ext/FileSystemTest.java | 1 + 1 file changed, 1 insertion(+) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/src/test/java/at/gv/egiz/bku/smccstal/ext/FileSystemTest.java b/BKUAppletExt/src/test/java/at/gv/egiz/bku/smccstal/ext/FileSystemTest.java index 8d8b0385..5fa3cbd7 100644 --- a/BKUAppletExt/src/test/java/at/gv/egiz/bku/smccstal/ext/FileSystemTest.java +++ b/BKUAppletExt/src/test/java/at/gv/egiz/bku/smccstal/ext/FileSystemTest.java @@ -44,6 +44,7 @@ import static org.junit.Assert.*; * * @author Clemens Orthacker */ +@Ignore public class FileSystemTest { /** asign premium */ -- cgit v1.2.3 From 6576428966f1e3d688269a407b072fb01f9f7647 Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 26 Feb 2009 19:39:00 +0000 Subject: 1.1 candidate (activation) git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@309 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../java/at/gv/egiz/bku/gui/PINManagementGUI.java | 519 +++++++++++++++++++-- .../at/gv/egiz/bku/gui/PINManagementGUIFacade.java | 47 +- .../java/at/gv/egiz/bku/gui/PINSpecRenderer.java | 39 ++ .../java/at/gv/egiz/bku/gui/PINStatusProvider.java | 32 -- .../java/at/gv/egiz/bku/gui/PINStatusRenderer.java | 63 +++ .../at/gv/egiz/bku/gui/PINStatusTableModel.java | 60 +++ .../bku/online/applet/PINManagementApplet.java | 3 +- .../bku/online/applet/PINManagementBKUWorker.java | 82 +--- .../smccstal/ext/PINManagementRequestHandler.java | 331 +++++++++++++ .../bku/smccstal/ext/PINMgmtRequestHandler.java | 93 ---- .../gv/egiz/bku/gui/ActivationMessages.properties | 28 +- .../egiz/bku/gui/ActivationMessages_en.properties | 30 +- .../test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java | 4 +- BKUAppletExt/src/test/resources/appletTest.html | 2 +- 14 files changed, 1094 insertions(+), 239 deletions(-) create mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINSpecRenderer.java delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusProvider.java create mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java create mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusTableModel.java create mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PINManagementRequestHandler.java delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PINMgmtRequestHandler.java (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java index 8acf051e..8eef8aea 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java @@ -17,15 +17,28 @@ package at.gv.egiz.bku.gui; +import at.gv.egiz.smcc.PINSpec; import java.awt.Container; +import java.awt.Cursor; +import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionAdapter; import java.net.URL; +import java.text.MessageFormat; import java.util.Locale; +import java.util.Map; import javax.swing.GroupLayout; import javax.swing.JButton; import javax.swing.JLabel; +import javax.swing.JPasswordField; +import javax.swing.JScrollPane; +import javax.swing.JTable; import javax.swing.LayoutStyle; +import javax.swing.ListSelectionModel; import javax.swing.SwingUtilities; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; /** * TODO pull out ResourceBundle to common superclass for activationGUI and pinMgmtGUI @@ -33,9 +46,10 @@ import javax.swing.SwingUtilities; */ public class PINManagementGUI extends ActivationGUI implements PINManagementGUIFacade { - public static final String BUTTON_ACTIVATE = "button.activate"; - public static final String BUTTON_UNBLOCK = "button.unblock"; - public static final String BUTTON_CHANGE = "button.change"; + /** remember the pinfield to return to worker */ + protected JPasswordField oldPinField; + /** remember the pinSpec to return to worker */ + protected PINSpec pinSpec; public PINManagementGUI(Container contentPane, Locale locale, @@ -46,12 +60,31 @@ public class PINManagementGUI extends ActivationGUI implements PINManagementGUIF } @Override - public void showPINManagementDialog(final PINStatusProvider pinStatusProvider, - final ActionListener activateListener, final String activateCmd, - final ActionListener changeListener, final String changeCmd, - final ActionListener unblockListener, final String unblockCmd, - final ActionListener cancelListener, final String cancelCmd) { -// try { + public char[] getOldPin() { + if (oldPinField != null) { + char[] pin = oldPinField.getPassword(); + oldPinField = null; + return pin; + } + return null; + } + + @Override + public PINSpec getSelectedPIN() { + return pinSpec; + } + + @Override + public void showPINManagementDialog(final Map pins, + final ActionListener activateListener, + final String activateCmd, + final String changeCmd, + final String unblockCmd, + final ActionListener cancelListener, + final String cancelCmd) { + + log.debug("scheduling PIN managment dialog"); + SwingUtilities.invokeLater(new Runnable() { @Override @@ -68,13 +101,76 @@ public class PINManagementGUI extends ActivationGUI implements PINManagementGUIF if (renderHeaderPanel) { titleLabel.setText(cardmgmtMessages.getString(TITLE_PINMGMT)); - mgmtLabel.setText(cardmgmtMessages.getString(MESSAGE_PINMGMT)); + String infoPattern = cardmgmtMessages.getString(MESSAGE_PINMGMT); + mgmtLabel.setText(MessageFormat.format(infoPattern, pins.size())); } else { mgmtLabel.setText(cardmgmtMessages.getString(TITLE_PINMGMT)); } + final PINStatusTableModel tableModel = new PINStatusTableModel(pins); + final JTable pinStatusTable = new JTable(tableModel); + pinStatusTable.setDefaultRenderer(PINSpec.class, new PINSpecRenderer()); + pinStatusTable.setDefaultRenderer(STATUS.class, new PINStatusRenderer(cardmgmtMessages)); + pinStatusTable.setTableHeader(null); - + pinStatusTable.addMouseMotionListener(new MouseMotionAdapter() { + + @Override + public void mouseMoved(MouseEvent e) { + if (pinStatusTable.columnAtPoint(e.getPoint()) == 0) { + pinStatusTable.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + } else { + pinStatusTable.setCursor(Cursor.getDefaultCursor()); + } + } + }); + + final JButton activateButton = new JButton(); + activateButton.setFont(activateButton.getFont().deriveFont(activateButton.getFont().getStyle() & ~java.awt.Font.BOLD)); + activateButton.addActionListener(activateListener); + + pinStatusTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + pinStatusTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { + + @Override + public void valueChanged(final ListSelectionEvent e) { + //invoke later to allow thread to paint selection background + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + ListSelectionModel lsm = (ListSelectionModel) e.getSource(); + int selectionIdx = lsm.getMinSelectionIndex(); + if (selectionIdx >= 0) { + pinSpec = (PINSpec) tableModel.getValueAt(selectionIdx, 0); + STATUS status = (STATUS) tableModel.getValueAt(selectionIdx, 1); + + if (status == STATUS.NOT_ACTIV) { + activateButton.setText(cardmgmtMessages.getString(BUTTON_ACTIVATE)); + activateButton.setEnabled(true); + activateButton.setActionCommand(activateCmd); + } else if (status == STATUS.BLOCKED) { + activateButton.setText(cardmgmtMessages.getString(BUTTON_UNBLOCK)); + activateButton.setEnabled(true); + activateButton.setActionCommand(unblockCmd); + } else if (status == STATUS.ACTIV) { + activateButton.setText(cardmgmtMessages.getString(BUTTON_CHANGE)); + activateButton.setEnabled(true); + activateButton.setActionCommand(changeCmd); + } else { + activateButton.setText(cardmgmtMessages.getString(BUTTON_ACTIVATE)); + activateButton.setEnabled(false); + } + } + } + }); + } + }); + + //select first entry + pinStatusTable.getSelectionModel().setSelectionInterval(0, 0); + + JScrollPane pinStatusScrollPane = new JScrollPane(pinStatusTable); GroupLayout mainPanelLayout = new GroupLayout(mainPanel); mainPanel.setLayout(mainPanelLayout); @@ -91,30 +187,16 @@ public class PINManagementGUI extends ActivationGUI implements PINManagementGUIF .addComponent(helpLabel); } - mainPanelLayout.setHorizontalGroup(messageHorizontal); - mainPanelLayout.setVerticalGroup(messageVertical); + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(messageHorizontal) + .addComponent(pinStatusScrollPane, 0, 0, Short.MAX_VALUE)); - - JButton activateButton = new JButton(); - activateButton.setFont(activateButton.getFont().deriveFont(activateButton.getFont().getStyle() & ~java.awt.Font.BOLD)); - activateButton.setText(cardmgmtMessages.getString(BUTTON_ACTIVATE)); - activateButton.setEnabled(true);//false); - activateButton.setActionCommand(activateCmd); - activateButton.addActionListener(activateListener); - - JButton changeButton = new JButton(); - changeButton.setFont(activateButton.getFont().deriveFont(activateButton.getFont().getStyle() & ~java.awt.Font.BOLD)); - changeButton.setText(cardmgmtMessages.getString(BUTTON_CHANGE)); - changeButton.setEnabled(false); - changeButton.setActionCommand(changeCmd); - changeButton.addActionListener(changeListener); - - JButton unblockButton = new JButton(); - unblockButton.setFont(activateButton.getFont().deriveFont(activateButton.getFont().getStyle() & ~java.awt.Font.BOLD)); - unblockButton.setText(cardmgmtMessages.getString(BUTTON_UNBLOCK)); - unblockButton.setEnabled(false); - unblockButton.setActionCommand(unblockCmd); - unblockButton.addActionListener(unblockListener); + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createSequentialGroup() + .addGroup(messageVertical) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pinStatusScrollPane, 0, 0, pinStatusTable.getPreferredSize().height+3)); JButton cancelButton = new JButton(); cancelButton.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD)); @@ -129,30 +211,377 @@ public class PINManagementGUI extends ActivationGUI implements PINManagementGUIF .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(activateButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(changeButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(unblockButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE); GroupLayout.Group buttonVertical = buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(activateButton) - .addComponent(changeButton) - .addComponent(unblockButton) .addComponent(cancelButton); buttonPanelLayout.setHorizontalGroup(buttonHorizontal); buttonPanelLayout.setVerticalGroup(buttonVertical); contentPanel.validate(); - } }); + } + + @Override + public void showActivatePINDialog(final PINSpec pin, + final ActionListener okListener, final String okCommand, + final ActionListener cancelListener, final String cancelCommand) { + log.debug("scheduling activate pin dialog"); + showPINDialog(false, pin, okListener, okCommand, cancelListener, cancelCommand); + } + + + private void showPINDialog(final boolean changePin, final PINSpec pinSpec, + final ActionListener okListener, final String okCommand, + final ActionListener cancelListener, final String cancelCommand) { + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + String HELP_TOPIC, TITLE, MESSAGE_MGMT; + if (changePin) { + log.debug("show change pin dialog"); + HELP_TOPIC = HELP_PINMGMT; + TITLE = TITLE_CHANGE_PIN; + MESSAGE_MGMT = MESSAGE_CHANGE_PIN; + } else { + log.debug("show activate pin dialog"); + HELP_TOPIC = HELP_PINMGMT; + TITLE = TITLE_ACTIVATE_PIN; + MESSAGE_MGMT = MESSAGE_ACTIVATE_PIN; + oldPinField = null; + } + + mainPanel.removeAll(); + buttonPanel.removeAll(); + + helpListener.setHelpTopic(HELP_TOPIC); + + JLabel mgmtLabel = new JLabel(); + mgmtLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + + if (renderHeaderPanel) { + titleLabel.setText(cardmgmtMessages.getString(TITLE)); + String mgmtPattern = cardmgmtMessages.getString(MESSAGE_MGMT); + if (shortText) { + mgmtLabel.setText(MessageFormat.format(mgmtPattern, "PIN")); + } else { + mgmtLabel.setText(MessageFormat.format(mgmtPattern, pinSpec.getLocalizedName())); + } + } else { + mgmtLabel.setText(cardmgmtMessages.getString(TITLE)); + } + + JButton okButton = new JButton(); + okButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle() & ~java.awt.Font.BOLD)); + okButton.setText(messages.getString(BUTTON_OK)); + okButton.setEnabled(false); + okButton.setActionCommand(okCommand); + okButton.addActionListener(okListener); + + JLabel pinLabel = new JLabel(); + pinLabel.setFont(pinLabel.getFont().deriveFont(pinLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + String pinLabelPattern = (changePin) ? cardmgmtMessages.getString(LABEL_NEW_PIN) : messages.getString(LABEL_PIN); + pinLabel.setText(MessageFormat.format(pinLabelPattern, new Object[]{pinSpec.getLocalizedName()})); + + final JPasswordField repeatPinField = new JPasswordField(); + pinField = new JPasswordField(); + pinField.setText(""); + pinField.setDocument(new PINDocument(pinSpec, null)); + pinField.setActionCommand(okCommand); + pinField.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + if (pinField.getPassword().length >= pinSpec.getMinLength()) { + repeatPinField.requestFocusInWindow(); + } + } + }); + JLabel repeatPinLabel = new JLabel(); + repeatPinLabel.setFont(pinLabel.getFont()); + String repeatPinLabelPattern = cardmgmtMessages.getString(LABEL_REPEAT_PIN); + repeatPinLabel.setText(MessageFormat.format(repeatPinLabelPattern, new Object[]{pinSpec.getLocalizedName()})); + + repeatPinField.setText(""); + repeatPinField.setDocument(new PINDocument(pinSpec, okButton, pinField.getDocument())); + repeatPinField.setActionCommand(okCommand); + repeatPinField.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + if (pinField.getPassword().length >= pinSpec.getMinLength()) { + okListener.actionPerformed(e); + } + } + }); + + JLabel oldPinLabel = null; + if (changePin) { + oldPinLabel = new JLabel(); + oldPinLabel.setFont(oldPinLabel.getFont().deriveFont(oldPinLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + String oldPinLabelPattern = cardmgmtMessages.getString(LABEL_OLD_PIN); + oldPinLabel.setText(MessageFormat.format(oldPinLabelPattern, new Object[]{pinSpec.getLocalizedName()})); + + oldPinField = new JPasswordField(); + oldPinField.setText(""); + oldPinField.setDocument(new PINDocument(pinSpec, null)); + oldPinField.setActionCommand(okCommand); + oldPinField.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + if (oldPinField.getPassword().length >= pinSpec.getMinLength()) { + pinField.requestFocusInWindow(); + } + } + }); + } + + JLabel pinsizeLabel = new JLabel(); + pinsizeLabel.setFont(pinsizeLabel.getFont().deriveFont(pinsizeLabel.getFont().getStyle() & ~java.awt.Font.BOLD, pinsizeLabel.getFont().getSize()-2)); + String pinsizePattern = messages.getString(LABEL_PINSIZE); + String pinSize = String.valueOf(pinSpec.getMinLength()); + if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { + pinSize += "-" + pinSpec.getMaxLength(); + } + pinsizeLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{pinSize})); + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + GroupLayout.SequentialGroup infoHorizontal = mainPanelLayout.createSequentialGroup() + .addComponent(mgmtLabel); + GroupLayout.ParallelGroup infoVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(mgmtLabel); + + if (!renderHeaderPanel) { + infoHorizontal + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) + .addComponent(helpLabel); + infoVertical + .addComponent(helpLabel); + } -// } catch (Exception ex) { -// log.error(ex.getMessage(), ex); -// showErrorDialog(ERR_UNKNOWN_WITH_PARAM, new Object[] {ex.getMessage()}); -// } + GroupLayout.ParallelGroup pinHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING); + GroupLayout.SequentialGroup pinVertical = mainPanelLayout.createSequentialGroup(); + + if (pinLabelPos == PinLabelPosition.ABOVE) { + if (changePin) { + pinHorizontal + .addComponent(oldPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(oldPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE); + pinVertical + .addComponent(oldPinLabel) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(oldPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); + } + pinHorizontal + .addComponent(pinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(repeatPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(repeatPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(mainPanelLayout.createSequentialGroup() + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) + .addComponent(pinsizeLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)); + pinVertical + .addComponent(pinLabel) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(repeatPinLabel) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(repeatPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pinsizeLabel); + } else { + if (changePin) { + pinHorizontal + .addGroup(mainPanelLayout.createSequentialGroup() + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(oldPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(pinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(repeatPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(oldPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(repeatPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); + + pinVertical + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(oldPinLabel) + .addComponent(oldPinField)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); + } else { + pinHorizontal + .addGroup(mainPanelLayout.createSequentialGroup() + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(pinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addComponent(repeatPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(repeatPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); + + } + pinHorizontal + .addGroup(mainPanelLayout.createSequentialGroup() + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) + .addComponent(pinsizeLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)); + pinVertical + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(pinLabel) + .addComponent(pinField)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(repeatPinLabel) + .addComponent(repeatPinField)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pinsizeLabel); + } + + mainPanelLayout.setHorizontalGroup( + mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addGroup(infoHorizontal) + .addGroup(pinHorizontal)); + + mainPanelLayout.setVerticalGroup( + mainPanelLayout.createSequentialGroup() + .addGroup(infoVertical) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(pinVertical)); + + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); + + GroupLayout.SequentialGroup buttonHorizontal = buttonPanelLayout.createSequentialGroup() + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(okButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE); + GroupLayout.Group buttonVertical; + + JButton cancelButton = new JButton(); + cancelButton.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD)); + cancelButton.setText(messages.getString(BUTTON_CANCEL)); + cancelButton.setActionCommand(cancelCommand); + cancelButton.addActionListener(cancelListener); + + buttonHorizontal + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE); + buttonVertical = buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(okButton) + .addComponent(cancelButton); + + buttonPanelLayout.setHorizontalGroup(buttonHorizontal); + buttonPanelLayout.setVerticalGroup(buttonVertical); + + if (oldPinField != null) { + oldPinField.requestFocusInWindow(); + } else { + pinField.requestFocusInWindow(); + } + contentPanel.validate(); + + } + }); + } + + @Override + public void showChangePINDialog(final PINSpec pin, + final ActionListener okListener, final String okCommand, + final ActionListener cancelListener, final String cancelCommand) { + + log.debug("scheduling change pin dialog"); + showPINDialog(true, pin, okListener, okCommand, cancelListener, cancelCommand); + } + + @Override + public void showUnblockPINDialog(final PINSpec pin, + final ActionListener okListener, final String okCommand, + final ActionListener cancelListener, final String cancelCommand) { + + log.debug("scheduling unblock PIN dialog"); + + SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + log.debug("show unblock PIN dialog"); + + log.error("unblock pin not supported"); + + mainPanel.removeAll(); + buttonPanel.removeAll(); + + if (renderHeaderPanel) { + titleLabel.setText(messages.getString(TITLE_ERROR)); + } + + helpListener.setHelpTopic(HELP_PINMGMT); + + String errorMsgPattern = cardmgmtMessages.getString(ERR_UNBLOCK); + String errorMsg = MessageFormat.format(errorMsgPattern, pin.getLocalizedName()); + + JLabel errorMsgLabel = new JLabel(); + errorMsgLabel.setFont(errorMsgLabel.getFont().deriveFont(errorMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + errorMsgLabel.setText(errorMsg); + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + GroupLayout.ParallelGroup mainHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING); + GroupLayout.SequentialGroup mainVertical = mainPanelLayout.createSequentialGroup(); + + if (!renderHeaderPanel) { + JLabel errorTitleLabel = new JLabel(); + errorTitleLabel.setFont(errorTitleLabel.getFont().deriveFont(errorTitleLabel.getFont().getStyle() | java.awt.Font.BOLD)); + errorTitleLabel.setText(messages.getString(TITLE_ERROR)); + errorTitleLabel.setForeground(ERROR_COLOR); + + mainHorizontal + .addGroup(mainPanelLayout.createSequentialGroup() + .addComponent(errorTitleLabel) + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) + .addComponent(helpLabel)); + mainVertical + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(errorTitleLabel) + .addComponent(helpLabel)); + } + + mainPanelLayout.setHorizontalGroup(mainHorizontal + .addComponent(errorMsgLabel)); + mainPanelLayout.setVerticalGroup(mainVertical + .addComponent(errorMsgLabel)); + + JButton okButton = new JButton(); + okButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle() & ~java.awt.Font.BOLD)); + okButton.setText(messages.getString(BUTTON_OK)); + okButton.setActionCommand(cancelCommand); + okButton.addActionListener(cancelListener); + + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); + + buttonPanelLayout.setHorizontalGroup( + buttonPanelLayout.createSequentialGroup() + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(okButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); + buttonPanelLayout.setVerticalGroup( + buttonPanelLayout.createSequentialGroup() + .addComponent(okButton)); + + contentPanel.validate(); + } + }); } 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 3d653fab..2a8f28d2 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 @@ -17,7 +17,9 @@ package at.gv.egiz.bku.gui; +import at.gv.egiz.smcc.PINSpec; import java.awt.event.ActionListener; +import java.util.Map; /** * @@ -27,8 +29,49 @@ public interface PINManagementGUIFacade extends BKUGUIFacade { public static final String HELP_PINMGMT = "help.pin.mgmt"; public static final String TITLE_PINMGMT = "title.pin.mgmt"; + public static final String TITLE_ACTIVATE_PIN = "title.activate.pin"; + public static final String TITLE_CHANGE_PIN = "title.change.pin"; + public static final String TITLE_UNBLOCK_PIN = "title.unblock.pin"; public static final String MESSAGE_PINMGMT = "message.pin.mgmt"; - - public void showPINManagementDialog(PINStatusProvider pinStatusProvider, ActionListener activateListener, String activateCmd, ActionListener changeListener, String changeCmd, ActionListener unblockListener, String unblockCmd, ActionListener cancelListener, String cancelCmd); + public static final String MESSAGE_ACTIVATE_PIN = "message.activate.pin"; + public static final String MESSAGE_CHANGE_PIN = "message.change.pin"; + public static final String MESSAGE_UNBLOCK_PIN = "message.unblock.pin"; + public static final String LABEL_OLD_PIN = "label.old.pin"; + public static final String LABEL_NEW_PIN = "label.new.pin"; + public static final String LABEL_REPEAT_PIN = "label.repeat.pin"; + public static final String ERR_ACTIVATE = "err.activate"; + public static final String ERR_CHANGE = "err.change"; + public static final String ERR_UNBLOCK = "err.unblock"; + + public static final String BUTTON_ACTIVATE = "button.activate"; + public static final String BUTTON_UNBLOCK = "button.unblock"; + public static final String BUTTON_CHANGE = "button.change"; + + public static final String STATUS_ACTIVE = "status.active"; + public static final String STATUS_BLOCKED = "status.blocked"; + public static final String STATUS_NOT_ACTIVE = "status.not.active"; + public static final String STATUS_UNKNOWN = "status.unknown"; + + public enum STATUS { ACTIV, NOT_ACTIV, BLOCKED, UNKNOWN }; + + public void showPINManagementDialog(Map pins, + ActionListener activateListener, String activateCmd, String changeCmd, String unblockCmd, + ActionListener cancelListener, String cancelCmd); + + public void showActivatePINDialog(PINSpec pin, + ActionListener okListener, String okCmd, + ActionListener cancelListener, String cancelCmd); + + public void showChangePINDialog(PINSpec pin, + ActionListener okListener, String okCmd, + ActionListener cancelListener, String cancelCmd); + + public void showUnblockPINDialog(PINSpec pin, + ActionListener okListener, String okCmd, + ActionListener cancelListener, String cancelCmd); + + public char[] getOldPin(); + + public PINSpec getSelectedPIN(); } diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINSpecRenderer.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINSpecRenderer.java new file mode 100644 index 00000000..e3d73e1f --- /dev/null +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINSpecRenderer.java @@ -0,0 +1,39 @@ +/* + * 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.gui; + +import at.gv.egiz.smcc.PINSpec; +import javax.swing.table.DefaultTableCellRenderer; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * + * @author Clemens Orthacker + */ +public class PINSpecRenderer extends DefaultTableCellRenderer { + + private static final Log log = LogFactory.getLog(PINSpecRenderer.class); + + @Override + protected void setValue(Object value) { + PINSpec pinSpec = (PINSpec) value; + super.setText(pinSpec.getLocalizedName()); + } + +} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusProvider.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusProvider.java deleted file mode 100644 index 73fa0920..00000000 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusProvider.java +++ /dev/null @@ -1,32 +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.gui; - -import at.gv.egiz.smcc.SignatureCardException; - -/** - * - * @author Clemens Orthacker - */ -public interface PINStatusProvider { - - public enum STATUS { ACTIV, NOT_ACTIV, BLOCKED }; - - public STATUS getPINStatus(int pin) throws SignatureCardException; - -} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java new file mode 100644 index 00000000..2f8852ff --- /dev/null +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java @@ -0,0 +1,63 @@ +/* + * 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.gui; + +import at.gv.egiz.bku.gui.PINManagementGUIFacade.STATUS; +import java.awt.Color; +import java.awt.Font; +import java.util.ResourceBundle; +import javax.swing.table.DefaultTableCellRenderer; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * + * @author Clemens Orthacker + */ +public class PINStatusRenderer extends DefaultTableCellRenderer { + + private static final Log log = LogFactory.getLog(PINStatusRenderer.class); + + public static final Color RED = new Color(0.9f, 0.0f, 0.0f); + public static final Color GREEN = new Color(0.0f, 0.8f, 0.0f); + protected ResourceBundle messages; + + public PINStatusRenderer(ResourceBundle messages) { + this.messages = messages; + } + + @Override + protected void setValue(Object value) { + STATUS pinStatus = (STATUS) value; + super.setFont(super.getFont().deriveFont(super.getFont().getStyle() | Font.BOLD)); + + if (pinStatus == STATUS.NOT_ACTIV) { + super.setForeground(RED); + super.setText("" + messages.getString(PINManagementGUIFacade.STATUS_NOT_ACTIVE) + ""); + } else if (pinStatus == STATUS.ACTIV) { + super.setForeground(GREEN); + super.setText("" + messages.getString(PINManagementGUIFacade.STATUS_ACTIVE) + ""); + } else if (pinStatus == STATUS.BLOCKED) { + super.setForeground(RED); + super.setText("" + messages.getString(PINManagementGUIFacade.STATUS_BLOCKED) + ""); + } else { + super.setForeground(Color.BLACK); + super.setText("" + messages.getString(PINManagementGUIFacade.STATUS_UNKNOWN) + ""); + } + } +} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusTableModel.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusTableModel.java new file mode 100644 index 00000000..feaa5072 --- /dev/null +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusTableModel.java @@ -0,0 +1,60 @@ +/* + * 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.gui; + +import at.gv.egiz.bku.gui.PINManagementGUIFacade.STATUS; +import at.gv.egiz.smcc.PINSpec; +import java.util.Map; +import javax.swing.table.DefaultTableModel; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * + * @author Clemens Orthacker + */ +public class PINStatusTableModel extends DefaultTableModel { + + protected static final Log log = LogFactory.getLog(PINStatusTableModel.class); + protected Class[] types; + + public PINStatusTableModel(Map pinStatuses) { + super(0, 2); + if (pinStatuses == null) { + throw new RuntimeException("pinStatuses must not be null"); + } + log.trace(pinStatuses.size() + " PINs"); + types = new Class[] { PINSpec.class, STATUS.class }; + for (PINSpec pinSpec : pinStatuses.keySet()) { + addRow(new Object[] { pinSpec, pinStatuses.get(pinSpec) }); + } +// PINSpec activePIN = new PINSpec(0, 1, null, "active-PIN", (byte) 0x01); +// PINSpec blockedPIN = new PINSpec(0, 1, null, "blocked-PIN", (byte) 0x01); +// addRow(new Object[] { activePIN, PINStatusProvider.STATUS.ACTIV }); +// addRow(new Object[] { blockedPIN, PINStatusProvider.STATUS.BLOCKED }); + } + + @Override + public Class getColumnClass(int columnIndex) { + return types[columnIndex]; + } + + @Override + public boolean isCellEditable(int rowIndex, int columnIndex) { + return false; + } +} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java index 72d06618..d948ac03 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java @@ -19,6 +19,7 @@ package at.gv.egiz.bku.online.applet; import at.gv.egiz.bku.gui.AbstractHelpListener; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.gui.PINManagementGUI; +import at.gv.egiz.bku.gui.PINManagementGUIFacade; import java.awt.Container; import java.net.URL; import java.util.Locale; @@ -45,6 +46,6 @@ public class PINManagementApplet extends BKUApplet { @Override protected AppletBKUWorker createBKUWorker(BKUApplet applet, BKUGUIFacade gui) { - return new PINManagementBKUWorker(applet, gui); + return new PINManagementBKUWorker(applet, (PINManagementGUIFacade) gui); } } diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java index e65d98ca..ffd83e42 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java @@ -18,35 +18,28 @@ package at.gv.egiz.bku.online.applet; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.gui.PINManagementGUIFacade; -import at.gv.egiz.bku.smccstal.ext.PINMgmtRequestHandler; +import at.gv.egiz.bku.smccstal.ext.PINManagementRequestHandler; +import at.gv.egiz.stal.ErrorResponse; import at.gv.egiz.stal.STALResponse; -import at.gv.egiz.stal.ext.ActivatePINRequest; -import at.gv.egiz.stal.ext.ChangePINRequest; -import at.gv.egiz.stal.ext.UnblockPINRequest; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.Collection; +import at.gv.egiz.stal.ext.PINManagementRequest; +import at.gv.egiz.stal.ext.PINManagementResponse; import java.util.Collections; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; /** - * + * This BKU Worker does not connect to STAL webservice + * (no Internet connection permitted while activating PINs). + * * @author Clemens Orthacker */ public class PINManagementBKUWorker extends AppletBKUWorker { - protected PINMgmtRequestHandler handler = new PINMgmtRequestHandler(); - protected PINManagementActionListener listener = new PINManagementActionListener(); - - public PINManagementBKUWorker(BKUApplet applet, BKUGUIFacade gui) { + public PINManagementBKUWorker(BKUApplet applet, PINManagementGUIFacade gui) { super(applet, gui); handlerMap.clear(); -// PINMgmtRequestHandler handler = new PINMgmtRequestHandler(); -// addRequestHandler(ActivatePINRequest.class, handler); -// addRequestHandler(ChangePINRequest.class, handler); -// addRequestHandler(UnblockPINRequest.class, handler); + addRequestHandler(PINManagementRequest.class, new PINManagementRequestHandler()); } @Override @@ -54,22 +47,24 @@ public class PINManagementBKUWorker extends AppletBKUWorker { gui.showWelcomeDialog(); try { - - if (waitForCard()) { - gui.showErrorDialog("no card, canceled PIN mgmt dialog", null); + List responses = handleRequest(Collections.singletonList(new PINManagementRequest())); + + if (responses.size() == 1) { + STALResponse response = responses.get(0); + if (response instanceof PINManagementResponse) { + log.debug("PIN management dialog finished"); + } else if (response instanceof ErrorResponse) { + showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, null); + } else { + throw new RuntimeException("Invalid STAL response: " + response.getClass().getName()); + } + } else { + throw new RuntimeException("invalid number of STAL responses: " + responses.size()); } - actionCommandList.clear(); - actionCommandList.add("cancel"); - - ((PINManagementGUIFacade) gui).showPINManagementDialog(handler, - listener, "activate", - listener, "change", - listener, "unblock", - this, "cancel"); - - waitForAction(); - + } catch (RuntimeException ex) { + log.error("unexpected error: " + ex.getMessage(), ex); + showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, null); } catch (Exception ex) { log.error(ex.getMessage(), ex); showErrorDialog(BKUGUIFacade.ERR_UNKNOWN_WITH_PARAM, ex); @@ -82,31 +77,4 @@ public class PINManagementBKUWorker extends AppletBKUWorker { applet.sendRedirect(sessionId); } - protected class PINManagementActionListener implements ActionListener { - - @Override - public void actionPerformed(ActionEvent e) { - try { - String cmd = e.getActionCommand(); - if ("activate".equals(cmd)) { - //create STAL request, call handle(req) - ActivatePINRequest stalReq = new ActivatePINRequest(); - STALResponse stalResp = handler.handleRequest(stalReq); - gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN_WITH_PARAM, new Object[]{"debug"}, this, "back"); - } else if ("change".equals(cmd)) { - } else if ("unblock".equals(cmd)) { - } else if ("back".equals(cmd)) { - - ((PINManagementGUIFacade) gui).showPINManagementDialog(handler, - this, "activate", - this, "change", - this, "unblock", - PINManagementBKUWorker.this, "cancel"); - - } - } catch (InterruptedException ex) { - log.fatal(ex); - } - } } -} 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 new file mode 100644 index 00000000..fcef3191 --- /dev/null +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PINManagementRequestHandler.java @@ -0,0 +1,331 @@ +/* + * 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.bku.gui.PINManagementGUIFacade; +import at.gv.egiz.bku.gui.PINManagementGUIFacade.STATUS; +import at.gv.egiz.bku.smccstal.AbstractRequestHandler; +import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.SignatureCardException; +import at.gv.egiz.smcc.util.SMCCHelper; +import at.gv.egiz.stal.ErrorResponse; +import at.gv.egiz.stal.STALRequest; +import at.gv.egiz.stal.STALResponse; +import at.gv.egiz.stal.ext.PINManagementRequest; +import at.gv.egiz.stal.ext.PINManagementResponse; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.smartcardio.Card; +import javax.smartcardio.CardChannel; +import javax.smartcardio.CardException; +import javax.smartcardio.CommandAPDU; +import javax.smartcardio.ResponseAPDU; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * + * @author Clemens Orthacker + */ +public class PINManagementRequestHandler extends AbstractRequestHandler { + + public static final String ERR_NOPIN_SELECTED = "err.no.pin.selected"; + protected static final Log log = LogFactory.getLog(PINManagementRequestHandler.class); + +// protected ResourceBundle messages; + +// public PINManagementRequestHandler(ResourceBundle messages) { +// this.messages = messages; +// } + @Override + public STALResponse handleRequest(STALRequest request) throws InterruptedException { + if (request instanceof PINManagementRequest) { + + PINManagementGUIFacade gui = (PINManagementGUIFacade) this.gui; + + showPINManagementDialog(gui); + + while (true) { + + waitForAction(); + + if ("cancel".equals(actionCommand)) { + return new PINManagementResponse(); + } else if ("back".equals(actionCommand)) { + showPINManagementDialog(gui); + } else { + PINSpec selectedPIN = gui.getSelectedPIN(); + + if (selectedPIN == null) { + throw new RuntimeException("no PIN selected for activation/change"); + } + + if ("activate_enterpin".equals(actionCommand)) { + gui.showActivatePINDialog(selectedPIN, this, "activate", this, "back"); + } else if ("change_enterpin".equals(actionCommand)) { + gui.showChangePINDialog(selectedPIN, this, "change", this, "back"); + } else if ("unblock_enterpuk".equals(actionCommand)) { + gui.showUnblockPINDialog(selectedPIN, this, "unblock", this, "back"); + } else if ("activate".equals(actionCommand)) { + try { + byte[] pin = encodePIN(gui.getPin()); + activatePIN(selectedPIN.getKID(), selectedPIN.getContextAID(), pin); + showPINManagementDialog(gui); + } catch (SignatureCardException ex) { + log.error("failed to activate " + selectedPIN.getLocalizedName() + ": " + ex.getMessage()); + gui.showErrorDialog(PINManagementGUIFacade.ERR_ACTIVATE, + new Object[] {selectedPIN.getLocalizedName()}, + this, "cancel"); + } + } else if ("change".equals(actionCommand)) { + try { + byte[] oldPin = encodePIN(gui.getOldPin()); //new byte[]{(byte) 0x25, (byte) 0x40, (byte) 0x01}; + byte[] pin = encodePIN(gui.getPin()); //new byte[]{(byte) 0x25, (byte) 0x40}; + changePIN(selectedPIN.getKID(), selectedPIN.getContextAID(), oldPin, pin); + showPINManagementDialog(gui); + } catch (SignatureCardException ex) { + log.error("failed to change " + selectedPIN.getLocalizedName() + ": " + ex.getMessage()); + gui.showErrorDialog(PINManagementGUIFacade.ERR_CHANGE, + new Object[] {selectedPIN.getLocalizedName()}, + this, "cancel"); + } + } else if ("unblock".equals(actionCommand)) { + log.error("unblock PIN not implemented"); + gui.showErrorDialog(PINManagementGUIFacade.ERR_UNBLOCK, null, this, "cancel"); + } else { + throw new RuntimeException("unsupported action " + actionCommand); + } + } + } + } else { + log.error("Got unexpected STAL request: " + request); + return new ErrorResponse(1000); + } + } + + @Override + public boolean requireCard() { + return true; + } + + /** + * pin.length < 4bit + * @param kid + * @param contextAID + * @param pin + * @throws at.gv.egiz.smcc.SignatureCardException + */ + private void activatePIN(byte kid, byte[] contextAID, byte[] pin) throws SignatureCardException { + try { + Card icc = card.getCard(); + icc.beginExclusive(); + CardChannel channel = icc.getBasicChannel(); + + if (contextAID != null) { + CommandAPDU selectAPDU = new CommandAPDU(0x00, 0xa4, 0x04, 0x0c, contextAID); + ResponseAPDU responseAPDU = channel.transmit(selectAPDU); + if (responseAPDU.getSW() != 0x9000) { + String msg = "Failed to activate PIN " + SMCCHelper.toString(new byte[]{kid}) + + ": Failed to select AID " + SMCCHelper.toString(contextAID) + + ": " + SMCCHelper.toString(responseAPDU.getBytes()); + log.error(msg); + throw new SignatureCardException(msg); + } + } + + if (pin.length > 7) { + log.error("Invalid PIN"); + throw new SignatureCardException("Invalid PIN"); + } + byte length = (byte) (0x20 | pin.length * 2); + + byte[] apdu = new byte[]{ + (byte) 0x00, (byte) 0x24, (byte) 0x01, kid, (byte) 0x08, + (byte) length, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF}; + for (int i = 0; i < pin.length; i++) { + apdu[i + 6] = pin[i]; + } + + CommandAPDU verifyAPDU = new CommandAPDU(apdu); + ResponseAPDU responseAPDU = channel.transmit(verifyAPDU); + + if (responseAPDU.getSW() != 0x9000) { + String msg = "Failed to activate PIN " + SMCCHelper.toString(new byte[]{kid}) + ": " + SMCCHelper.toString(responseAPDU.getBytes()); + log.error(msg); + throw new SignatureCardException(msg); + } + + + icc.endExclusive(); + + + } catch (CardException ex) { + log.error("Failed to get PIN status: " + ex.getMessage()); + throw new SignatureCardException("Failed to get PIN status", ex); + } + } + + private void changePIN(byte kid, byte[] contextAID, byte[] oldPIN, byte[] newPIN) throws SignatureCardException { + try { + Card icc = card.getCard(); + icc.beginExclusive(); + CardChannel channel = icc.getBasicChannel(); + + if (contextAID != null) { + CommandAPDU selectAPDU = new CommandAPDU(0x00, 0xa4, 0x04, 0x0c, contextAID); + ResponseAPDU responseAPDU = channel.transmit(selectAPDU); + if (responseAPDU.getSW() != 0x9000) { + String msg = "Failed to change PIN " + SMCCHelper.toString(new byte[]{kid}) + + ": Failed to select AID " + SMCCHelper.toString(contextAID) + + ": " + SMCCHelper.toString(responseAPDU.getBytes()); + log.error(msg); + throw new SignatureCardException(msg); + } + } + + if (oldPIN.length > 7 || newPIN.length > 7) { + log.error("Invalid PIN"); + throw new SignatureCardException("Invalid PIN"); + } + byte oldLength = (byte) (0x20 | oldPIN.length * 2); + byte newLength = (byte) (0x20 | newPIN.length * 2); + + byte[] apdu = new byte[]{ + (byte) 0x00, (byte) 0x24, (byte) 0x00, kid, (byte) 0x10, + oldLength, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, + newLength, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF}; + for (int i = 0; i < oldPIN.length; i++) { + apdu[i + 6] = oldPIN[i]; + } + for (int i = 0; i < newPIN.length; i++) { + apdu[i + 14] = newPIN[i]; + } + + CommandAPDU verifyAPDU = new CommandAPDU(apdu); + ResponseAPDU responseAPDU = channel.transmit(verifyAPDU); + + if (responseAPDU.getSW() != 0x9000) { + String msg = "Failed to change PIN " + SMCCHelper.toString(new byte[]{kid}) + ": " + SMCCHelper.toString(responseAPDU.getBytes()); + log.error(msg); + throw new SignatureCardException(msg); + } + + + icc.endExclusive(); + + + } catch (CardException ex) { + log.error("Failed to get PIN status: " + ex.getMessage()); + throw new SignatureCardException("Failed to get PIN status", ex); + } + } + + public Map getPINStatuses() throws SignatureCardException { + try { + Card icc = card.getCard(); + icc.beginExclusive(); + CardChannel channel = icc.getBasicChannel(); + + HashMap pinStatuses = new HashMap(); + List pins = card.getPINSpecs(); + + //select DF_SichereSignatur 00 A4 04 0C 08 D0 40 00 00 17 00 12 01 +// CommandAPDU selectAPDU = new CommandAPDU(new byte[]{(byte) 0x00, (byte) 0xa4, (byte) 0x04, (byte) 0x0c, (byte) 0x08, +// (byte) 0xd0, (byte) 0x40, (byte) 0x00, (byte) 0x00, (byte) 0x17, (byte) 0x00, (byte) 0x12, (byte) 0x01}); +// ResponseAPDU rAPDU = channel.transmit(selectAPDU); +// log.debug("SELECT FILE DF_SichereSignatur: " + SMCCHelper.toString(rAPDU.getBytes())); + + //select DF_SIG DF 70 +// CommandAPDU selectAPDU = new CommandAPDU(new byte[]{(byte) 0x00, (byte) 0xa4, (byte) 0x00, (byte) 0x0c, (byte) 0x02, +// (byte) 0xdf, (byte) 0x70 }); +// ResponseAPDU rAPDU = channel.transmit(selectAPDU); +// log.debug("SELECT FILE DF_SIG: " + SMCCHelper.toString(rAPDU.getBytes())); + + //select DF_DEC DF 71 +// CommandAPDU selectAPDU = new CommandAPDU(new byte[]{(byte) 0x00, (byte) 0xa4, (byte) 0x04, (byte) 0x0c, (byte) 0x08, +// (byte) 0xd0, (byte) 0x40, (byte) 0x00, (byte) 0x00, (byte) 0x17, (byte) 0x00, (byte) 0x12, (byte) 0x01}); +// ResponseAPDU rAPDU = channel.transmit(selectAPDU); +// log.debug("SELECT FILE DF_SichereSignatur: " + SMCCHelper.toString(rAPDU.getBytes())); + + for (PINSpec pinSpec : pins) { + byte kid = pinSpec.getKID(); + byte[] contextAID = pinSpec.getContextAID(); + + if (contextAID != null) { + CommandAPDU selectAPDU = new CommandAPDU(0x00, 0xa4, 0x04, 0x0c, contextAID); + ResponseAPDU responseAPDU = channel.transmit(selectAPDU); + if (responseAPDU.getSW() != 0x9000) { + String msg = "Failed to activate PIN " + SMCCHelper.toString(new byte[]{kid}) + + ": Failed to select AID " + SMCCHelper.toString(contextAID) + + ": " + SMCCHelper.toString(responseAPDU.getBytes()); + log.error(msg); + throw new SignatureCardException(msg); + } + } + + CommandAPDU verifyAPDU = new CommandAPDU(new byte[]{(byte) 0x00, (byte) 0x20, (byte) 00, kid}); + ResponseAPDU responseAPDU = channel.transmit(verifyAPDU); + + STATUS status = STATUS.UNKNOWN; + if (responseAPDU.getSW() == 0x6984) { + status = STATUS.NOT_ACTIV; + } else if (responseAPDU.getSW() == 0x63c0) { + status = STATUS.BLOCKED; + } else if (responseAPDU.getSW1() == 0x63) { + status = STATUS.ACTIV; + } + if (log.isDebugEnabled()) { + log.debug("PIN " + pinSpec.getLocalizedName() + " status: " + SMCCHelper.toString(responseAPDU.getBytes())); + } + + pinStatuses.put(pinSpec, status); + } + icc.endExclusive(); + + return pinStatuses; + + } catch (CardException ex) { + log.error("Failed to get PIN status: " + ex.getMessage()); + throw new SignatureCardException("Failed to get PIN status", ex); + } + } + + private byte[] encodePIN(char[] pinChars) { + int length = (int) Math.ceil(pinChars.length/2); + byte[] pin = new byte[length]; + for (int i = 0; i < length; i++) { + pin[i] = (byte) (16*Character.digit(pinChars[i*2], 16) + Character.digit(pinChars[i*2+1], 16)); + } + log.trace("***** " + SMCCHelper.toString(pin) + " ******"); + return pin; + } + + private void showPINManagementDialog(PINManagementGUIFacade gui) { + try { + Map pins = getPINStatuses(); + gui.showPINManagementDialog(pins, + this, "activate_enterpin", "change_enterpin", "unblock_enterpuk", + this, "cancel"); + } catch (SignatureCardException ex) { + gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN_WITH_PARAM, + new Object[]{"FAILED TO GET PIN STATUSES: " + ex.getMessage()}, + this, "cancel"); + } + } +} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PINMgmtRequestHandler.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PINMgmtRequestHandler.java deleted file mode 100644 index b2d34ff2..00000000 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PINMgmtRequestHandler.java +++ /dev/null @@ -1,93 +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.PINStatusProvider; -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; -import at.gv.egiz.stal.STALResponse; -import at.gv.egiz.stal.ext.ActivatePINRequest; -import at.gv.egiz.stal.ext.ChangePINRequest; -import at.gv.egiz.stal.ext.UnblockPINRequest; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.smartcardio.Card; -import javax.smartcardio.CardChannel; -import javax.smartcardio.CardException; -import javax.smartcardio.CommandAPDU; -import javax.smartcardio.ResponseAPDU; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * - * @author Clemens Orthacker - */ -public class PINMgmtRequestHandler extends AbstractRequestHandler implements PINStatusProvider { - - protected static final Log log = LogFactory.getLog(PINMgmtRequestHandler.class); - - @Override - public STALResponse handleRequest(STALRequest request) throws InterruptedException { - if (request instanceof ActivatePINRequest) { - log.error("not implemented yet"); - return new ErrorResponse(1000); - - } else if (request instanceof ChangePINRequest) { - log.error("not implemented yet"); - return new ErrorResponse(1000); - - } else if (request instanceof UnblockPINRequest) { - log.error("not implemented yet"); - return new ErrorResponse(1000); - - } else { - log.error("Got unexpected STAL request: " + request); - return new ErrorResponse(1000); - } - } - - @Override - public boolean requireCard() { - return true; - } - - @Override - public STATUS getPINStatus(int pin) throws SignatureCardException { - try { - Card icc = card.getCard(); - icc.beginExclusive(); - CardChannel channel = icc.getBasicChannel(); - CommandAPDU verifyAPDU = new CommandAPDU(new byte[] {(byte) 0x00} ); - ResponseAPDU responseAPDU = channel.transmit(verifyAPDU); - byte sw1 = (byte) responseAPDU.getSW1(); - byte[] sw = new byte[] { - (byte) (0xFF & responseAPDU.getSW1()), - (byte) (0xFF & responseAPDU.getSW2()) }; - - icc.endExclusive(); - return STATUS.ACTIV; - } catch (CardException ex) { - log.error("Failed to get PIN status: " + ex.getMessage()); - throw new SignatureCardException("Failed to get PIN status", ex); - } - } - -} diff --git a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties index 469af15f..e51044af 100644 --- a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties +++ b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties @@ -15,10 +15,34 @@ title.activation=Aktivierung title.pin.mgmt=PIN Verwaltung -message.pin.mgmt=under construction +title.activate.pin=PIN Aktivieren +title.change.pin=PIN \u00C4ndern +title.unblock.pin=PIN Entsperren + +message.pin.mgmt=Die Karte verf\u00FCgt \u00FCber {0} PINs +message.activate.pin={0} eingeben und best\u00E4tigen +message.change.pin={0} eingeben und best\u00E4tigen +message.unblock.pin=PUK zu {0} eingeben + label.activation=e-card Aktivierungsprozess label.activation.step=Schritt {0} label.activation.idle=Warte auf Server... +label.old.pin=Alte {0}: +label.new.pin=Neue {0}: +label.repeat.pin=Best\u00E4tigung: + button.activate=Aktivieren button.change=\u00C4ndern -button.unblock=Entsperren \ No newline at end of file +button.unblock=Entsperren + +help.activation=help.activation +help.pin.mgmt=help.pin.mgmt + +err.activate=Beim Aktivieren der {0} trat ein Fehler auf. +err.change=Beim \u00C4ndern der {0} trat ein Fehler auf. +err.unblock=Das Entsperren der {0} wird nicht unterst\u00FCtzt. + +status.not.active=NICHT AKTIV +status.active=AKTIV +status.blocked=GESPERRT +status.unknown=UNBEKANNT diff --git a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties index 16ac7d0b..1cf4a102 100644 --- a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties +++ b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties @@ -13,12 +13,36 @@ # See the License for the specific language governing permissions and # limitations under the License. -title.activation=Aktivation +title.activation=Activation title.pin.mgmt=PIN Management -message.pin.mgmt=under construction +title.activate.pin=Activate PIN +title.change.pin=Change PIN +title.unblock.pin=Unblock PIN + +message.pin.mgmt=The smartcard has {0} PINs +message.activate.pin=Enter and confirm {0} +message.change.pin=Enter and confirm {0} +message.unblock.pin=Enter PUK for {0} + label.activation=e-card activation process label.activation.step=Step {0} label.activation.idle=Wait for server... +label.old.pin=Old {0}: +label.new.pin=New {0}: +label.repeat.pin=Confirmation: + button.activate=Activate button.change=Change -button.unblock=Unblock \ No newline at end of file +button.unblock=Unblock + +help.activation=help.activation +help.pin.mgmt=help.pin.mgmt + +err.activate=An error occured during activation of {0}. +err.change=An error occured during changing of {0}. +err.unblock=Unblocking of {0} is not supported. + +status.not.active=Not active +status.active=Active +status.blocked=Blocked +status.unknown=Unknown diff --git a/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java index 669a63fc..ef8c87e4 100644 --- a/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java +++ b/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java @@ -25,8 +25,6 @@ import at.gv.egiz.stal.HashDataInput; import at.gv.egiz.stal.impl.ByteArrayHashDataInput; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.io.ByteArrayInputStream; -import java.io.InputStream; import java.util.ArrayList; import java.util.List; @@ -46,7 +44,7 @@ public class BKUGUIWorker implements Runnable { public void run() { try { - final PINSpec signPinSpec = new PINSpec(6, 10, "[0-9]", "Signatur-PIN"); + final PINSpec signPinSpec = new PINSpec(6, 10, "[0-9]", "Signatur-PIN", (byte)0x00, null); final ActionListener cancelListener = new ActionListener() { diff --git a/BKUAppletExt/src/test/resources/appletTest.html b/BKUAppletExt/src/test/resources/appletTest.html index 9add4309..813ee1f0 100644 --- a/BKUAppletExt/src/test/resources/appletTest.html +++ b/BKUAppletExt/src/test/resources/appletTest.html @@ -19,7 +19,7 @@
+ width=270 height=180> -- cgit v1.2.3 From 4387153c6f65b55d576e1890c5b582237227369e Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 27 Feb 2009 18:10:57 +0000 Subject: 1.1-rc2 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@310 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java | 18 ++++ .../java/at/gv/egiz/bku/gui/PINManagementGUI.java | 73 +++++++++----- .../at/gv/egiz/bku/gui/PINManagementGUIFacade.java | 3 +- .../java/at/gv/egiz/bku/gui/PINStatusRenderer.java | 2 +- .../bku/online/applet/PINManagementBKUWorker.java | 5 +- .../smccstal/ext/PINManagementRequestHandler.java | 105 ++++++++++++--------- .../gv/egiz/bku/gui/ActivationMessages.properties | 1 + .../egiz/bku/gui/ActivationMessages_en.properties | 13 +-- 8 files changed, 141 insertions(+), 79 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java index 4059f0e2..ac9ab78b 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java @@ -40,6 +40,12 @@ public class CardMgmtGUI extends BKUGUIImpl { AbstractHelpListener helpListener) { super(contentPane, locale, guiStyle, backgroundImgURL, helpListener); + } + + @Override + protected void loadMessageBundle(Locale locale) { + super.loadMessageBundle(locale); + if (locale != null) { Locale lang = new Locale(locale.getLanguage().substring(0,2)); log.debug("loading applet resources for language: " + lang.toString()); @@ -47,6 +53,18 @@ public class CardMgmtGUI extends BKUGUIImpl { } else { cardmgmtMessages = ResourceBundle.getBundle(CARDMGMT_MESSAGES_BUNDLE); } + } + + @Override + protected String getMessage(String key) { + if (super.hasMessage(key)) { + return super.getMessage(key); + } + return cardmgmtMessages.getString(key); + } + @Override + protected boolean hasMessage(String key) { + return (cardmgmtMessages.containsKey(key) || super.hasMessage(key)); } } diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java index 8eef8aea..1276f2d0 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java @@ -39,13 +39,17 @@ import javax.swing.ListSelectionModel; import javax.swing.SwingUtilities; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; /** * TODO pull out ResourceBundle to common superclass for activationGUI and pinMgmtGUI * @author Clemens Orthacker */ -public class PINManagementGUI extends ActivationGUI implements PINManagementGUIFacade { +public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFacade { + protected static final Log log = LogFactory.getLog(PINManagementGUI.class); + /** remember the pinfield to return to worker */ protected JPasswordField oldPinField; /** remember the pinSpec to return to worker */ @@ -70,7 +74,7 @@ public class PINManagementGUI extends ActivationGUI implements PINManagementGUIF } @Override - public PINSpec getSelectedPIN() { + public PINSpec getSelectedPINSpec() { return pinSpec; } @@ -100,11 +104,11 @@ public class PINManagementGUI extends ActivationGUI implements PINManagementGUIF mgmtLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); if (renderHeaderPanel) { - titleLabel.setText(cardmgmtMessages.getString(TITLE_PINMGMT)); - String infoPattern = cardmgmtMessages.getString(MESSAGE_PINMGMT); + titleLabel.setText(getMessage(TITLE_PINMGMT)); + String infoPattern = getMessage(MESSAGE_PINMGMT); mgmtLabel.setText(MessageFormat.format(infoPattern, pins.size())); } else { - mgmtLabel.setText(cardmgmtMessages.getString(TITLE_PINMGMT)); + mgmtLabel.setText(getMessage(TITLE_PINMGMT)); } final PINStatusTableModel tableModel = new PINStatusTableModel(pins); @@ -146,19 +150,19 @@ public class PINManagementGUI extends ActivationGUI implements PINManagementGUIF STATUS status = (STATUS) tableModel.getValueAt(selectionIdx, 1); if (status == STATUS.NOT_ACTIV) { - activateButton.setText(cardmgmtMessages.getString(BUTTON_ACTIVATE)); + activateButton.setText(getMessage(BUTTON_ACTIVATE)); activateButton.setEnabled(true); activateButton.setActionCommand(activateCmd); } else if (status == STATUS.BLOCKED) { - activateButton.setText(cardmgmtMessages.getString(BUTTON_UNBLOCK)); + activateButton.setText(getMessage(BUTTON_UNBLOCK)); activateButton.setEnabled(true); activateButton.setActionCommand(unblockCmd); } else if (status == STATUS.ACTIV) { - activateButton.setText(cardmgmtMessages.getString(BUTTON_CHANGE)); + activateButton.setText(getMessage(BUTTON_CHANGE)); activateButton.setEnabled(true); activateButton.setActionCommand(changeCmd); } else { - activateButton.setText(cardmgmtMessages.getString(BUTTON_ACTIVATE)); + activateButton.setText(getMessage(BUTTON_ACTIVATE)); activateButton.setEnabled(false); } } @@ -200,7 +204,7 @@ public class PINManagementGUI extends ActivationGUI implements PINManagementGUIF JButton cancelButton = new JButton(); cancelButton.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD)); - cancelButton.setText(messages.getString(BUTTON_CANCEL)); + cancelButton.setText(getMessage(BUTTON_CLOSE)); cancelButton.setActionCommand(cancelCmd); cancelButton.addActionListener(cancelListener); @@ -266,27 +270,27 @@ public class PINManagementGUI extends ActivationGUI implements PINManagementGUIF mgmtLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); if (renderHeaderPanel) { - titleLabel.setText(cardmgmtMessages.getString(TITLE)); - String mgmtPattern = cardmgmtMessages.getString(MESSAGE_MGMT); + titleLabel.setText(getMessage(TITLE)); + String mgmtPattern = getMessage(MESSAGE_MGMT); if (shortText) { mgmtLabel.setText(MessageFormat.format(mgmtPattern, "PIN")); } else { mgmtLabel.setText(MessageFormat.format(mgmtPattern, pinSpec.getLocalizedName())); } } else { - mgmtLabel.setText(cardmgmtMessages.getString(TITLE)); + mgmtLabel.setText(getMessage(TITLE)); } JButton okButton = new JButton(); okButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle() & ~java.awt.Font.BOLD)); - okButton.setText(messages.getString(BUTTON_OK)); + okButton.setText(getMessage(BUTTON_OK)); okButton.setEnabled(false); okButton.setActionCommand(okCommand); okButton.addActionListener(okListener); JLabel pinLabel = new JLabel(); pinLabel.setFont(pinLabel.getFont().deriveFont(pinLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - String pinLabelPattern = (changePin) ? cardmgmtMessages.getString(LABEL_NEW_PIN) : messages.getString(LABEL_PIN); + String pinLabelPattern = (changePin) ? getMessage(LABEL_NEW_PIN) : getMessage(LABEL_PIN); pinLabel.setText(MessageFormat.format(pinLabelPattern, new Object[]{pinSpec.getLocalizedName()})); final JPasswordField repeatPinField = new JPasswordField(); @@ -305,7 +309,7 @@ public class PINManagementGUI extends ActivationGUI implements PINManagementGUIF }); JLabel repeatPinLabel = new JLabel(); repeatPinLabel.setFont(pinLabel.getFont()); - String repeatPinLabelPattern = cardmgmtMessages.getString(LABEL_REPEAT_PIN); + String repeatPinLabelPattern = getMessage(LABEL_REPEAT_PIN); repeatPinLabel.setText(MessageFormat.format(repeatPinLabelPattern, new Object[]{pinSpec.getLocalizedName()})); repeatPinField.setText(""); @@ -325,7 +329,7 @@ public class PINManagementGUI extends ActivationGUI implements PINManagementGUIF if (changePin) { oldPinLabel = new JLabel(); oldPinLabel.setFont(oldPinLabel.getFont().deriveFont(oldPinLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - String oldPinLabelPattern = cardmgmtMessages.getString(LABEL_OLD_PIN); + String oldPinLabelPattern = getMessage(LABEL_OLD_PIN); oldPinLabel.setText(MessageFormat.format(oldPinLabelPattern, new Object[]{pinSpec.getLocalizedName()})); oldPinField = new JPasswordField(); @@ -345,7 +349,7 @@ public class PINManagementGUI extends ActivationGUI implements PINManagementGUIF JLabel pinsizeLabel = new JLabel(); pinsizeLabel.setFont(pinsizeLabel.getFont().deriveFont(pinsizeLabel.getFont().getStyle() & ~java.awt.Font.BOLD, pinsizeLabel.getFont().getSize()-2)); - String pinsizePattern = messages.getString(LABEL_PINSIZE); + String pinsizePattern = getMessage(LABEL_PINSIZE); String pinSize = String.valueOf(pinSpec.getMinLength()); if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { pinSize += "-" + pinSpec.getMaxLength(); @@ -468,7 +472,7 @@ public class PINManagementGUI extends ActivationGUI implements PINManagementGUIF JButton cancelButton = new JButton(); cancelButton.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD)); - cancelButton.setText(messages.getString(BUTTON_CANCEL)); + cancelButton.setText(getMessage(BUTTON_CANCEL)); cancelButton.setActionCommand(cancelCommand); cancelButton.addActionListener(cancelListener); @@ -522,12 +526,12 @@ public class PINManagementGUI extends ActivationGUI implements PINManagementGUIF buttonPanel.removeAll(); if (renderHeaderPanel) { - titleLabel.setText(messages.getString(TITLE_ERROR)); + titleLabel.setText(getMessage(TITLE_ERROR)); } helpListener.setHelpTopic(HELP_PINMGMT); - String errorMsgPattern = cardmgmtMessages.getString(ERR_UNBLOCK); + String errorMsgPattern = getMessage(ERR_UNBLOCK); String errorMsg = MessageFormat.format(errorMsgPattern, pin.getLocalizedName()); JLabel errorMsgLabel = new JLabel(); @@ -543,7 +547,7 @@ public class PINManagementGUI extends ActivationGUI implements PINManagementGUIF if (!renderHeaderPanel) { JLabel errorTitleLabel = new JLabel(); errorTitleLabel.setFont(errorTitleLabel.getFont().deriveFont(errorTitleLabel.getFont().getStyle() | java.awt.Font.BOLD)); - errorTitleLabel.setText(messages.getString(TITLE_ERROR)); + errorTitleLabel.setText(getMessage(TITLE_ERROR)); errorTitleLabel.setForeground(ERROR_COLOR); mainHorizontal @@ -564,7 +568,7 @@ public class PINManagementGUI extends ActivationGUI implements PINManagementGUIF JButton okButton = new JButton(); okButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle() & ~java.awt.Font.BOLD)); - okButton.setText(messages.getString(BUTTON_OK)); + okButton.setText(getMessage(BUTTON_OK)); okButton.setActionCommand(cancelCommand); okButton.addActionListener(cancelListener); @@ -584,5 +588,28 @@ public class PINManagementGUI extends ActivationGUI implements PINManagementGUIF }); } + @Override + protected int initButtonSize() { + int bs = super.initButtonSize(); + JButton b = new JButton(); + b.setText(getMessage(BUTTON_ACTIVATE)); + if (b.getPreferredSize().width > bs) { + bs = b.getPreferredSize().width; + } + b.setText(getMessage(BUTTON_CHANGE)); + if (b.getPreferredSize().width > bs) { + bs = b.getPreferredSize().width; + } + b.setText(getMessage(BUTTON_UNBLOCK)); + if (b.getPreferredSize().width > bs) { + bs = b.getPreferredSize().width; + } + b.setText(getMessage(BUTTON_CANCEL)); + if (b.getPreferredSize().width > bs) { + bs = b.getPreferredSize().width; + } + + return bs; + } } 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 2a8f28d2..ffdc230d 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 @@ -43,6 +43,7 @@ public interface PINManagementGUIFacade extends BKUGUIFacade { public static final String ERR_ACTIVATE = "err.activate"; public static final String ERR_CHANGE = "err.change"; public static final String ERR_UNBLOCK = "err.unblock"; + public static final String ERR_RETRIES = "err.retries"; public static final String BUTTON_ACTIVATE = "button.activate"; public static final String BUTTON_UNBLOCK = "button.unblock"; @@ -73,5 +74,5 @@ public interface PINManagementGUIFacade extends BKUGUIFacade { public char[] getOldPin(); - public PINSpec getSelectedPIN(); + public PINSpec getSelectedPINSpec(); } diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java index 2f8852ff..4cb84b77 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java @@ -31,7 +31,7 @@ import org.apache.commons.logging.LogFactory; */ public class PINStatusRenderer extends DefaultTableCellRenderer { - private static final Log log = LogFactory.getLog(PINStatusRenderer.class); +// private static final Log log = LogFactory.getLog(PINStatusRenderer.class); public static final Color RED = new Color(0.9f, 0.0f, 0.0f); public static final Color GREEN = new Color(0.0f, 0.8f, 0.0f); diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java index ffd83e42..85892026 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java @@ -25,8 +25,6 @@ import at.gv.egiz.stal.ext.PINManagementRequest; import at.gv.egiz.stal.ext.PINManagementResponse; import java.util.Collections; import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; /** * This BKU Worker does not connect to STAL webservice @@ -52,8 +50,9 @@ public class PINManagementBKUWorker extends AppletBKUWorker { if (responses.size() == 1) { STALResponse response = responses.get(0); if (response instanceof PINManagementResponse) { - log.debug("PIN management dialog finished"); + log.debug("PIN management dialog terminated"); } else if (response instanceof ErrorResponse) { + log.debug("PIN management dialog terminated with error"); showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, null); } else { throw new RuntimeException("Invalid STAL response: " + response.getClass().getName()); 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 fcef3191..851bff21 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 @@ -22,6 +22,7 @@ import at.gv.egiz.bku.gui.PINManagementGUIFacade.STATUS; import at.gv.egiz.bku.smccstal.AbstractRequestHandler; import at.gv.egiz.smcc.PINSpec; import at.gv.egiz.smcc.SignatureCardException; +import at.gv.egiz.smcc.VerificationFailedException; import at.gv.egiz.smcc.util.SMCCHelper; import at.gv.egiz.stal.ErrorResponse; import at.gv.egiz.stal.STALRequest; @@ -31,6 +32,8 @@ import at.gv.egiz.stal.ext.PINManagementResponse; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; import javax.smartcardio.Card; import javax.smartcardio.CardChannel; import javax.smartcardio.CardException; @@ -45,7 +48,6 @@ import org.apache.commons.logging.LogFactory; */ public class PINManagementRequestHandler extends AbstractRequestHandler { - public static final String ERR_NOPIN_SELECTED = "err.no.pin.selected"; protected static final Log log = LogFactory.getLog(PINManagementRequestHandler.class); // protected ResourceBundle messages; @@ -70,7 +72,7 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { } else if ("back".equals(actionCommand)) { showPINManagementDialog(gui); } else { - PINSpec selectedPIN = gui.getSelectedPIN(); + PINSpec selectedPIN = gui.getSelectedPINSpec(); if (selectedPIN == null) { throw new RuntimeException("no PIN selected for activation/change"); @@ -99,6 +101,11 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { byte[] pin = encodePIN(gui.getPin()); //new byte[]{(byte) 0x25, (byte) 0x40}; changePIN(selectedPIN.getKID(), selectedPIN.getContextAID(), oldPin, pin); showPINManagementDialog(gui); + } catch (VerificationFailedException ex) { + log.error("failed to change " + selectedPIN.getLocalizedName() + ": " + ex.getMessage()); + gui.showErrorDialog(PINManagementGUIFacade.ERR_RETRIES, + new Object[] {selectedPIN.getLocalizedName(), ex.getRetries()}, + this, "back"); } catch (SignatureCardException ex) { log.error("failed to change " + selectedPIN.getLocalizedName() + ": " + ex.getMessage()); gui.showErrorDialog(PINManagementGUIFacade.ERR_CHANGE, @@ -132,8 +139,8 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { * @throws at.gv.egiz.smcc.SignatureCardException */ private void activatePIN(byte kid, byte[] contextAID, byte[] pin) throws SignatureCardException { + Card icc = card.getCard(); try { - Card icc = card.getCard(); icc.beginExclusive(); CardChannel channel = icc.getBasicChannel(); @@ -141,6 +148,7 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { CommandAPDU selectAPDU = new CommandAPDU(0x00, 0xa4, 0x04, 0x0c, contextAID); ResponseAPDU responseAPDU = channel.transmit(selectAPDU); if (responseAPDU.getSW() != 0x9000) { + icc.endExclusive(); String msg = "Failed to activate PIN " + SMCCHelper.toString(new byte[]{kid}) + ": Failed to select AID " + SMCCHelper.toString(contextAID) + ": " + SMCCHelper.toString(responseAPDU.getBytes()); @@ -150,8 +158,9 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { } if (pin.length > 7) { - log.error("Invalid PIN"); - throw new SignatureCardException("Invalid PIN"); + icc.endExclusive(); + log.error("PIN too long"); + throw new SignatureCardException("PIN too long"); } byte length = (byte) (0x20 | pin.length * 2); @@ -166,24 +175,27 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { ResponseAPDU responseAPDU = channel.transmit(verifyAPDU); if (responseAPDU.getSW() != 0x9000) { + icc.endExclusive(); String msg = "Failed to activate PIN " + SMCCHelper.toString(new byte[]{kid}) + ": " + SMCCHelper.toString(responseAPDU.getBytes()); log.error(msg); throw new SignatureCardException(msg); } - - icc.endExclusive(); - - } catch (CardException ex) { - log.error("Failed to get PIN status: " + ex.getMessage()); - throw new SignatureCardException("Failed to get PIN status", ex); + log.error("Failed to activate PIN: " + ex.getMessage()); + throw new SignatureCardException(ex.getMessage(), ex); + } finally { + try { + icc.endExclusive(); + } catch (CardException ex) { + log.trace("failed to end exclusive card access"); + } } } - private void changePIN(byte kid, byte[] contextAID, byte[] oldPIN, byte[] newPIN) throws SignatureCardException { + private void changePIN(byte kid, byte[] contextAID, byte[] oldPIN, byte[] newPIN) throws SignatureCardException, VerificationFailedException { + Card icc = card.getCard(); try { - Card icc = card.getCard(); icc.beginExclusive(); CardChannel channel = icc.getBasicChannel(); @@ -191,6 +203,7 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { CommandAPDU selectAPDU = new CommandAPDU(0x00, 0xa4, 0x04, 0x0c, contextAID); ResponseAPDU responseAPDU = channel.transmit(selectAPDU); if (responseAPDU.getSW() != 0x9000) { + icc.endExclusive(); String msg = "Failed to change PIN " + SMCCHelper.toString(new byte[]{kid}) + ": Failed to select AID " + SMCCHelper.toString(contextAID) + ": " + SMCCHelper.toString(responseAPDU.getBytes()); @@ -200,8 +213,9 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { } if (oldPIN.length > 7 || newPIN.length > 7) { - log.error("Invalid PIN"); - throw new SignatureCardException("Invalid PIN"); + icc.endExclusive(); + log.error("PIN too long"); + throw new SignatureCardException("PIN too long"); } byte oldLength = (byte) (0x20 | oldPIN.length * 2); byte newLength = (byte) (0x20 | newPIN.length * 2); @@ -220,49 +234,43 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { CommandAPDU verifyAPDU = new CommandAPDU(apdu); ResponseAPDU responseAPDU = channel.transmit(verifyAPDU); + if (responseAPDU.getSW1() == 0x63 && responseAPDU.getSW2() >> 4 == 0xc) { + icc.endExclusive(); + int retries = responseAPDU.getSW2() & 0x0f; + log.error("Wrong PIN, " + retries + " tries left"); + throw new VerificationFailedException(retries); + } if (responseAPDU.getSW() != 0x9000) { - String msg = "Failed to change PIN " + SMCCHelper.toString(new byte[]{kid}) + ": " + SMCCHelper.toString(responseAPDU.getBytes()); + icc.endExclusive(); + String msg = "Failed to change PIN " + + SMCCHelper.toString(new byte[]{kid}) + ": " + + SMCCHelper.toString(responseAPDU.getBytes()); log.error(msg); throw new SignatureCardException(msg); } - - - icc.endExclusive(); - + } catch (CardException ex) { - log.error("Failed to get PIN status: " + ex.getMessage()); - throw new SignatureCardException("Failed to get PIN status", ex); + log.error("Failed to change PIN: " + ex.getMessage()); + throw new SignatureCardException(ex.getMessage(), ex); + } finally { + try { + icc.endExclusive(); + } catch (CardException ex) { + log.trace("failed to end exclusive card access"); + } } } public Map getPINStatuses() throws SignatureCardException { + Card icc = card.getCard(); try { - Card icc = card.getCard(); icc.beginExclusive(); CardChannel channel = icc.getBasicChannel(); HashMap pinStatuses = new HashMap(); List pins = card.getPINSpecs(); - //select DF_SichereSignatur 00 A4 04 0C 08 D0 40 00 00 17 00 12 01 -// CommandAPDU selectAPDU = new CommandAPDU(new byte[]{(byte) 0x00, (byte) 0xa4, (byte) 0x04, (byte) 0x0c, (byte) 0x08, -// (byte) 0xd0, (byte) 0x40, (byte) 0x00, (byte) 0x00, (byte) 0x17, (byte) 0x00, (byte) 0x12, (byte) 0x01}); -// ResponseAPDU rAPDU = channel.transmit(selectAPDU); -// log.debug("SELECT FILE DF_SichereSignatur: " + SMCCHelper.toString(rAPDU.getBytes())); - - //select DF_SIG DF 70 -// CommandAPDU selectAPDU = new CommandAPDU(new byte[]{(byte) 0x00, (byte) 0xa4, (byte) 0x00, (byte) 0x0c, (byte) 0x02, -// (byte) 0xdf, (byte) 0x70 }); -// ResponseAPDU rAPDU = channel.transmit(selectAPDU); -// log.debug("SELECT FILE DF_SIG: " + SMCCHelper.toString(rAPDU.getBytes())); - - //select DF_DEC DF 71 -// CommandAPDU selectAPDU = new CommandAPDU(new byte[]{(byte) 0x00, (byte) 0xa4, (byte) 0x04, (byte) 0x0c, (byte) 0x08, -// (byte) 0xd0, (byte) 0x40, (byte) 0x00, (byte) 0x00, (byte) 0x17, (byte) 0x00, (byte) 0x12, (byte) 0x01}); -// ResponseAPDU rAPDU = channel.transmit(selectAPDU); -// log.debug("SELECT FILE DF_SichereSignatur: " + SMCCHelper.toString(rAPDU.getBytes())); - for (PINSpec pinSpec : pins) { byte kid = pinSpec.getKID(); byte[] contextAID = pinSpec.getContextAID(); @@ -271,6 +279,7 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { CommandAPDU selectAPDU = new CommandAPDU(0x00, 0xa4, 0x04, 0x0c, contextAID); ResponseAPDU responseAPDU = channel.transmit(selectAPDU); if (responseAPDU.getSW() != 0x9000) { + icc.endExclusive(); String msg = "Failed to activate PIN " + SMCCHelper.toString(new byte[]{kid}) + ": Failed to select AID " + SMCCHelper.toString(contextAID) + ": " + SMCCHelper.toString(responseAPDU.getBytes()); @@ -296,13 +305,19 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { pinStatuses.put(pinSpec, status); } - icc.endExclusive(); +// icc.endExclusive(); return pinStatuses; } catch (CardException ex) { log.error("Failed to get PIN status: " + ex.getMessage()); - throw new SignatureCardException("Failed to get PIN status", ex); + throw new SignatureCardException(ex.getMessage(), ex); + } finally { + try { + icc.endExclusive(); + } catch (CardException ex) { + log.trace("failed to end exclusive card access"); + } } } @@ -312,7 +327,7 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { for (int i = 0; i < length; i++) { pin[i] = (byte) (16*Character.digit(pinChars[i*2], 16) + Character.digit(pinChars[i*2+1], 16)); } - log.trace("***** " + SMCCHelper.toString(pin) + " ******"); +// log.trace("***** " + SMCCHelper.toString(pin) + " ******"); return pin; } @@ -324,7 +339,7 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { this, "cancel"); } catch (SignatureCardException ex) { gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN_WITH_PARAM, - new Object[]{"FAILED TO GET PIN STATUSES: " + ex.getMessage()}, + new Object[]{ex.getMessage()}, this, "cancel"); } } diff --git a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties index e51044af..b6099db6 100644 --- a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties +++ b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties @@ -41,6 +41,7 @@ help.pin.mgmt=help.pin.mgmt err.activate=Beim Aktivieren der {0} trat ein Fehler auf. err.change=Beim \u00C4ndern der {0} trat ein Fehler auf. err.unblock=Das Entsperren der {0} wird nicht unterst\u00FCtzt. +err.retries=Falscher {0}, noch {1} Versuche status.not.active=NICHT AKTIV status.active=AKTIV diff --git a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties index 1cf4a102..40332826 100644 --- a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties +++ b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties @@ -38,11 +38,12 @@ button.unblock=Unblock help.activation=help.activation help.pin.mgmt=help.pin.mgmt -err.activate=An error occured during activation of {0}. -err.change=An error occured during changing of {0}. +err.activate=An error occured during the activation of {0}. +err.change=An error occured during the changing of {0}. err.unblock=Unblocking of {0} is not supported. +err.retries=Wrong {0}, {1} tries remaining -status.not.active=Not active -status.active=Active -status.blocked=Blocked -status.unknown=Unknown +status.not.active=NOT ACTIVE +status.active=ACTIVE +status.blocked=BLOCKED +status.unknown=UNKNOWN -- cgit v1.2.3 From a8690cc956924e1d83b0c45d21995ee2e10fbba2 Mon Sep 17 00:00:00 2001 From: clemenso Date: Wed, 4 Mar 2009 16:44:34 +0000 Subject: 1.1-rc3 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@311 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../at/gv/egiz/bku/gui/PINManagementGUIFacade.java | 4 + .../smccstal/ext/PINManagementRequestHandler.java | 170 +++------------------ .../gv/egiz/bku/gui/ActivationMessages.properties | 4 + .../egiz/bku/gui/ActivationMessages_en.properties | 4 + 4 files changed, 29 insertions(+), 153 deletions(-) (limited to 'BKUAppletExt') 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 ffdc230d..6b083e16 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 @@ -32,6 +32,10 @@ public interface PINManagementGUIFacade extends BKUGUIFacade { public static final String TITLE_ACTIVATE_PIN = "title.activate.pin"; public static final String TITLE_CHANGE_PIN = "title.change.pin"; public static final String TITLE_UNBLOCK_PIN = "title.unblock.pin"; + public static final String TITLE_ACTIVATE_SUCCESS = "title.activate.success"; + public static final String TITLE_CHANGE_SUCCESS = "title.change.success"; + public static final String MESSAGE_ACTIVATE_SUCCESS = "message.activate.success"; + public static final String MESSAGE_CHANGE_SUCCESS = "message.change.success"; public static final String MESSAGE_PINMGMT = "message.pin.mgmt"; public static final String MESSAGE_ACTIVATE_PIN = "message.activate.pin"; public static final String MESSAGE_CHANGE_PIN = "message.change.pin"; 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 851bff21..c8472c97 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 @@ -32,8 +32,6 @@ import at.gv.egiz.stal.ext.PINManagementResponse; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; import javax.smartcardio.Card; import javax.smartcardio.CardChannel; import javax.smartcardio.CardException; @@ -50,11 +48,6 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { protected static final Log log = LogFactory.getLog(PINManagementRequestHandler.class); -// protected ResourceBundle messages; - -// public PINManagementRequestHandler(ResourceBundle messages) { -// this.messages = messages; -// } @Override public STALResponse handleRequest(STALRequest request) throws InterruptedException { if (request instanceof PINManagementRequest) { @@ -86,8 +79,14 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { gui.showUnblockPINDialog(selectedPIN, this, "unblock", this, "back"); } else if ("activate".equals(actionCommand)) { try { - byte[] pin = encodePIN(gui.getPin()); - activatePIN(selectedPIN.getKID(), selectedPIN.getContextAID(), pin); + card.activatePIN(selectedPIN.getKID(), + selectedPIN.getContextAID(), + String.valueOf(gui.getPin())); + gui.showMessageDialog(PINManagementGUIFacade.TITLE_ACTIVATE_SUCCESS, + PINManagementGUIFacade.MESSAGE_ACTIVATE_SUCCESS, + new Object[] {selectedPIN.getLocalizedName()}, + this, "ok"); + waitForAction(); showPINManagementDialog(gui); } catch (SignatureCardException ex) { log.error("failed to activate " + selectedPIN.getLocalizedName() + ": " + ex.getMessage()); @@ -97,9 +96,15 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { } } else if ("change".equals(actionCommand)) { try { - byte[] oldPin = encodePIN(gui.getOldPin()); //new byte[]{(byte) 0x25, (byte) 0x40, (byte) 0x01}; - byte[] pin = encodePIN(gui.getPin()); //new byte[]{(byte) 0x25, (byte) 0x40}; - changePIN(selectedPIN.getKID(), selectedPIN.getContextAID(), oldPin, pin); + card.changePIN(selectedPIN.getKID(), + selectedPIN.getContextAID(), + String.valueOf(gui.getOldPin()), + String.valueOf(gui.getPin())); + gui.showMessageDialog(PINManagementGUIFacade.TITLE_CHANGE_SUCCESS, + PINManagementGUIFacade.MESSAGE_CHANGE_SUCCESS, + new Object[] {selectedPIN.getLocalizedName()}, + this, "ok"); + waitForAction(); showPINManagementDialog(gui); } catch (VerificationFailedException ex) { log.error("failed to change " + selectedPIN.getLocalizedName() + ": " + ex.getMessage()); @@ -131,137 +136,6 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { return true; } - /** - * pin.length < 4bit - * @param kid - * @param contextAID - * @param pin - * @throws at.gv.egiz.smcc.SignatureCardException - */ - private void activatePIN(byte kid, byte[] contextAID, byte[] pin) throws SignatureCardException { - Card icc = card.getCard(); - try { - icc.beginExclusive(); - CardChannel channel = icc.getBasicChannel(); - - if (contextAID != null) { - CommandAPDU selectAPDU = new CommandAPDU(0x00, 0xa4, 0x04, 0x0c, contextAID); - ResponseAPDU responseAPDU = channel.transmit(selectAPDU); - if (responseAPDU.getSW() != 0x9000) { - icc.endExclusive(); - String msg = "Failed to activate PIN " + SMCCHelper.toString(new byte[]{kid}) + - ": Failed to select AID " + SMCCHelper.toString(contextAID) + - ": " + SMCCHelper.toString(responseAPDU.getBytes()); - log.error(msg); - throw new SignatureCardException(msg); - } - } - - if (pin.length > 7) { - icc.endExclusive(); - log.error("PIN too long"); - throw new SignatureCardException("PIN too long"); - } - byte length = (byte) (0x20 | pin.length * 2); - - byte[] apdu = new byte[]{ - (byte) 0x00, (byte) 0x24, (byte) 0x01, kid, (byte) 0x08, - (byte) length, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF}; - for (int i = 0; i < pin.length; i++) { - apdu[i + 6] = pin[i]; - } - - CommandAPDU verifyAPDU = new CommandAPDU(apdu); - ResponseAPDU responseAPDU = channel.transmit(verifyAPDU); - - if (responseAPDU.getSW() != 0x9000) { - icc.endExclusive(); - String msg = "Failed to activate PIN " + SMCCHelper.toString(new byte[]{kid}) + ": " + SMCCHelper.toString(responseAPDU.getBytes()); - log.error(msg); - throw new SignatureCardException(msg); - } - icc.endExclusive(); - } catch (CardException ex) { - log.error("Failed to activate PIN: " + ex.getMessage()); - throw new SignatureCardException(ex.getMessage(), ex); - } finally { - try { - icc.endExclusive(); - } catch (CardException ex) { - log.trace("failed to end exclusive card access"); - } - } - } - - private void changePIN(byte kid, byte[] contextAID, byte[] oldPIN, byte[] newPIN) throws SignatureCardException, VerificationFailedException { - Card icc = card.getCard(); - try { - icc.beginExclusive(); - CardChannel channel = icc.getBasicChannel(); - - if (contextAID != null) { - CommandAPDU selectAPDU = new CommandAPDU(0x00, 0xa4, 0x04, 0x0c, contextAID); - ResponseAPDU responseAPDU = channel.transmit(selectAPDU); - if (responseAPDU.getSW() != 0x9000) { - icc.endExclusive(); - String msg = "Failed to change PIN " + SMCCHelper.toString(new byte[]{kid}) + - ": Failed to select AID " + SMCCHelper.toString(contextAID) + - ": " + SMCCHelper.toString(responseAPDU.getBytes()); - log.error(msg); - throw new SignatureCardException(msg); - } - } - - if (oldPIN.length > 7 || newPIN.length > 7) { - icc.endExclusive(); - log.error("PIN too long"); - throw new SignatureCardException("PIN too long"); - } - byte oldLength = (byte) (0x20 | oldPIN.length * 2); - byte newLength = (byte) (0x20 | newPIN.length * 2); - - byte[] apdu = new byte[]{ - (byte) 0x00, (byte) 0x24, (byte) 0x00, kid, (byte) 0x10, - oldLength, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, - newLength, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF}; - for (int i = 0; i < oldPIN.length; i++) { - apdu[i + 6] = oldPIN[i]; - } - for (int i = 0; i < newPIN.length; i++) { - apdu[i + 14] = newPIN[i]; - } - - CommandAPDU verifyAPDU = new CommandAPDU(apdu); - ResponseAPDU responseAPDU = channel.transmit(verifyAPDU); - - if (responseAPDU.getSW1() == 0x63 && responseAPDU.getSW2() >> 4 == 0xc) { - icc.endExclusive(); - int retries = responseAPDU.getSW2() & 0x0f; - log.error("Wrong PIN, " + retries + " tries left"); - throw new VerificationFailedException(retries); - } - if (responseAPDU.getSW() != 0x9000) { - icc.endExclusive(); - String msg = "Failed to change PIN " - + SMCCHelper.toString(new byte[]{kid}) + ": " - + SMCCHelper.toString(responseAPDU.getBytes()); - log.error(msg); - throw new SignatureCardException(msg); - } - - - } catch (CardException ex) { - log.error("Failed to change PIN: " + ex.getMessage()); - throw new SignatureCardException(ex.getMessage(), ex); - } finally { - try { - icc.endExclusive(); - } catch (CardException ex) { - log.trace("failed to end exclusive card access"); - } - } - } - public Map getPINStatuses() throws SignatureCardException { Card icc = card.getCard(); try { @@ -321,16 +195,6 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { } } - private byte[] encodePIN(char[] pinChars) { - int length = (int) Math.ceil(pinChars.length/2); - byte[] pin = new byte[length]; - for (int i = 0; i < length; i++) { - pin[i] = (byte) (16*Character.digit(pinChars[i*2], 16) + Character.digit(pinChars[i*2+1], 16)); - } -// log.trace("***** " + SMCCHelper.toString(pin) + " ******"); - return pin; - } - private void showPINManagementDialog(PINManagementGUIFacade gui) { try { Map pins = getPINStatuses(); diff --git a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties index b6099db6..430f85b5 100644 --- a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties +++ b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties @@ -18,11 +18,15 @@ title.pin.mgmt=PIN Verwaltung title.activate.pin=PIN Aktivieren title.change.pin=PIN \u00C4ndern title.unblock.pin=PIN Entsperren +title.activate.success=Erfolg +title.change.success=Erfolg message.pin.mgmt=Die Karte verf\u00FCgt \u00FCber {0} PINs message.activate.pin={0} eingeben und best\u00E4tigen message.change.pin={0} eingeben und best\u00E4tigen message.unblock.pin=PUK zu {0} eingeben +message.activate.success={0} wurde erfolgreich aktiviert. +message.change.success={0} wurde erfolgreich ge\u00E4ndert. label.activation=e-card Aktivierungsprozess label.activation.step=Schritt {0} diff --git a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties index 40332826..98d18633 100644 --- a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties +++ b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties @@ -18,11 +18,15 @@ title.pin.mgmt=PIN Management title.activate.pin=Activate PIN title.change.pin=Change PIN title.unblock.pin=Unblock PIN +title.activate.success=Success +title.change.success=Success message.pin.mgmt=The smartcard has {0} PINs message.activate.pin=Enter and confirm {0} message.change.pin=Enter and confirm {0} message.unblock.pin=Enter PUK for {0} +message.activate.success={0} successfully activated +message.change.success={0} successfully changed label.activation=e-card activation process label.activation.step=Step {0} -- cgit v1.2.3 From e177419331b8849497d25d3eb1866c5dc715bc88 Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 6 Mar 2009 14:53:37 +0000 Subject: 1.1-rc4 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@312 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../java/at/gv/egiz/bku/gui/PINManagementGUI.java | 229 +++++++++------ .../at/gv/egiz/bku/gui/PINManagementGUIFacade.java | 13 +- .../at/gv/egiz/bku/gui/PINStatusTableModel.java | 6 +- .../bku/smccstal/ext/GetPINStatusException.java | 41 +++ .../smccstal/ext/PINManagementRequestHandler.java | 312 ++++++++++++++++----- .../gv/egiz/bku/gui/ActivationMessages.properties | 7 + .../egiz/bku/gui/ActivationMessages_en.properties | 4 + 7 files changed, 446 insertions(+), 166 deletions(-) create mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/GetPINStatusException.java (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java index 1276f2d0..c904be0c 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java @@ -20,6 +20,7 @@ package at.gv.egiz.bku.gui; import at.gv.egiz.smcc.PINSpec; import java.awt.Container; import java.awt.Cursor; +import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; @@ -55,6 +56,8 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac /** remember the pinSpec to return to worker */ protected PINSpec pinSpec; + protected enum DIALOG { VERIFY, ACTIVATE, CHANGE, UNBLOCK }; + public PINManagementGUI(Container contentPane, Locale locale, Style guiStyle, @@ -84,6 +87,7 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac final String activateCmd, final String changeCmd, final String unblockCmd, + final String verifyCmd, final ActionListener cancelListener, final String cancelCmd) { @@ -161,9 +165,10 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac activateButton.setText(getMessage(BUTTON_CHANGE)); activateButton.setEnabled(true); activateButton.setActionCommand(changeCmd); - } else { - activateButton.setText(getMessage(BUTTON_ACTIVATE)); - activateButton.setEnabled(false); + } else if (status == STATUS.UNKNOWN) { + activateButton.setText(getMessage(BUTTON_VERIFY)); + activateButton.setEnabled(true); + activateButton.setActionCommand(verifyCmd); } } } @@ -234,11 +239,11 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac final ActionListener okListener, final String okCommand, final ActionListener cancelListener, final String cancelCommand) { log.debug("scheduling activate pin dialog"); - showPINDialog(false, pin, okListener, okCommand, cancelListener, cancelCommand); + showPINDialog(DIALOG.ACTIVATE, pin, okListener, okCommand, cancelListener, cancelCommand); } - private void showPINDialog(final boolean changePin, final PINSpec pinSpec, + private void showPINDialog(final DIALOG type, final PINSpec pinSpec, final ActionListener okListener, final String okCommand, final ActionListener cancelListener, final String cancelCommand) { @@ -248,17 +253,25 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac public void run() { String HELP_TOPIC, TITLE, MESSAGE_MGMT; - if (changePin) { + HELP_TOPIC = HELP_PINMGMT; + + if (type == DIALOG.CHANGE) { log.debug("show change pin dialog"); - HELP_TOPIC = HELP_PINMGMT; TITLE = TITLE_CHANGE_PIN; MESSAGE_MGMT = MESSAGE_CHANGE_PIN; - } else { + } else if (type == DIALOG.ACTIVATE) { log.debug("show activate pin dialog"); - HELP_TOPIC = HELP_PINMGMT; TITLE = TITLE_ACTIVATE_PIN; MESSAGE_MGMT = MESSAGE_ACTIVATE_PIN; oldPinField = null; + } else if (type == DIALOG.VERIFY) { + log.debug("show verify pin dialog"); + TITLE = TITLE_VERIFY_PIN; + MESSAGE_MGMT = MESSAGE_VERIFY_PIN; + } else { + log.debug("show unblock pin dialog"); + TITLE = TITLE_UNBLOCK_PIN; + MESSAGE_MGMT = MESSAGE_UNBLOCK_PIN; } mainPanel.removeAll(); @@ -267,7 +280,7 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac helpListener.setHelpTopic(HELP_TOPIC); JLabel mgmtLabel = new JLabel(); - mgmtLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + mgmtLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() & ~Font.BOLD)); if (renderHeaderPanel) { titleLabel.setText(getMessage(TITLE)); @@ -282,73 +295,83 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac } JButton okButton = new JButton(); - okButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle() & ~java.awt.Font.BOLD)); + okButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle() & ~Font.BOLD)); okButton.setText(getMessage(BUTTON_OK)); - okButton.setEnabled(false); + okButton.setEnabled(type == DIALOG.VERIFY && pinSpec.getMinLength() == 0); okButton.setActionCommand(okCommand); okButton.addActionListener(okListener); + JLabel oldPinLabel = null; + JLabel repeatPinLabel = null; JLabel pinLabel = new JLabel(); - pinLabel.setFont(pinLabel.getFont().deriveFont(pinLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - String pinLabelPattern = (changePin) ? getMessage(LABEL_NEW_PIN) : getMessage(LABEL_PIN); + pinLabel.setFont(pinLabel.getFont().deriveFont(pinLabel.getFont().getStyle() & ~Font.BOLD)); + String pinLabelPattern = (type == DIALOG.CHANGE) ? getMessage(LABEL_NEW_PIN) : getMessage(LABEL_PIN); pinLabel.setText(MessageFormat.format(pinLabelPattern, new Object[]{pinSpec.getLocalizedName()})); final JPasswordField repeatPinField = new JPasswordField(); pinField = new JPasswordField(); pinField.setText(""); - pinField.setDocument(new PINDocument(pinSpec, null)); pinField.setActionCommand(okCommand); pinField.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (pinField.getPassword().length >= pinSpec.getMinLength()) { - repeatPinField.requestFocusInWindow(); - } - } - }); - JLabel repeatPinLabel = new JLabel(); - repeatPinLabel.setFont(pinLabel.getFont()); - String repeatPinLabelPattern = getMessage(LABEL_REPEAT_PIN); - repeatPinLabel.setText(MessageFormat.format(repeatPinLabelPattern, new Object[]{pinSpec.getLocalizedName()})); - - repeatPinField.setText(""); - repeatPinField.setDocument(new PINDocument(pinSpec, okButton, pinField.getDocument())); - repeatPinField.setActionCommand(okCommand); - repeatPinField.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - if (pinField.getPassword().length >= pinSpec.getMinLength()) { + if (type == DIALOG.VERIFY) { okListener.actionPerformed(e); + } else { + repeatPinField.requestFocusInWindow(); + } } } }); - JLabel oldPinLabel = null; - if (changePin) { - oldPinLabel = new JLabel(); - oldPinLabel.setFont(oldPinLabel.getFont().deriveFont(oldPinLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - String oldPinLabelPattern = getMessage(LABEL_OLD_PIN); - oldPinLabel.setText(MessageFormat.format(oldPinLabelPattern, new Object[]{pinSpec.getLocalizedName()})); - - oldPinField = new JPasswordField(); - oldPinField.setText(""); - oldPinField.setDocument(new PINDocument(pinSpec, null)); - oldPinField.setActionCommand(okCommand); - oldPinField.addActionListener(new ActionListener() { + if (type != DIALOG.VERIFY) { + pinField.setDocument(new PINDocument(pinSpec, null)); + repeatPinLabel = new JLabel(); + repeatPinLabel.setFont(pinLabel.getFont()); + String repeatPinLabelPattern = getMessage(LABEL_REPEAT_PIN); + repeatPinLabel.setText(MessageFormat.format(repeatPinLabelPattern, new Object[]{pinSpec.getLocalizedName()})); + + repeatPinField.setText(""); + repeatPinField.setDocument(new PINDocument(pinSpec, okButton, pinField.getDocument())); + repeatPinField.setActionCommand(okCommand); + repeatPinField.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - if (oldPinField.getPassword().length >= pinSpec.getMinLength()) { - pinField.requestFocusInWindow(); + if (pinField.getPassword().length >= pinSpec.getMinLength()) { + okListener.actionPerformed(e); } } }); + + if (type == DIALOG.CHANGE) { + oldPinLabel = new JLabel(); + oldPinLabel.setFont(oldPinLabel.getFont().deriveFont(oldPinLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); + String oldPinLabelPattern = getMessage(LABEL_OLD_PIN); + oldPinLabel.setText(MessageFormat.format(oldPinLabelPattern, new Object[]{pinSpec.getLocalizedName()})); + + oldPinField = new JPasswordField(); + oldPinField.setText(""); + oldPinField.setDocument(new PINDocument(pinSpec, null)); + oldPinField.setActionCommand(okCommand); + oldPinField.addActionListener(new ActionListener() { + + @Override + public void actionPerformed(ActionEvent e) { + if (oldPinField.getPassword().length >= pinSpec.getMinLength()) { + pinField.requestFocusInWindow(); + } + } + }); + } // else -> ACTIVATE (not verify, not change) + } else { + pinField.setDocument(new PINDocument(pinSpec, okButton)); } - + JLabel pinsizeLabel = new JLabel(); - pinsizeLabel.setFont(pinsizeLabel.getFont().deriveFont(pinsizeLabel.getFont().getStyle() & ~java.awt.Font.BOLD, pinsizeLabel.getFont().getSize()-2)); + pinsizeLabel.setFont(pinsizeLabel.getFont().deriveFont(pinsizeLabel.getFont().getStyle() & ~Font.BOLD, pinsizeLabel.getFont().getSize()-2)); String pinsizePattern = getMessage(LABEL_PINSIZE); String pinSize = String.valueOf(pinSpec.getMinLength()); if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { @@ -375,37 +398,39 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac GroupLayout.ParallelGroup pinHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING); GroupLayout.SequentialGroup pinVertical = mainPanelLayout.createSequentialGroup(); - if (pinLabelPos == PinLabelPosition.ABOVE) { - if (changePin) { - pinHorizontal - .addComponent(oldPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addComponent(oldPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE); - pinVertical - .addComponent(oldPinLabel) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(oldPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); - } - pinHorizontal - .addComponent(pinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(repeatPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addComponent(repeatPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(mainPanelLayout.createSequentialGroup() - .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) - .addComponent(pinsizeLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)); - pinVertical - .addComponent(pinLabel) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(repeatPinLabel) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(repeatPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pinsizeLabel); - } else { - if (changePin) { +// if (pinLabelPos == PinLabelPosition.ABOVE) { +// if (changePin) { +// pinHorizontal +// .addComponent(oldPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) +// .addComponent(oldPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE); +// pinVertical +// .addComponent(oldPinLabel) +// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) +// .addComponent(oldPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) +// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); +// } +// pinHorizontal +// .addComponent(pinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) +// .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) +// .addComponent(repeatPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) +// .addComponent(repeatPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) +// .addGroup(mainPanelLayout.createSequentialGroup() +// .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) +// .addComponent(pinsizeLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)); +// pinVertical +// .addComponent(pinLabel) +// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) +// .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) +// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) +// .addComponent(repeatPinLabel) +// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) +// .addComponent(repeatPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) +// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) +// .addComponent(pinsizeLabel); +// } else { + + + if (type == DIALOG.CHANGE) { pinHorizontal .addGroup(mainPanelLayout.createSequentialGroup() .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) @@ -422,8 +447,16 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(oldPinLabel) .addComponent(oldPinField)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(pinLabel) + .addComponent(pinField)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(repeatPinLabel) + .addComponent(repeatPinField)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); - } else { + } else if (type == DIALOG.ACTIVATE) { pinHorizontal .addGroup(mainPanelLayout.createSequentialGroup() .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) @@ -434,12 +467,7 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(repeatPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); - } - pinHorizontal - .addGroup(mainPanelLayout.createSequentialGroup() - .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) - .addComponent(pinsizeLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)); - pinVertical + pinVertical .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(pinLabel) .addComponent(pinField)) @@ -447,9 +475,27 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(repeatPinLabel) .addComponent(repeatPinField)) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); + } else { // VERIFY + pinHorizontal + .addGroup(mainPanelLayout.createSequentialGroup() + .addComponent(pinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); + + pinVertical + .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(pinLabel) + .addComponent(pinField)) + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); + } + pinHorizontal + .addGroup(mainPanelLayout.createSequentialGroup() + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) + .addComponent(pinsizeLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)); + pinVertical .addComponent(pinsizeLabel); - } +// } mainPanelLayout.setHorizontalGroup( mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) @@ -503,7 +549,7 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac final ActionListener cancelListener, final String cancelCommand) { log.debug("scheduling change pin dialog"); - showPINDialog(true, pin, okListener, okCommand, cancelListener, cancelCommand); + showPINDialog(DIALOG.CHANGE, pin, okListener, okCommand, cancelListener, cancelCommand); } @Override @@ -612,4 +658,9 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac return bs; } + + @Override + public void showVerifyPINDialog(PINSpec pin, ActionListener okListener, String okCmd, ActionListener cancelListener, String cancelCmd) { + showPINDialog(DIALOG.VERIFY, pin, okListener, okCmd, cancelListener, cancelCmd); + } } 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 6b083e16..9c630431 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 @@ -31,6 +31,7 @@ public interface PINManagementGUIFacade extends BKUGUIFacade { public static final String TITLE_PINMGMT = "title.pin.mgmt"; public static final String TITLE_ACTIVATE_PIN = "title.activate.pin"; public static final String TITLE_CHANGE_PIN = "title.change.pin"; + public static final String TITLE_VERIFY_PIN = "title.verify.pin"; public static final String TITLE_UNBLOCK_PIN = "title.unblock.pin"; public static final String TITLE_ACTIVATE_SUCCESS = "title.activate.success"; public static final String TITLE_CHANGE_SUCCESS = "title.change.success"; @@ -39,19 +40,25 @@ public interface PINManagementGUIFacade extends BKUGUIFacade { public static final String MESSAGE_PINMGMT = "message.pin.mgmt"; public static final String MESSAGE_ACTIVATE_PIN = "message.activate.pin"; public static final String MESSAGE_CHANGE_PIN = "message.change.pin"; + public static final String MESSAGE_VERIFY_PIN = "message.verify.pin"; public static final String MESSAGE_UNBLOCK_PIN = "message.unblock.pin"; public static final String LABEL_OLD_PIN = "label.old.pin"; public static final String LABEL_NEW_PIN = "label.new.pin"; public static final String LABEL_REPEAT_PIN = "label.repeat.pin"; + public static final String ERR_STATUS = "err.status"; public static final String ERR_ACTIVATE = "err.activate"; public static final String ERR_CHANGE = "err.change"; public static final String ERR_UNBLOCK = "err.unblock"; + public static final String ERR_VERIFY = "err.verify"; 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 BUTTON_ACTIVATE = "button.activate"; public static final String BUTTON_UNBLOCK = "button.unblock"; public static final String BUTTON_CHANGE = "button.change"; + public static final String BUTTON_VERIFY = "button.verify"; public static final String STATUS_ACTIVE = "status.active"; public static final String STATUS_BLOCKED = "status.blocked"; @@ -61,7 +68,7 @@ public interface PINManagementGUIFacade extends BKUGUIFacade { public enum STATUS { ACTIV, NOT_ACTIV, BLOCKED, UNKNOWN }; public void showPINManagementDialog(Map pins, - ActionListener activateListener, String activateCmd, String changeCmd, String unblockCmd, + ActionListener activateListener, String activateCmd, String changeCmd, String unblockCmd, String verifyCmd, ActionListener cancelListener, String cancelCmd); public void showActivatePINDialog(PINSpec pin, @@ -76,6 +83,10 @@ public interface PINManagementGUIFacade extends BKUGUIFacade { ActionListener okListener, String okCmd, ActionListener cancelListener, String cancelCmd); + public void showVerifyPINDialog(PINSpec pin, + ActionListener okListener, String okCmd, + ActionListener cancelListener, String cancelCmd); + public char[] getOldPin(); public PINSpec getSelectedPINSpec(); diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusTableModel.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusTableModel.java index feaa5072..052c13b2 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusTableModel.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusTableModel.java @@ -20,8 +20,6 @@ import at.gv.egiz.bku.gui.PINManagementGUIFacade.STATUS; import at.gv.egiz.smcc.PINSpec; import java.util.Map; import javax.swing.table.DefaultTableModel; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; /** * @@ -29,7 +27,7 @@ import org.apache.commons.logging.LogFactory; */ public class PINStatusTableModel extends DefaultTableModel { - protected static final Log log = LogFactory.getLog(PINStatusTableModel.class); +// protected static final Log log = LogFactory.getLog(PINStatusTableModel.class); protected Class[] types; public PINStatusTableModel(Map pinStatuses) { @@ -37,7 +35,7 @@ public class PINStatusTableModel extends DefaultTableModel { if (pinStatuses == null) { throw new RuntimeException("pinStatuses must not be null"); } - log.trace(pinStatuses.size() + " PINs"); +// log.trace(pinStatuses.size() + " PINs"); types = new Class[] { PINSpec.class, STATUS.class }; for (PINSpec pinSpec : pinStatuses.keySet()) { addRow(new Object[] { pinSpec, pinStatuses.get(pinSpec) }); diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/GetPINStatusException.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/GetPINStatusException.java new file mode 100644 index 00000000..abbe66a1 --- /dev/null +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/GetPINStatusException.java @@ -0,0 +1,41 @@ +/* + * 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.SignatureCardException; + +/** + * + * @author Clemens Orthacker + */ +public class GetPINStatusException extends SignatureCardException { + + /** + * Creates a new instance of GetStatusException without detail message. + */ + public GetPINStatusException() { + } + + + /** + * Constructs an instance of GetStatusException with the specified detail message. + * @param msg the detail message. + */ + public GetPINStatusException(String msg) { + super(msg); + } +} 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 c8472c97..66db0484 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 @@ -20,7 +20,10 @@ import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.gui.PINManagementGUIFacade; import at.gv.egiz.bku.gui.PINManagementGUIFacade.STATUS; import at.gv.egiz.bku.smccstal.AbstractRequestHandler; +import at.gv.egiz.smcc.LockedException; +import at.gv.egiz.smcc.NotActivatedException; import at.gv.egiz.smcc.PINSpec; +import at.gv.egiz.smcc.STARCOSCard; import at.gv.egiz.smcc.SignatureCardException; import at.gv.egiz.smcc.VerificationFailedException; import at.gv.egiz.smcc.util.SMCCHelper; @@ -32,6 +35,8 @@ import at.gv.egiz.stal.ext.PINManagementResponse; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.logging.Level; +import java.util.logging.Logger; import javax.smartcardio.Card; import javax.smartcardio.CardChannel; import javax.smartcardio.CardException; @@ -48,13 +53,20 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { protected static final Log log = LogFactory.getLog(PINManagementRequestHandler.class); + Map pinStatuses; + @Override public STALResponse handleRequest(STALRequest request) throws InterruptedException { if (request instanceof PINManagementRequest) { PINManagementGUIFacade gui = (PINManagementGUIFacade) this.gui; - showPINManagementDialog(gui); + try { + pinStatuses = getPINStatuses(); + + gui.showPINManagementDialog(pinStatuses, + this, "activate_enterpin", "change_enterpin", "unblock_enterpuk", "verify_enterpin", + this, "cancel"); while (true) { @@ -63,7 +75,9 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { if ("cancel".equals(actionCommand)) { return new PINManagementResponse(); } else if ("back".equals(actionCommand)) { - showPINManagementDialog(gui); + gui.showPINManagementDialog(pinStatuses, + this, "activate_enterpin", "change_enterpin", "unblock_enterpuk", "verify_enterpin", + this, "cancel"); } else { PINSpec selectedPIN = gui.getSelectedPINSpec(); @@ -72,63 +86,163 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { } if ("activate_enterpin".equals(actionCommand)) { - gui.showActivatePINDialog(selectedPIN, this, "activate", this, "back"); + gui.showActivatePINDialog(selectedPIN, + this, "activate", this, "back"); } else if ("change_enterpin".equals(actionCommand)) { - gui.showChangePINDialog(selectedPIN, this, "change", this, "back"); + gui.showChangePINDialog(selectedPIN, + this, "change", this, "back"); } else if ("unblock_enterpuk".equals(actionCommand)) { - gui.showUnblockPINDialog(selectedPIN, this, "unblock", this, "back"); + gui.showUnblockPINDialog(selectedPIN, + this, "unblock", this, "back"); + } else if ("verify_enterpin".equals(actionCommand)) { + gui.showVerifyPINDialog(selectedPIN, + this, "verify", this, "back"); } else if ("activate".equals(actionCommand)) { try { - card.activatePIN(selectedPIN.getKID(), - selectedPIN.getContextAID(), + log.debug("activate " + selectedPIN.getLocalizedName()); + card.activatePIN(selectedPIN, String.valueOf(gui.getPin())); + updatePINStatus(selectedPIN, STATUS.ACTIV); gui.showMessageDialog(PINManagementGUIFacade.TITLE_ACTIVATE_SUCCESS, PINManagementGUIFacade.MESSAGE_ACTIVATE_SUCCESS, new Object[] {selectedPIN.getLocalizedName()}, this, "ok"); waitForAction(); - showPINManagementDialog(gui); + gui.showPINManagementDialog(pinStatuses, + this, "activate_enterpin", "change_enterpin", "unblock_enterpuk", "verify_enterpin", + this, "cancel"); + } catch (GetPINStatusException ex) { + log.error("failed to get " + selectedPIN.getLocalizedName() + + " status: " + ex.getMessage()); + gui.showErrorDialog(PINManagementGUIFacade.ERR_STATUS, null, + this, "cancel"); } catch (SignatureCardException ex) { - log.error("failed to activate " + selectedPIN.getLocalizedName() + ": " + ex.getMessage()); + log.error("failed to activate " + selectedPIN.getLocalizedName() + + ": " + ex.getMessage()); gui.showErrorDialog(PINManagementGUIFacade.ERR_ACTIVATE, new Object[] {selectedPIN.getLocalizedName()}, this, "cancel"); } } else if ("change".equals(actionCommand)) { + log.info("change " + selectedPIN.getLocalizedName()); try { - card.changePIN(selectedPIN.getKID(), - selectedPIN.getContextAID(), + card.changePIN(selectedPIN, String.valueOf(gui.getOldPin()), String.valueOf(gui.getPin())); + updatePINStatus(selectedPIN, STATUS.ACTIV); gui.showMessageDialog(PINManagementGUIFacade.TITLE_CHANGE_SUCCESS, PINManagementGUIFacade.MESSAGE_CHANGE_SUCCESS, new Object[] {selectedPIN.getLocalizedName()}, this, "ok"); waitForAction(); - showPINManagementDialog(gui); + gui.showPINManagementDialog(pinStatuses, + this, "activate_enterpin", "change_enterpin", "unblock_enterpuk", "verify_enterpin", + this, "cancel"); + } catch (GetPINStatusException ex) { + log.error("failed to get " + selectedPIN.getLocalizedName() + + " status: " + ex.getMessage()); + gui.showErrorDialog(PINManagementGUIFacade.ERR_STATUS, null, + this, "cancel"); + } catch (LockedException ex) { + log.error("failed to change " + selectedPIN.getLocalizedName() + + ": PIN locked"); + updatePINStatus(selectedPIN, STATUS.BLOCKED); + gui.showErrorDialog(PINManagementGUIFacade.ERR_LOCKED, + new Object[] {selectedPIN.getLocalizedName()}, + this, "ok"); + waitForAction(); + gui.showPINManagementDialog(pinStatuses, + this, "activate_enterpin", "change_enterpin", "unblock_enterpuk", "verify_enterpin", + this, "cancel"); } catch (VerificationFailedException ex) { - log.error("failed to change " + selectedPIN.getLocalizedName() + ": " + ex.getMessage()); + log.error("failed to change " + selectedPIN.getLocalizedName() + + ": " + ex.getMessage()); gui.showErrorDialog(PINManagementGUIFacade.ERR_RETRIES, new Object[] {selectedPIN.getLocalizedName(), ex.getRetries()}, - this, "back"); + this, "change_enterpin"); + } catch (NotActivatedException ex) { + log.error("failed to change " + selectedPIN.getLocalizedName() + + ": PIN not active"); + updatePINStatus(selectedPIN, STATUS.NOT_ACTIV); + gui.showErrorDialog(PINManagementGUIFacade.ERR_NOT_ACTIVE, + new Object[] {selectedPIN.getLocalizedName()}, + this, "ok"); + waitForAction(); + gui.showPINManagementDialog(pinStatuses, + this, "activate_enterpin", "change_enterpin", "unblock_enterpuk", "verify_enterpin", + this, "cancel"); } catch (SignatureCardException ex) { - log.error("failed to change " + selectedPIN.getLocalizedName() + ": " + ex.getMessage()); + log.error("failed to change " + selectedPIN.getLocalizedName() + + ": " + ex.getMessage()); gui.showErrorDialog(PINManagementGUIFacade.ERR_CHANGE, new Object[] {selectedPIN.getLocalizedName()}, this, "cancel"); } } else if ("unblock".equals(actionCommand)) { + log.info("unblock " + selectedPIN.getLocalizedName()); log.error("unblock PIN not implemented"); gui.showErrorDialog(PINManagementGUIFacade.ERR_UNBLOCK, null, this, "cancel"); + } else if ("verify".equals(actionCommand)) { + try { + log.info("verify " + selectedPIN.getLocalizedName()); + int retries = card.verifyPIN(selectedPIN, String.valueOf(gui.getPin())); + log.trace(retries + " retries"); + if (retries < 0) { + updatePINStatus(selectedPIN, STATUS.ACTIV); + gui.showPINManagementDialog(pinStatuses, + this, "activate_enterpin", "change_enterpin", "unblock_enterpuk", "verify_enterpin", + this, "cancel"); + } else { + log.error("failed to verify " + selectedPIN.getLocalizedName() + + ": " + retries + " retries left"); + gui.showErrorDialog(PINManagementGUIFacade.ERR_RETRIES, + new Object[] {selectedPIN.getLocalizedName(), retries}, + this, "verify_enterpin"); + } + } catch (GetPINStatusException ex) { + log.error("failed to get " + selectedPIN.getLocalizedName() + + " status: " + ex.getMessage()); + gui.showErrorDialog(PINManagementGUIFacade.ERR_STATUS, null, + this, "cancel"); + } catch (LockedException ex) { + log.error("failed to verify " + selectedPIN.getLocalizedName() + + ": PIN locked"); + updatePINStatus(selectedPIN, STATUS.BLOCKED); + gui.showPINManagementDialog(pinStatuses, + this, "activate_enterpin", "change_enterpin", "unblock_enterpuk", "verify_enterpin", + this, "cancel"); + } catch (NotActivatedException ex) { + log.error("failed to verify " + selectedPIN.getLocalizedName() + + ": PIN not active"); + updatePINStatus(selectedPIN, STATUS.NOT_ACTIV); + gui.showPINManagementDialog(pinStatuses, + this, "activate_enterpin", "change_enterpin", "unblock_enterpuk", "verify_enterpin", + this, "cancel"); + } catch (SignatureCardException ex) { + log.error("failed to verify " + selectedPIN.getLocalizedName() + + ": " + ex.getMessage()); + gui.showErrorDialog(PINManagementGUIFacade.ERR_STATUS, + new Object[] {selectedPIN.getLocalizedName()}, + this, "cancel"); + } + } else { throw new RuntimeException("unsupported action " + actionCommand); } } } + } catch (GetPINStatusException ex) { + log.error("Failed to get PIN statuses: " + ex.getMessage()); + gui.showErrorDialog(PINManagementGUIFacade.ERR_STATUS, null, + this, "ok"); + waitForAction(); + return new ErrorResponse(1000); + } } else { log.error("Got unexpected STAL request: " + request); return new ErrorResponse(1000); } + } @Override @@ -136,75 +250,129 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { return true; } - public Map getPINStatuses() throws SignatureCardException { - Card icc = card.getCard(); - try { - icc.beginExclusive(); - CardChannel channel = icc.getBasicChannel(); + private Map getPINStatuses() throws GetPINStatusException { + HashMap pinStatuses = new HashMap(); + List pins = card.getPINSpecs(); - HashMap pinStatuses = new HashMap(); - List pins = card.getPINSpecs(); + if (card instanceof STARCOSCard) { + Card icc = card.getCard(); + try { + icc.beginExclusive(); + CardChannel channel = icc.getBasicChannel(); - for (PINSpec pinSpec : pins) { - byte kid = pinSpec.getKID(); - byte[] contextAID = pinSpec.getContextAID(); - - if (contextAID != null) { - CommandAPDU selectAPDU = new CommandAPDU(0x00, 0xa4, 0x04, 0x0c, contextAID); - ResponseAPDU responseAPDU = channel.transmit(selectAPDU); - if (responseAPDU.getSW() != 0x9000) { - icc.endExclusive(); - String msg = "Failed to activate PIN " + SMCCHelper.toString(new byte[]{kid}) + - ": Failed to select AID " + SMCCHelper.toString(contextAID) + - ": " + SMCCHelper.toString(responseAPDU.getBytes()); - log.error(msg); - throw new SignatureCardException(msg); + for (PINSpec pinSpec : pins) { + byte kid = pinSpec.getKID(); + byte[] contextAID = pinSpec.getContextAID(); + + if (contextAID != null) { + CommandAPDU selectAPDU = new CommandAPDU(0x00, 0xa4, 0x04, 0x0c, contextAID); + ResponseAPDU responseAPDU = channel.transmit(selectAPDU); + if (responseAPDU.getSW() != 0x9000) { + icc.endExclusive(); + String msg = "Select AID " + SMCCHelper.toString(pinSpec.getContextAID()) + + ": SW=" + Integer.toHexString(responseAPDU.getSW()); + log.error(msg); + throw new GetPINStatusException(msg); + } } - } - CommandAPDU verifyAPDU = new CommandAPDU(new byte[]{(byte) 0x00, (byte) 0x20, (byte) 00, kid}); - ResponseAPDU responseAPDU = channel.transmit(verifyAPDU); + CommandAPDU verifyAPDU = new CommandAPDU(new byte[] { + (byte) 0x00, (byte) 0x20, (byte) 00, kid }); + ResponseAPDU responseAPDU = channel.transmit(verifyAPDU); - STATUS status = STATUS.UNKNOWN; - if (responseAPDU.getSW() == 0x6984) { - status = STATUS.NOT_ACTIV; - } else if (responseAPDU.getSW() == 0x63c0) { - status = STATUS.BLOCKED; - } else if (responseAPDU.getSW1() == 0x63) { - status = STATUS.ACTIV; - } - if (log.isDebugEnabled()) { - log.debug("PIN " + pinSpec.getLocalizedName() + " status: " + SMCCHelper.toString(responseAPDU.getBytes())); + STATUS status = STATUS.UNKNOWN; + if (responseAPDU.getSW() == 0x6984) { + status = STATUS.NOT_ACTIV; + } else if (responseAPDU.getSW() == 0x63c0) { + status = STATUS.BLOCKED; + } else if (responseAPDU.getSW1() == 0x63) { + status = STATUS.ACTIV; + } + if (log.isDebugEnabled()) { + log.debug("PIN " + pinSpec.getLocalizedName() + + " status: " + SMCCHelper.toString(responseAPDU.getBytes())); + } + pinStatuses.put(pinSpec, status); } + return pinStatuses; - pinStatuses.put(pinSpec, status); - } -// icc.endExclusive(); - - return pinStatuses; - - } catch (CardException ex) { - log.error("Failed to get PIN status: " + ex.getMessage()); - throw new SignatureCardException(ex.getMessage(), ex); - } finally { - try { - icc.endExclusive(); } catch (CardException ex) { - log.trace("failed to end exclusive card access"); + log.error("Failed to get PIN status: " + ex.getMessage(), ex); + throw new GetPINStatusException(ex.getMessage()); + } finally { + try { + icc.endExclusive(); + } catch (CardException ex) { + log.trace("failed to end exclusive card access: " + ex.getMessage()); + } + } + } else { + for (PINSpec pinSpec : pins) { + pinStatuses.put(pinSpec, STATUS.UNKNOWN); } } + return pinStatuses; } - private void showPINManagementDialog(PINManagementGUIFacade gui) { - try { - Map pins = getPINStatuses(); - gui.showPINManagementDialog(pins, - this, "activate_enterpin", "change_enterpin", "unblock_enterpuk", - this, "cancel"); - } catch (SignatureCardException ex) { - gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN_WITH_PARAM, - new Object[]{ex.getMessage()}, - this, "cancel"); + /** + * query status for STARCOS card, + * assume provided status for ACOS card + * @param pinSpec + * @param status + * @throws at.gv.egiz.smcc.SignatureCardException if query status fails + */ + private void updatePINStatus(PINSpec pinSpec, STATUS status) throws GetPINStatusException { + if (card instanceof STARCOSCard) { + Card icc = card.getCard(); + try { + icc.beginExclusive(); + CardChannel channel = icc.getBasicChannel(); + + byte kid = pinSpec.getKID(); + byte[] contextAID = pinSpec.getContextAID(); + + if (contextAID != null) { + CommandAPDU selectAPDU = new CommandAPDU(0x00, 0xa4, 0x04, 0x0c, contextAID); + ResponseAPDU responseAPDU = channel.transmit(selectAPDU); + if (responseAPDU.getSW() != 0x9000) { + icc.endExclusive(); + String msg = "Select AID " + SMCCHelper.toString(pinSpec.getContextAID()) + + ": SW=" + Integer.toHexString(responseAPDU.getSW()); + log.error(msg); + throw new GetPINStatusException(msg); + } + } + + CommandAPDU verifyAPDU = new CommandAPDU(new byte[] { + (byte) 0x00, (byte) 0x20, (byte) 00, kid }); + ResponseAPDU responseAPDU = channel.transmit(verifyAPDU); + + status = STATUS.UNKNOWN; + if (responseAPDU.getSW() == 0x6984) { + status = STATUS.NOT_ACTIV; + } else if (responseAPDU.getSW() == 0x63c0) { + status = STATUS.BLOCKED; + } else if (responseAPDU.getSW1() == 0x63) { + status = STATUS.ACTIV; + } + if (log.isDebugEnabled()) { + log.debug(pinSpec.getLocalizedName() + + " status: " + SMCCHelper.toString(responseAPDU.getBytes())); + } + pinStatuses.put(pinSpec, status); + + } catch (CardException ex) { + log.error("Failed to get PIN status: " + ex.getMessage(), ex); + throw new GetPINStatusException(ex.getMessage()); + } finally { + try { + icc.endExclusive(); + } catch (CardException ex) { + log.warn("failed to end exclusive card access: " + ex.getMessage()); + } + } + } else { + pinStatuses.put(pinSpec, status); } } } diff --git a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties index 430f85b5..69d231f7 100644 --- a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties +++ b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties @@ -18,6 +18,7 @@ title.pin.mgmt=PIN Verwaltung title.activate.pin=PIN Aktivieren title.change.pin=PIN \u00C4ndern title.unblock.pin=PIN Entsperren +title.verify.pin=PIN Eingeben title.activate.success=Erfolg title.change.success=Erfolg @@ -25,6 +26,7 @@ message.pin.mgmt=Die Karte verf\u00FCgt \u00FCber {0} PINs message.activate.pin={0} eingeben und best\u00E4tigen message.change.pin={0} eingeben und best\u00E4tigen message.unblock.pin=PUK zu {0} eingeben +message.verify.pin={0} eingeben (TODO: Warning not activated) message.activate.success={0} wurde erfolgreich aktiviert. message.change.success={0} wurde erfolgreich ge\u00E4ndert. @@ -38,14 +40,19 @@ label.repeat.pin=Best\u00E4tigung: button.activate=Aktivieren button.change=\u00C4ndern button.unblock=Entsperren +button.verify=Abfragen help.activation=help.activation help.pin.mgmt=help.pin.mgmt +err.status=Der Status der PINs konnte nicht \u00FCberpr\u00FCft werden. err.activate=Beim Aktivieren der {0} trat ein Fehler auf. err.change=Beim \u00C4ndern der {0} trat ein Fehler auf. err.unblock=Das Entsperren der {0} wird nicht unterst\u00FCtzt. +err.verify=VERIFY ERROR (TODO) err.retries=Falscher {0}, noch {1} Versuche +err.locked={0} gesperrt. +err.not.active={0} nicht aktiviert. status.not.active=NICHT AKTIV status.active=AKTIV diff --git a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties index 98d18633..920f7d5b 100644 --- a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties +++ b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties @@ -38,14 +38,18 @@ label.repeat.pin=Confirmation: button.activate=Activate button.change=Change button.unblock=Unblock +button.verify=Query help.activation=help.activation help.pin.mgmt=help.pin.mgmt +err.status=PIN statuses could not be read. err.activate=An error occured during the activation of {0}. err.change=An error occured during the changing of {0}. err.unblock=Unblocking of {0} is not supported. err.retries=Wrong {0}, {1} tries remaining +err.locked={0} locked +err.not.active={0} not activated. status.not.active=NOT ACTIVE status.active=ACTIVE -- cgit v1.2.3 From 2a1df5e58e44f8d77f34eb80df74e8c0d27caceb Mon Sep 17 00:00:00 2001 From: clemenso Date: Wed, 18 Mar 2009 22:27:28 +0000 Subject: 1.1-rc5 (pinProviderFactories, gui refactoring, signatureCard, secureViewer) git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@322 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../java/at/gv/egiz/bku/gui/PINManagementGUI.java | 365 ++++++++--------- .../at/gv/egiz/bku/gui/PINManagementGUIFacade.java | 46 ++- .../bku/online/applet/PINManagementBKUWorker.java | 10 +- .../smccstal/ext/ManagementPINProviderFactory.java | 53 +++ .../smccstal/ext/PINManagementRequestHandler.java | 319 ++++++++------- .../bku/smccstal/ext/PinpadPINProviderFactory.java | 126 ++++++ .../smccstal/ext/SoftwarePINProviderFactory.java | 148 +++++++ .../gv/egiz/bku/gui/ActivationMessages.properties | 17 +- .../egiz/bku/gui/ActivationMessages_en.properties | 15 +- .../test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java | 4 +- .../gv/egiz/bku/smccstal/ext/FileSystemTest.java | 435 --------------------- 11 files changed, 746 insertions(+), 792 deletions(-) create mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/ManagementPINProviderFactory.java create mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PinpadPINProviderFactory.java create mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/SoftwarePINProviderFactory.java delete mode 100644 BKUAppletExt/src/test/java/at/gv/egiz/bku/smccstal/ext/FileSystemTest.java (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java index c904be0c..159dd29d 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java @@ -56,8 +56,6 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac /** remember the pinSpec to return to worker */ protected PINSpec pinSpec; - protected enum DIALOG { VERIFY, ACTIVATE, CHANGE, UNBLOCK }; - public PINManagementGUI(Container contentPane, Locale locale, Style guiStyle, @@ -235,43 +233,110 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac } @Override - public void showActivatePINDialog(final PINSpec pin, - final ActionListener okListener, final String okCommand, - final ActionListener cancelListener, final String cancelCommand) { - log.debug("scheduling activate pin dialog"); - showPINDialog(DIALOG.ACTIVATE, pin, okListener, okCommand, cancelListener, cancelCommand); + public void showPINDialog(DIALOG type, PINSpec pinSpec, + ActionListener okListener, String okCommand, + ActionListener cancelListener, String cancelCommand) { + showPINDialog(type, pinSpec, -1, false, + okListener, okCommand, cancelListener, cancelCommand); + } + + @Override + public void showPINDialog(DIALOG type, PINSpec pinSpec, int retries, + ActionListener okListener, String okCommand, + ActionListener cancelListener, String cancelCommand) { + showPINDialog(type, pinSpec, retries, false, + okListener, okCommand, cancelListener, cancelCommand); } + @Override + public void showPinpadPINDialog(DIALOG type, PINSpec pinSpec, int retries) { + String title, msg; + Object[] params; + if (retries < 0) { + params = new Object[2]; + if (shortText) { + params[0] = "PIN"; + } else { + params[0] = pinSpec.getLocalizedName(); + } + String pinSize = String.valueOf(pinSpec.getMinLength()); + if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { + pinSize += "-" + pinSpec.getMaxLength(); + } + params[1] = pinSize; + if (type == DIALOG.CHANGE) { + log.debug("show change pin dialog"); + title = TITLE_CHANGE_PIN; + msg = MESSAGE_CHANGEPIN_PINPAD; + } else if (type == DIALOG.ACTIVATE) { + log.debug("show activate pin dialog"); + title = TITLE_ACTIVATE_PIN; + msg = MESSAGE_ENTERPIN_PINPAD; + } else if (type == DIALOG.VERIFY) { + log.debug("show verify pin dialog"); + title = TITLE_VERIFY_PIN; + msg = MESSAGE_ENTERPIN_PINPAD; + } else { + log.debug("show unblock pin dialog"); + title = TITLE_UNBLOCK_PIN; + msg = MESSAGE_ENTERPIN_PINPAD; + } + + } else { + log.debug("show retry pin dialog"); + title = TITLE_RETRY; + msg = (retries < 2) ? + MESSAGE_LAST_RETRY : MESSAGE_RETRIES; + params = new Object[] {String.valueOf(retries)}; + } + showMessageDialog(title, msg, params); + } private void showPINDialog(final DIALOG type, final PINSpec pinSpec, + final int retries, final boolean pinpad, final ActionListener okListener, final String okCommand, final ActionListener cancelListener, final String cancelCommand) { + log.debug("scheduling pin dialog"); + SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - String HELP_TOPIC, TITLE, MESSAGE_MGMT; + String HELP_TOPIC, TITLE, MESSAGE_MGMT, MESSAGE_MGMT_PARAM; HELP_TOPIC = HELP_PINMGMT; - if (type == DIALOG.CHANGE) { - log.debug("show change pin dialog"); - TITLE = TITLE_CHANGE_PIN; - MESSAGE_MGMT = MESSAGE_CHANGE_PIN; - } else if (type == DIALOG.ACTIVATE) { - log.debug("show activate pin dialog"); - TITLE = TITLE_ACTIVATE_PIN; - MESSAGE_MGMT = MESSAGE_ACTIVATE_PIN; - oldPinField = null; - } else if (type == DIALOG.VERIFY) { - log.debug("show verify pin dialog"); - TITLE = TITLE_VERIFY_PIN; - MESSAGE_MGMT = MESSAGE_VERIFY_PIN; + if (retries < 0) { + if (type == DIALOG.CHANGE) { + log.debug("show change pin dialog"); + TITLE = TITLE_CHANGE_PIN; + MESSAGE_MGMT = MESSAGE_CHANGE_PIN; + } else if (type == DIALOG.ACTIVATE) { + log.debug("show activate pin dialog"); + TITLE = TITLE_ACTIVATE_PIN; + MESSAGE_MGMT = MESSAGE_ACTIVATE_PIN; + oldPinField = null; + } else if (type == DIALOG.VERIFY) { + log.debug("show verify pin dialog"); + TITLE = TITLE_VERIFY_PIN; + MESSAGE_MGMT = MESSAGE_VERIFY_PIN; + } else { + log.debug("show unblock pin dialog"); + TITLE = TITLE_UNBLOCK_PIN; + MESSAGE_MGMT = MESSAGE_UNBLOCK_PIN; + } + if (shortText) { + MESSAGE_MGMT_PARAM = "PIN"; + } else { + MESSAGE_MGMT_PARAM = pinSpec.getLocalizedName(); + } } else { - log.debug("show unblock pin dialog"); - TITLE = TITLE_UNBLOCK_PIN; - MESSAGE_MGMT = MESSAGE_UNBLOCK_PIN; + log.debug("show retry pin dialog"); + TITLE = TITLE_RETRY; + MESSAGE_MGMT = (retries < 2) ? + MESSAGE_LAST_RETRY : MESSAGE_RETRIES; + MESSAGE_MGMT_PARAM = String.valueOf(retries); } mainPanel.removeAll(); @@ -280,24 +345,67 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac helpListener.setHelpTopic(HELP_TOPIC); JLabel mgmtLabel = new JLabel(); - mgmtLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() & ~Font.BOLD)); + if (retries < 0) { + mgmtLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() & ~Font.BOLD)); + } else { + mgmtLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() | Font.BOLD)); + mgmtLabel.setForeground(ERROR_COLOR); + helpListener.setHelpTopic(HELP_RETRY); + } if (renderHeaderPanel) { titleLabel.setText(getMessage(TITLE)); String mgmtPattern = getMessage(MESSAGE_MGMT); - if (shortText) { - mgmtLabel.setText(MessageFormat.format(mgmtPattern, "PIN")); - } else { - mgmtLabel.setText(MessageFormat.format(mgmtPattern, pinSpec.getLocalizedName())); - } + mgmtLabel.setText(MessageFormat.format(mgmtPattern, MESSAGE_MGMT_PARAM)); } else { mgmtLabel.setText(getMessage(TITLE)); } + String pinSize = String.valueOf(pinSpec.getMinLength()); + if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { + pinSize += "-" + pinSpec.getMaxLength(); + } + + //////////////////////////////////////////////////////////////// + // COMMON LAYOUT SECTION + //////////////////////////////////////////////////////////////// + + GroupLayout mainPanelLayout = new GroupLayout(mainPanel); + mainPanel.setLayout(mainPanelLayout); + + GroupLayout.SequentialGroup infoHorizontal = mainPanelLayout.createSequentialGroup() + .addComponent(mgmtLabel); + GroupLayout.ParallelGroup infoVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(mgmtLabel); + + if (!renderHeaderPanel) { + infoHorizontal + .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) + .addComponent(helpLabel); + infoVertical + .addComponent(helpLabel); + } + + GroupLayout.ParallelGroup pinHorizontal; + GroupLayout.SequentialGroup pinVertical; + + if (pinpad) { + JLabel pinpadLabel = new JLabel(); + pinpadLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() & ~Font.BOLD)); + String pinpadPattern = getMessage(MESSAGE_PINPAD); + pinpadLabel.setText(MessageFormat.format(pinpadPattern, + new Object[] { pinSpec.getLocalizedName(), pinSize })); + + pinHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) + .addComponent(pinpadLabel); + pinVertical = mainPanelLayout.createSequentialGroup() + .addComponent(pinpadLabel); + } else { + JButton okButton = new JButton(); okButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle() & ~Font.BOLD)); okButton.setText(getMessage(BUTTON_OK)); - okButton.setEnabled(type == DIALOG.VERIFY && pinSpec.getMinLength() == 0); + okButton.setEnabled(pinSpec.getMinLength() <= 0); okButton.setActionCommand(okCommand); okButton.addActionListener(okListener); @@ -334,7 +442,7 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac repeatPinLabel.setText(MessageFormat.format(repeatPinLabelPattern, new Object[]{pinSpec.getLocalizedName()})); repeatPinField.setText(""); - repeatPinField.setDocument(new PINDocument(pinSpec, okButton, pinField.getDocument())); +// repeatPinField.setDocument(new PINDocument(pinSpec, okButton, pinField.getDocument())); repeatPinField.setActionCommand(okCommand); repeatPinField.addActionListener(new ActionListener() { @@ -365,7 +473,15 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac } } }); - } // else -> ACTIVATE (not verify, not change) + + repeatPinField.setDocument(new PINDocument( + pinSpec, okButton, + pinField.getDocument(), oldPinField.getDocument())); + } else { + // else -> ACTIVATE (not verify, not change) + repeatPinField.setDocument(new PINDocument( + pinSpec, okButton, pinField.getDocument())); + } } else { pinField.setDocument(new PINDocument(pinSpec, okButton)); } @@ -373,30 +489,14 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac JLabel pinsizeLabel = new JLabel(); pinsizeLabel.setFont(pinsizeLabel.getFont().deriveFont(pinsizeLabel.getFont().getStyle() & ~Font.BOLD, pinsizeLabel.getFont().getSize()-2)); String pinsizePattern = getMessage(LABEL_PINSIZE); - String pinSize = String.valueOf(pinSpec.getMinLength()); - if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { - pinSize += "-" + pinSpec.getMaxLength(); - } pinsizeLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{pinSize})); - GroupLayout mainPanelLayout = new GroupLayout(mainPanel); - mainPanel.setLayout(mainPanelLayout); - - GroupLayout.SequentialGroup infoHorizontal = mainPanelLayout.createSequentialGroup() - .addComponent(mgmtLabel); - GroupLayout.ParallelGroup infoVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(mgmtLabel); - - if (!renderHeaderPanel) { - infoHorizontal - .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) - .addComponent(helpLabel); - infoVertical - .addComponent(helpLabel); - } + //////////////////////////////////////////////////////////////// + // NON-PINPAD SPECIFIC LAYOUT SECTION + //////////////////////////////////////////////////////////////// - GroupLayout.ParallelGroup pinHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING); - GroupLayout.SequentialGroup pinVertical = mainPanelLayout.createSequentialGroup(); + pinHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING); + pinVertical = mainPanelLayout.createSequentialGroup(); // if (pinLabelPos == PinLabelPosition.ABOVE) { // if (changePin) { @@ -495,7 +595,38 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac .addComponent(pinsizeLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)); pinVertical .addComponent(pinsizeLabel); -// } + + GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); + buttonPanel.setLayout(buttonPanelLayout); + + GroupLayout.SequentialGroup buttonHorizontal = buttonPanelLayout.createSequentialGroup() + .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(okButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE); + GroupLayout.Group buttonVertical; + + JButton cancelButton = new JButton(); + cancelButton.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD)); + cancelButton.setText(getMessage(BUTTON_CANCEL)); + cancelButton.setActionCommand(cancelCommand); + cancelButton.addActionListener(cancelListener); + + buttonHorizontal + .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) + .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE); + buttonVertical = buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) + .addComponent(okButton) + .addComponent(cancelButton); + + buttonPanelLayout.setHorizontalGroup(buttonHorizontal); + buttonPanelLayout.setVerticalGroup(buttonVertical); + + if (oldPinField != null) { + oldPinField.requestFocusInWindow(); + } else { + pinField.requestFocusInWindow(); + } + + } // END NON-PINPAD SECTION mainPanelLayout.setHorizontalGroup( mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) @@ -508,132 +639,12 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(pinVertical)); - GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); - buttonPanel.setLayout(buttonPanelLayout); - - GroupLayout.SequentialGroup buttonHorizontal = buttonPanelLayout.createSequentialGroup() - .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(okButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE); - GroupLayout.Group buttonVertical; - - JButton cancelButton = new JButton(); - cancelButton.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD)); - cancelButton.setText(getMessage(BUTTON_CANCEL)); - cancelButton.setActionCommand(cancelCommand); - cancelButton.addActionListener(cancelListener); - - buttonHorizontal - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE); - buttonVertical = buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(okButton) - .addComponent(cancelButton); - - buttonPanelLayout.setHorizontalGroup(buttonHorizontal); - buttonPanelLayout.setVerticalGroup(buttonVertical); - - if (oldPinField != null) { - oldPinField.requestFocusInWindow(); - } else { - pinField.requestFocusInWindow(); - } contentPanel.validate(); } }); } - @Override - public void showChangePINDialog(final PINSpec pin, - final ActionListener okListener, final String okCommand, - final ActionListener cancelListener, final String cancelCommand) { - - log.debug("scheduling change pin dialog"); - showPINDialog(DIALOG.CHANGE, pin, okListener, okCommand, cancelListener, cancelCommand); - } - - @Override - public void showUnblockPINDialog(final PINSpec pin, - final ActionListener okListener, final String okCommand, - final ActionListener cancelListener, final String cancelCommand) { - - log.debug("scheduling unblock PIN dialog"); - - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - - log.debug("show unblock PIN dialog"); - - log.error("unblock pin not supported"); - - mainPanel.removeAll(); - buttonPanel.removeAll(); - - if (renderHeaderPanel) { - titleLabel.setText(getMessage(TITLE_ERROR)); - } - - helpListener.setHelpTopic(HELP_PINMGMT); - - String errorMsgPattern = getMessage(ERR_UNBLOCK); - String errorMsg = MessageFormat.format(errorMsgPattern, pin.getLocalizedName()); - - JLabel errorMsgLabel = new JLabel(); - errorMsgLabel.setFont(errorMsgLabel.getFont().deriveFont(errorMsgLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - errorMsgLabel.setText(errorMsg); - - GroupLayout mainPanelLayout = new GroupLayout(mainPanel); - mainPanel.setLayout(mainPanelLayout); - - GroupLayout.ParallelGroup mainHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING); - GroupLayout.SequentialGroup mainVertical = mainPanelLayout.createSequentialGroup(); - - if (!renderHeaderPanel) { - JLabel errorTitleLabel = new JLabel(); - errorTitleLabel.setFont(errorTitleLabel.getFont().deriveFont(errorTitleLabel.getFont().getStyle() | java.awt.Font.BOLD)); - errorTitleLabel.setText(getMessage(TITLE_ERROR)); - errorTitleLabel.setForeground(ERROR_COLOR); - - mainHorizontal - .addGroup(mainPanelLayout.createSequentialGroup() - .addComponent(errorTitleLabel) - .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) - .addComponent(helpLabel)); - mainVertical - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(errorTitleLabel) - .addComponent(helpLabel)); - } - - mainPanelLayout.setHorizontalGroup(mainHorizontal - .addComponent(errorMsgLabel)); - mainPanelLayout.setVerticalGroup(mainVertical - .addComponent(errorMsgLabel)); - - JButton okButton = new JButton(); - okButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle() & ~java.awt.Font.BOLD)); - okButton.setText(getMessage(BUTTON_OK)); - okButton.setActionCommand(cancelCommand); - okButton.addActionListener(cancelListener); - - GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); - buttonPanel.setLayout(buttonPanelLayout); - - buttonPanelLayout.setHorizontalGroup( - buttonPanelLayout.createSequentialGroup() - .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(okButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); - buttonPanelLayout.setVerticalGroup( - buttonPanelLayout.createSequentialGroup() - .addComponent(okButton)); - - contentPanel.validate(); - } - }); - } - @Override protected int initButtonSize() { int bs = super.initButtonSize(); @@ -659,8 +670,4 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac return bs; } - @Override - public void showVerifyPINDialog(PINSpec pin, ActionListener okListener, String okCmd, ActionListener cancelListener, String cancelCmd) { - showPINDialog(DIALOG.VERIFY, pin, okListener, okCmd, cancelListener, cancelCmd); - } } 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 9c630431..45313f42 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 @@ -35,13 +35,18 @@ public interface PINManagementGUIFacade extends BKUGUIFacade { public static final String TITLE_UNBLOCK_PIN = "title.unblock.pin"; public static final String TITLE_ACTIVATE_SUCCESS = "title.activate.success"; public static final String TITLE_CHANGE_SUCCESS = "title.change.success"; - public static final String MESSAGE_ACTIVATE_SUCCESS = "message.activate.success"; - public static final String MESSAGE_CHANGE_SUCCESS = "message.change.success"; - public static final String MESSAGE_PINMGMT = "message.pin.mgmt"; - public static final String MESSAGE_ACTIVATE_PIN = "message.activate.pin"; - public static final String MESSAGE_CHANGE_PIN = "message.change.pin"; - public static final String MESSAGE_VERIFY_PIN = "message.verify.pin"; - public static final String MESSAGE_UNBLOCK_PIN = "message.unblock.pin"; + + // removed message.* prefix to reuse keys as help keys + public static final String MESSAGE_ACTIVATE_SUCCESS = "activate.success"; + public static final String MESSAGE_CHANGE_SUCCESS = "change.success"; + public static final String MESSAGE_PINMGMT = "pin.mgmt"; + public static final String MESSAGE_PINPAD = "pinpad"; + public static final String MESSAGE_CHANGEPIN_PINPAD = "pinpad.change"; + public static final String MESSAGE_ACTIVATE_PIN = "activate.pin"; + public static final String MESSAGE_CHANGE_PIN = "change.pin"; + public static final String MESSAGE_VERIFY_PIN = "verify.pin"; + public static final String MESSAGE_UNBLOCK_PIN = "unblock.pin"; + public static final String LABEL_OLD_PIN = "label.old.pin"; public static final String LABEL_NEW_PIN = "label.new.pin"; public static final String LABEL_REPEAT_PIN = "label.repeat.pin"; @@ -66,26 +71,37 @@ public interface PINManagementGUIFacade extends BKUGUIFacade { public static final String STATUS_UNKNOWN = "status.unknown"; public enum STATUS { ACTIV, NOT_ACTIV, BLOCKED, UNKNOWN }; + public enum DIALOG { VERIFY, ACTIVATE, CHANGE, UNBLOCK }; public void showPINManagementDialog(Map pins, ActionListener activateListener, String activateCmd, String changeCmd, String unblockCmd, String verifyCmd, ActionListener cancelListener, String cancelCmd); - public void showActivatePINDialog(PINSpec pin, + public void showPINDialog(DIALOG type, PINSpec pin, ActionListener okListener, String okCmd, ActionListener cancelListener, String cancelCmd); - public void showChangePINDialog(PINSpec pin, + public void showPINDialog(DIALOG type, PINSpec pin, int retries, ActionListener okListener, String okCmd, ActionListener cancelListener, String cancelCmd); - public void showUnblockPINDialog(PINSpec pin, - ActionListener okListener, String okCmd, - ActionListener cancelListener, String cancelCmd); + public void showPinpadPINDialog(DIALOG type, PINSpec pin, int retries); - public void showVerifyPINDialog(PINSpec pin, - ActionListener okListener, String okCmd, - ActionListener cancelListener, String cancelCmd); +// public void showActivatePINDialog(PINSpec pin, +// ActionListener okListener, String okCmd, +// ActionListener cancelListener, String cancelCmd); +// +// public void showChangePINDialog(PINSpec pin, +// ActionListener okListener, String okCmd, +// ActionListener cancelListener, String cancelCmd); +// +// public void showUnblockPINDialog(PINSpec pin, +// ActionListener okListener, String okCmd, +// ActionListener cancelListener, String cancelCmd); +// +// public void showVerifyPINDialog(PINSpec pin, +// ActionListener okListener, String okCmd, +// ActionListener cancelListener, String cancelCmd); public char[] getOldPin(); diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java index 85892026..81b635f8 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java @@ -42,7 +42,8 @@ public class PINManagementBKUWorker extends AppletBKUWorker { @Override public void run() { - gui.showWelcomeDialog(); + gui.showMessageDialog(BKUGUIFacade.TITLE_WELCOME, + BKUGUIFacade.MESSAGE_WELCOME); try { List responses = handleRequest(Collections.singletonList(new PINManagementRequest())); @@ -53,7 +54,6 @@ public class PINManagementBKUWorker extends AppletBKUWorker { log.debug("PIN management dialog terminated"); } else if (response instanceof ErrorResponse) { log.debug("PIN management dialog terminated with error"); - showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, null); } else { throw new RuntimeException("Invalid STAL response: " + response.getClass().getName()); } @@ -62,7 +62,11 @@ public class PINManagementBKUWorker extends AppletBKUWorker { } } catch (RuntimeException ex) { - log.error("unexpected error: " + ex.getMessage(), ex); + log.error(ex.getMessage()); + Throwable cause = ex.getCause(); + if (cause != null) { // && cause instanceof InterruptedException) { + log.info(cause.getMessage()); + } showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, null); } catch (Exception ex) { log.error(ex.getMessage(), ex); 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 new file mode 100644 index 00000000..b0dd8766 --- /dev/null +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/ManagementPINProviderFactory.java @@ -0,0 +1,53 @@ +/* + * 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.PINManagementGUIFacade; +import at.gv.egiz.smcc.PINProvider; +import at.gv.egiz.smcc.SignatureCard; + +/** + * + * @author Clemens Orthacker + */ +public abstract class ManagementPINProviderFactory { +// extends at.gv.egiz.bku.smccstal.PINProviderFactory { + + PINManagementGUIFacade gui; + + public static ManagementPINProviderFactory getInstance(SignatureCard forCard, + PINManagementGUIFacade gui) { +// if (forCard.ifdSupportsFeature(SignatureCard.FEATURE_VERIFY_PIN_DIRECT)) { +//// forCard.ifdSupportsFeature(SignatureCard.FEATURE_MODIFY_PIN_DIRECT) +// return new PinpadPINProviderFactory(gui); +// +// } else { + return new SoftwarePINProviderFactory(gui); +// } + } + + public abstract PINProvider getVerifyPINProvider(); + + public abstract PINProvider getActivatePINProvider(); + + public abstract ChangePINProvider getChangePINProvider(); + + public abstract PINProvider getUnblockPINProvider(); + +} 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 66db0484..6b565b26 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 @@ -18,13 +18,19 @@ package at.gv.egiz.bku.smccstal.ext; 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.gui.PINManagementGUIFacade.STATUS; import at.gv.egiz.bku.smccstal.AbstractRequestHandler; +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.PINProvider; import at.gv.egiz.smcc.PINSpec; import at.gv.egiz.smcc.STARCOSCard; +import at.gv.egiz.smcc.SignatureCard; import at.gv.egiz.smcc.SignatureCardException; +import at.gv.egiz.smcc.TimeoutException; import at.gv.egiz.smcc.VerificationFailedException; import at.gv.egiz.smcc.util.SMCCHelper; import at.gv.egiz.stal.ErrorResponse; @@ -35,8 +41,6 @@ import at.gv.egiz.stal.ext.PINManagementResponse; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; import javax.smartcardio.Card; import javax.smartcardio.CardChannel; import javax.smartcardio.CardException; @@ -53,7 +57,8 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { protected static final Log log = LogFactory.getLog(PINManagementRequestHandler.class); - Map pinStatuses; + protected Map pinStatuses; + private ManagementPINProviderFactory pinProviderFactory; @Override public STALResponse handleRequest(STALRequest request) throws InterruptedException { @@ -61,9 +66,12 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { PINManagementGUIFacade gui = (PINManagementGUIFacade) this.gui; + PINSpec selectedPIN = null; + try { - pinStatuses = getPINStatuses(); + pinStatuses = getPINStatuses(); + gui.showPINManagementDialog(pinStatuses, this, "activate_enterpin", "change_enterpin", "unblock_enterpuk", "verify_enterpin", this, "cancel"); @@ -74,175 +82,100 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { if ("cancel".equals(actionCommand)) { return new PINManagementResponse(); - } else if ("back".equals(actionCommand)) { - gui.showPINManagementDialog(pinStatuses, - this, "activate_enterpin", "change_enterpin", "unblock_enterpuk", "verify_enterpin", - this, "cancel"); } else { - PINSpec selectedPIN = gui.getSelectedPINSpec(); + selectedPIN = gui.getSelectedPINSpec(); if (selectedPIN == null) { - throw new RuntimeException("no PIN selected for activation/change"); + throw new NullPointerException("no PIN selected for activation/change"); } - if ("activate_enterpin".equals(actionCommand)) { - gui.showActivatePINDialog(selectedPIN, - this, "activate", this, "back"); - } else if ("change_enterpin".equals(actionCommand)) { - gui.showChangePINDialog(selectedPIN, - this, "change", this, "back"); - } else if ("unblock_enterpuk".equals(actionCommand)) { - gui.showUnblockPINDialog(selectedPIN, - this, "unblock", this, "back"); - } else if ("verify_enterpin".equals(actionCommand)) { - gui.showVerifyPINDialog(selectedPIN, - this, "verify", this, "back"); - } else if ("activate".equals(actionCommand)) { - try { - log.debug("activate " + selectedPIN.getLocalizedName()); - card.activatePIN(selectedPIN, - String.valueOf(gui.getPin())); + if (pinProviderFactory == null) { + pinProviderFactory = + ManagementPINProviderFactory.getInstance(card, gui); + } + + try { + if ("activate_enterpin".equals(actionCommand)) { + log.info("activate " + selectedPIN.getLocalizedName()); + card.activatePIN(selectedPIN, + pinProviderFactory.getActivatePINProvider()); updatePINStatus(selectedPIN, STATUS.ACTIV); gui.showMessageDialog(PINManagementGUIFacade.TITLE_ACTIVATE_SUCCESS, PINManagementGUIFacade.MESSAGE_ACTIVATE_SUCCESS, new Object[] {selectedPIN.getLocalizedName()}, - this, "ok"); + BKUGUIFacade.BUTTON_OK, this, "ok"); waitForAction(); - gui.showPINManagementDialog(pinStatuses, - this, "activate_enterpin", "change_enterpin", "unblock_enterpuk", "verify_enterpin", - this, "cancel"); - } catch (GetPINStatusException ex) { - log.error("failed to get " + selectedPIN.getLocalizedName() + - " status: " + ex.getMessage()); - gui.showErrorDialog(PINManagementGUIFacade.ERR_STATUS, null, - this, "cancel"); - } catch (SignatureCardException ex) { - log.error("failed to activate " + selectedPIN.getLocalizedName() + - ": " + ex.getMessage()); - gui.showErrorDialog(PINManagementGUIFacade.ERR_ACTIVATE, - new Object[] {selectedPIN.getLocalizedName()}, - this, "cancel"); - } - } else if ("change".equals(actionCommand)) { - log.info("change " + selectedPIN.getLocalizedName()); - try { - card.changePIN(selectedPIN, - String.valueOf(gui.getOldPin()), - String.valueOf(gui.getPin())); + } else if ("change_enterpin".equals(actionCommand)) { + log.info("change " + selectedPIN.getLocalizedName()); + card.changePIN(selectedPIN, + pinProviderFactory.getChangePINProvider()); updatePINStatus(selectedPIN, STATUS.ACTIV); gui.showMessageDialog(PINManagementGUIFacade.TITLE_CHANGE_SUCCESS, PINManagementGUIFacade.MESSAGE_CHANGE_SUCCESS, new Object[] {selectedPIN.getLocalizedName()}, - this, "ok"); - waitForAction(); - gui.showPINManagementDialog(pinStatuses, - this, "activate_enterpin", "change_enterpin", "unblock_enterpuk", "verify_enterpin", - this, "cancel"); - } catch (GetPINStatusException ex) { - log.error("failed to get " + selectedPIN.getLocalizedName() + - " status: " + ex.getMessage()); - gui.showErrorDialog(PINManagementGUIFacade.ERR_STATUS, null, - this, "cancel"); - } catch (LockedException ex) { - log.error("failed to change " + selectedPIN.getLocalizedName() + - ": PIN locked"); - updatePINStatus(selectedPIN, STATUS.BLOCKED); - gui.showErrorDialog(PINManagementGUIFacade.ERR_LOCKED, - new Object[] {selectedPIN.getLocalizedName()}, - this, "ok"); - waitForAction(); - gui.showPINManagementDialog(pinStatuses, - this, "activate_enterpin", "change_enterpin", "unblock_enterpuk", "verify_enterpin", - this, "cancel"); - } catch (VerificationFailedException ex) { - log.error("failed to change " + selectedPIN.getLocalizedName() + - ": " + ex.getMessage()); - gui.showErrorDialog(PINManagementGUIFacade.ERR_RETRIES, - new Object[] {selectedPIN.getLocalizedName(), ex.getRetries()}, - this, "change_enterpin"); - } catch (NotActivatedException ex) { - log.error("failed to change " + selectedPIN.getLocalizedName() + - ": PIN not active"); - updatePINStatus(selectedPIN, STATUS.NOT_ACTIV); - gui.showErrorDialog(PINManagementGUIFacade.ERR_NOT_ACTIVE, - new Object[] {selectedPIN.getLocalizedName()}, - this, "ok"); + BKUGUIFacade.BUTTON_OK, this, "ok"); waitForAction(); - gui.showPINManagementDialog(pinStatuses, - this, "activate_enterpin", "change_enterpin", "unblock_enterpuk", "verify_enterpin", - this, "cancel"); - } catch (SignatureCardException ex) { - log.error("failed to change " + selectedPIN.getLocalizedName() + - ": " + ex.getMessage()); - gui.showErrorDialog(PINManagementGUIFacade.ERR_CHANGE, - new Object[] {selectedPIN.getLocalizedName()}, - this, "cancel"); - } - } else if ("unblock".equals(actionCommand)) { - log.info("unblock " + selectedPIN.getLocalizedName()); - log.error("unblock PIN not implemented"); - gui.showErrorDialog(PINManagementGUIFacade.ERR_UNBLOCK, null, this, "cancel"); - } else if ("verify".equals(actionCommand)) { - try { + + } else if ("unblock_enterpuk".equals(actionCommand)) { + log.info("unblock " + selectedPIN.getLocalizedName()); + card.unblockPIN(selectedPIN, + pinProviderFactory.getUnblockPINProvider()); + } else if ("verify_enterpin".equals(actionCommand)) { log.info("verify " + selectedPIN.getLocalizedName()); - int retries = card.verifyPIN(selectedPIN, String.valueOf(gui.getPin())); - log.trace(retries + " retries"); - if (retries < 0) { - updatePINStatus(selectedPIN, STATUS.ACTIV); - gui.showPINManagementDialog(pinStatuses, - this, "activate_enterpin", "change_enterpin", "unblock_enterpuk", "verify_enterpin", - this, "cancel"); - } else { - log.error("failed to verify " + selectedPIN.getLocalizedName() + - ": " + retries + " retries left"); - gui.showErrorDialog(PINManagementGUIFacade.ERR_RETRIES, - new Object[] {selectedPIN.getLocalizedName(), retries}, - this, "verify_enterpin"); - } - } catch (GetPINStatusException ex) { - log.error("failed to get " + selectedPIN.getLocalizedName() + - " status: " + ex.getMessage()); - gui.showErrorDialog(PINManagementGUIFacade.ERR_STATUS, null, - this, "cancel"); - } catch (LockedException ex) { - log.error("failed to verify " + selectedPIN.getLocalizedName() + - ": PIN locked"); - updatePINStatus(selectedPIN, STATUS.BLOCKED); - gui.showPINManagementDialog(pinStatuses, - this, "activate_enterpin", "change_enterpin", "unblock_enterpuk", "verify_enterpin", - this, "cancel"); - } catch (NotActivatedException ex) { - log.error("failed to verify " + selectedPIN.getLocalizedName() + - ": PIN not active"); - updatePINStatus(selectedPIN, STATUS.NOT_ACTIV); - gui.showPINManagementDialog(pinStatuses, - this, "activate_enterpin", "change_enterpin", "unblock_enterpuk", "verify_enterpin", - this, "cancel"); - } catch (SignatureCardException ex) { - log.error("failed to verify " + selectedPIN.getLocalizedName() + - ": " + ex.getMessage()); - gui.showErrorDialog(PINManagementGUIFacade.ERR_STATUS, - new Object[] {selectedPIN.getLocalizedName()}, - this, "cancel"); + card.verifyPIN(selectedPIN, + pinProviderFactory.getVerifyPINProvider()); + updatePINStatus(selectedPIN, STATUS.ACTIV); } - - } else { - throw new RuntimeException("unsupported action " + actionCommand); + } catch (CancelledException ex) { + log.trace("cancelled"); + } catch (TimeoutException ex) { + 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"); + updatePINStatus(selectedPIN, STATUS.BLOCKED); + gui.showErrorDialog(PINManagementGUIFacade.ERR_LOCKED, + new Object[] {selectedPIN.getLocalizedName()}, + this, null); + waitForAction(); + } catch (NotActivatedException ex) { + log.error(selectedPIN.getLocalizedName() + " not active"); + updatePINStatus(selectedPIN, STATUS.NOT_ACTIV); + gui.showErrorDialog(PINManagementGUIFacade.ERR_NOT_ACTIVE, + new Object[] {selectedPIN.getLocalizedName()}, + this, null); + waitForAction(); } - } - } + } // end if + + selectedPIN = null; + gui.showPINManagementDialog(pinStatuses, + this, "activate_enterpin", "change_enterpin", "unblock_enterpuk", "verify_enterpin", + this, "cancel"); + } // end while + } catch (GetPINStatusException ex) { - log.error("Failed to get PIN statuses: " + ex.getMessage()); + 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, + this, "ok"); + waitForAction(); + return new ErrorResponse(1000); } } else { log.error("Got unexpected STAL request: " + request); return new ErrorResponse(1000); } - } @Override @@ -375,4 +308,100 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { pinStatuses.put(pinSpec, status); } } + +// /** +// * provides oldPin and newPin from one dialog, +// * and don't know whether providePIN() or provideOldPIN() is called first. +// */ +// class SoftwarePinProvider implements PINProvider { +// +// private PINManagementGUIFacade.DIALOG type; +// private boolean retry = false; +// +// private char[] newPin; +// private char[] oldPin; +// +// public SoftwarePinProvider(DIALOG type) { +// this.type = type; +// } +// +// @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 = +// (PINManagementGUIFacade) PINManagementRequestHandler.this.gui; +// +// if (retry) { +// gui.showPINDialog(type, spec, retries, +// PINManagementRequestHandler.this, "exec", +// PINManagementRequestHandler.this, "back"); +// } else { +// gui.showPINDialog(type, spec, +// PINManagementRequestHandler.this, "exec", +// PINManagementRequestHandler.this, "back"); +// } +// waitForAction(); +// +// if (actionCommand.equals("exec")) { +// gui.showWaitDialog(null); +// retry = true; +// oldPin = gui.getOldPin(); +// newPin = gui.getPin(); +// } else if (actionCommand.equals("back")) { +// throw new CancelledException(); +// } else { +// log.error("unsupported command " + actionCommand); +// throw new CancelledException(); +// } +// } +// } +// +// +// class PinpadPinProvider implements PINProvider { +// +// private PINManagementGUIFacade.DIALOG type; +// private boolean retry = false; +// +// public PinpadPinProvider(DIALOG type) { +// this.type = type; +// } +// +// @Override +// public char[] providePIN(PINSpec spec, int retries) { +// log.debug("provide pin for " + type); +// if (retry) { +// ((PINManagementGUIFacade) gui).showPinpadPINDialog(type, spec, retries); +// } else { +// ((PINManagementGUIFacade) gui).showPinpadPINDialog(type, spec, -1); +// retry = true; +// } +// return null; +// } +// +// @Override +// public char[] provideOldPIN(PINSpec spec, int retries) { +// return null; +// } +// } } 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 new file mode 100644 index 00000000..4176e0a9 --- /dev/null +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PinpadPINProviderFactory.java @@ -0,0 +1,126 @@ +/* + * 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 + */ +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; + +// gui.showPINDialog(type, spec, (retry) ? retries : -1, +// this, "exec", +// this, "back"); +// +// waitForAction(); +// +// if ("exec".equals(action)) { +// gui.showWaitDialog(null); +// retry = true; +// return gui.getPin(); +// } else if ("back".equals(action)) { +// throw new CancelledException(); +// } else { +// log.error("unsupported command " + action); +// throw new CancelledException(); +// } + } + + /** + * 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 { + title = BKUGUIFacade.TITLE_SIGN; + 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/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 new file mode 100644 index 00000000..e87512d0 --- /dev/null +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/SoftwarePINProviderFactory.java @@ -0,0 +1,148 @@ +/* + * 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 + */ +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(); + } + } + } +} diff --git a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties index 69d231f7..4ceacb21 100644 --- a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties +++ b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties @@ -22,13 +22,16 @@ title.verify.pin=PIN Eingeben title.activate.success=Erfolg title.change.success=Erfolg -message.pin.mgmt=Die Karte verf\u00FCgt \u00FCber {0} PINs -message.activate.pin={0} eingeben und best\u00E4tigen -message.change.pin={0} eingeben und best\u00E4tigen -message.unblock.pin=PUK zu {0} eingeben -message.verify.pin={0} eingeben (TODO: Warning not activated) -message.activate.success={0} wurde erfolgreich aktiviert. -message.change.success={0} wurde erfolgreich ge\u00E4ndert. +# removed message.* prefix to reuse keys as help keys +pin.mgmt=Die Karte verf\u00FCgt \u00FCber {0} PINs +pinpad={0} ({1} stellig) am Kartenleser eingeben und best\u00E4tigen. +pinpad.change={0} ({1} stellig) am Kartenleser eingeben und best\u00E4tigen. +activate.pin={0} eingeben und best\u00E4tigen +change.pin={0} eingeben und best\u00E4tigen +unblock.pin=PUK zu {0} eingeben +verify.pin={0} eingeben (TODO: Warning not activated) +activate.success={0} wurde erfolgreich aktiviert. +change.success={0} wurde erfolgreich ge\u00E4ndert. label.activation=e-card Aktivierungsprozess label.activation.step=Schritt {0} diff --git a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties index 920f7d5b..9178d65c 100644 --- a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties +++ b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties @@ -21,12 +21,15 @@ title.unblock.pin=Unblock PIN title.activate.success=Success title.change.success=Success -message.pin.mgmt=The smartcard has {0} PINs -message.activate.pin=Enter and confirm {0} -message.change.pin=Enter and confirm {0} -message.unblock.pin=Enter PUK for {0} -message.activate.success={0} successfully activated -message.change.success={0} successfully changed +# removed message.* prefix to reuse keys as help keys +pin.mgmt=The smartcard has {0} PINs +pinpad=Enter {0} ({1} digits) on pinpad and confirm. +pinpad.change=Enter {0} ({1} digits) on pinpad and confirm. +activate.pin=Enter and confirm {0} +change.pin=Enter and confirm {0} +unblock.pin=Enter PUK for {0} +activate.success={0} successfully activated +change.success={0} successfully changed label.activation=e-card activation process label.activation.step=Step {0} diff --git a/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java index ef8c87e4..b01abe72 100644 --- a/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java +++ b/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java @@ -74,7 +74,7 @@ public class BKUGUIWorker implements Runnable { @Override public void actionPerformed(ActionEvent e) { - gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", null, "hashdata"); + gui.showSignaturePINDialog(signPinSpec, -1, signListener, "sign", cancelListener, "cancel", null, "hashdata"); } }; HashDataInput signedRef1 = new ByteArrayHashDataInput( @@ -112,7 +112,7 @@ public class BKUGUIWorker implements Runnable { // signedRefs.add(signedRef4); // signedRefs.add(signedRef4); // signedRefs = Collections.singletonList(signedRef1); - gui.showHashDataInputDialog(signedRefs, returnListener, "return"); + gui.showSecureViewer(signedRefs, returnListener, "return"); } }; diff --git a/BKUAppletExt/src/test/java/at/gv/egiz/bku/smccstal/ext/FileSystemTest.java b/BKUAppletExt/src/test/java/at/gv/egiz/bku/smccstal/ext/FileSystemTest.java deleted file mode 100644 index 5fa3cbd7..00000000 --- a/BKUAppletExt/src/test/java/at/gv/egiz/bku/smccstal/ext/FileSystemTest.java +++ /dev/null @@ -1,435 +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.FileNotFoundException; -import at.gv.egiz.smcc.LockedException; -import at.gv.egiz.smcc.NotActivatedException; -import at.gv.egiz.smcc.PINProvider; -import at.gv.egiz.smcc.PINSpec; -import at.gv.egiz.smcc.SignatureCard; -import at.gv.egiz.smcc.SignatureCardException; -import at.gv.egiz.smcc.util.SMCCHelper; -import at.gv.egiz.smcc.util.SmartCardIO; -import java.math.BigInteger; -import java.nio.ByteBuffer; -import java.util.Arrays; -import java.util.Locale; -import java.util.Map; -import javax.smartcardio.Card; -import javax.smartcardio.CardChannel; -import javax.smartcardio.CardException; -import javax.smartcardio.CardTerminal; -import javax.smartcardio.CommandAPDU; -import javax.smartcardio.ResponseAPDU; -import org.junit.Ignore; -import org.junit.Test; -import static org.junit.Assert.*; - -/** - * - * @author Clemens Orthacker - */ -@Ignore -public class FileSystemTest { - - /** asign premium */ - public static final byte[] AID_DEC = new byte[] { (byte) 0xA0, (byte) 0x00, - (byte) 0x00, (byte) 0x01, (byte) 0x18, (byte) 0x45, (byte) 0x4E }; - - @Test -// @Ignore - public void testCard() throws CardException, SignatureCardException, InterruptedException { - - SMCCHelper smccHelper = new SMCCHelper(); - switch (smccHelper.getResultCode()) { - case SMCCHelper.CARD_FOUND: - System.out.println("card found "); - } - SignatureCard signatureCard = smccHelper.getSignatureCard(new Locale("de")); - Card card = signatureCard.getCard(); - -// SmartCardIO scIO = new SmartCardIO(); -// Map terminalCardMap = scIO.getCards(); -// -// for (CardTerminal ct : terminalCardMap.keySet()) { -// Card card = terminalCardMap.get(ct); -// System.out.println("found card (" + ct.getName() + "): " + Formatter.byteArrayToHexString(card.getATR().getBytes())); - - System.out.println("found card " + Formatter.byteArrayToHexString(card.getATR().getBytes())); - - CardChannel cardchannel; - - //RESET - System.out.println("RESET"); - signatureCard.reset(); - card = signatureCard.getCard(); -// card.disconnect(true); -// card = ct.connect("*"); - - System.out.println("begin exclusive"); - card.beginExclusive(); - System.out.println("get cardchannel"); - cardchannel = card.getBasicChannel(); - - testECard(cardchannel, signatureCard, card); -// testASignPremium(cardchannel, signatureCard, card); - -// } - - } - - public static class TestCard { - - protected CardChannel channel; - protected int ifs_ = 254; - - public TestCard(CardChannel channel) { - this.channel = channel; - } - - protected byte[] readTLVFile(byte[] aid, byte[] ef, String pin, byte kid, int maxLength) - throws SignatureCardException, InterruptedException, CardException { - - - // SELECT FILE (AID) - selectFileAID(aid); - - // SELECT FILE (EF) - ResponseAPDU resp = selectFileFID(ef); - if (resp.getSW() == 0x6a82) { - // EF not found - throw new FileNotFoundException("EF " + toString(ef) + " not found."); - } else if (resp.getSW() != 0x9000) { - throw new SignatureCardException("SELECT FILE with " + "FID=" + toString(ef) + " failed (" + "SW=" + Integer.toHexString(resp.getSW()) + ")."); - } - - // VERIFY - if (pin != null) { - int retries = verifyPIN(pin, kid); - if (retries != -1) { - throw new at.gv.egiz.smcc.VerificationFailedException(retries); - } - } - - return readBinaryTLV(maxLength, (byte) 0x30); - } - - protected byte[] readBinary(CardChannel channel, int offset, int len) - throws CardException, SignatureCardException { - - //transmit(channel,apdu) - ResponseAPDU resp = channel.transmit(new CommandAPDU(0x00, 0xB0, - 0x7F & (offset >> 8), offset & 0xFF, len)); - if (resp.getSW() == 0x9000) { - return resp.getData(); - } else if (resp.getSW() == 0x6982) { - throw new at.gv.egiz.smcc.SecurityStatusNotSatisfiedException(); - } else { - throw new SignatureCardException("Failed to read bytes (" + offset + "+" + len + "): SW=" + Integer.toHexString(resp.getSW())); - } - - } - - protected byte[] readBinaryTLV(int maxSize, byte expectedType) throws CardException, - SignatureCardException { - -// CardChannel channel = getCardChannel(); - - // read first chunk - int len = Math.min(maxSize, ifs_); - byte[] chunk = readBinary(channel, 0, len); - if (chunk.length > 0 && chunk[0] != expectedType) { - return null; - } - int offset = chunk.length; - int actualSize = maxSize; - if (chunk.length > 3) { - if ((chunk[1] & 0x80) > 0) { - int octets = (0x0F & chunk[1]); - actualSize = 2 + octets; - for (int i = 1; i <= octets; i++) { - actualSize += (0xFF & chunk[i + 1]) << ((octets - i) * 8); - } - } else { - actualSize = 2 + chunk[1]; - } - } - ByteBuffer buffer = ByteBuffer.allocate(actualSize); - buffer.put(chunk, 0, Math.min(actualSize, chunk.length)); - while (offset < actualSize) { - len = Math.min(ifs_, actualSize - offset); - chunk = readBinary(channel, offset, len); - buffer.put(chunk); - offset += chunk.length; - } - return buffer.array(); - - } - - protected byte[] selectFileAID(byte[] dfName) throws CardException, SignatureCardException { -// CardChannel channel = getCardChannel(); - ResponseAPDU resp = channel.transmit(new CommandAPDU(0x00, 0xA4, 0x04, - 0x00, dfName, 256)); - if (resp.getSW() != 0x9000) { - throw new SignatureCardException("Failed to select application AID=" + toString(dfName) + ": SW=" + Integer.toHexString(resp.getSW()) + "."); - } else { - return resp.getBytes(); - } - } - - protected ResponseAPDU selectFileFID(byte[] fid) throws CardException, SignatureCardException { -// CardChannel channel = getCardChannel(); - return channel.transmit(new CommandAPDU(0x00, 0xA4, 0x02, - 0x04, fid, 256)); - } - - protected String toString(byte[] b) { - StringBuffer sb = new StringBuffer(); - if (b != null && b.length > 0) { - sb.append(Integer.toHexString((b[0] & 240) >> 4)); - sb.append(Integer.toHexString(b[0] & 15)); - } - for (int i = 1; i < b.length; i++) { - sb.append(':'); - sb.append(Integer.toHexString((b[i] & 240) >> 4)); - sb.append(Integer.toHexString(b[i] & 15)); - } - return sb.toString(); - } - - protected int verifyPIN(String pin, byte kid) throws CardException, SignatureCardException { - -// CardChannel channel = getCardChannel(); - - ResponseAPDU resp; - if (pin == null) { - // - resp = channel.transmit(new CommandAPDU(0x00, 0x20, 0x00, kid)); - } else { - // PIN length in bytes - int len = (int) Math.ceil(pin.length() / 2); - - // BCD encode PIN and marshal PIN block - byte[] pinBytes = new BigInteger(pin, 16).toByteArray(); - byte[] pinBlock = new byte[8]; - if (len < pinBytes.length) { - System.arraycopy(pinBytes, pinBytes.length - len, pinBlock, 1, len); - } else { - System.arraycopy(pinBytes, 0, pinBlock, len - pinBytes.length + 1, - pinBytes.length); - } - pinBlock[0] = (byte) (0x20 + len * 2); - Arrays.fill(pinBlock, len + 1, 8, (byte) 0xff); - - resp = channel.transmit(new CommandAPDU(0x00, 0x20, 0x00, kid, pinBlock));//, false); - - } - - if (resp.getSW() == 0x63c0) { - throw new LockedException("PIN locked."); - } else if (resp.getSW1() == 0x63 && resp.getSW2() >> 4 == 0xc) { - // return number of possible retries - return resp.getSW2() & 0x0f; - } else if (resp.getSW() == 0x6983) { - throw new LockedException(); - } else if (resp.getSW() == 0x6984) { - // PIN LCS = "Initialized" (-> not activated) - throw new NotActivatedException("PIN not set."); - } else if (resp.getSW() == 0x9000) { - return -1; // success - } else { - throw new SignatureCardException("Failed to verify pin: SW=" + Integer.toHexString(resp.getSW())); - } - } - } - - public static class Formatter { - - private static String[] alphabet = {"0", "1", "2", - "3", "4", "5", "6", "7", "8", - "9", "A", "B", "C", "D", "E", - "F"}; - - public static String byteArrayToHexString(byte[] bytes) { - - if (bytes == null || bytes.length <= 0) { - return null; - } - - StringBuffer buf = new StringBuffer(2 * bytes.length); - - byte c = 0x00; - - for (int i = 0; i < bytes.length; i++) { - - // high nibble - c = (byte) (bytes[i] & 0xf0); - - // shift down - c = (byte) (c >>> 4); - - // cut high order bits - c = (byte) (c & 0x0f); - - buf.append(alphabet[(int) c]); - - // low nibble - c = (byte) (bytes[i] & 0x0f); - - buf.append(alphabet[(int) c]); - if (i < bytes.length - 1) { - buf.append(':'); - } - } - - return buf.toString(); - - } - } - - protected void testASignPremium(CardChannel cardchannel, SignatureCard signatureCard, Card card) throws CardException { - byte[] selectMF = new byte[]{(byte) 0x00, (byte) 0xA4, (byte) 0x00, (byte) 0x0C, (byte) 0x02, (byte) 0x3F, (byte) 0x00}; - byte[] selectDF_DEC = new byte[] { (byte) 0x00, (byte) 0xA4, (byte) 0x00, (byte) 0x0C, (byte) 0x02, (byte) 0xdf, (byte) 0x71 }; - byte[] selectAID_DEC = new byte[] { (byte) 0x00, (byte) 0xA4, (byte) 0x04, (byte) 0x00, (byte) 0x07, (byte) 0xA0, (byte) 0x00, - (byte) 0x00, (byte) 0x01, (byte) 0x18, (byte) 0x45, (byte) 0x4E }; - - CommandAPDU cAPDU; - ResponseAPDU rAPDU; - byte[] sw; - - cAPDU = new CommandAPDU(selectMF); - rAPDU = cardchannel.transmit(cAPDU); - sw = new byte[]{(byte) (0xFF & rAPDU.getSW1()), (byte) (0xFF & rAPDU.getSW2())}; - System.out.println("cAPDU: " + Formatter.byteArrayToHexString(cAPDU.getBytes())); - System.out.println("rAPDU (sw=" + Formatter.byteArrayToHexString(sw) + "): " + Formatter.byteArrayToHexString(rAPDU.getData())); - - cAPDU = new CommandAPDU(selectAID_DEC); - rAPDU = cardchannel.transmit(cAPDU); - sw = new byte[]{(byte) (0xFF & rAPDU.getSW1()), (byte) (0xFF & rAPDU.getSW2())}; - System.out.println("cAPDU: " + Formatter.byteArrayToHexString(cAPDU.getBytes())); - System.out.println("rAPDU (sw=" + Formatter.byteArrayToHexString(sw) + "): " + Formatter.byteArrayToHexString(rAPDU.getData())); - - cAPDU = new CommandAPDU(selectDF_DEC); - rAPDU = cardchannel.transmit(cAPDU); - sw = new byte[]{(byte) (0xFF & rAPDU.getSW1()), (byte) (0xFF & rAPDU.getSW2())}; - System.out.println("cAPDU: " + Formatter.byteArrayToHexString(cAPDU.getBytes())); - System.out.println("rAPDU (sw=" + Formatter.byteArrayToHexString(sw) + "): " + Formatter.byteArrayToHexString(rAPDU.getData())); - - - } - - protected void testECard(CardChannel cardchannel, SignatureCard signatureCard, Card card) throws CardException, InterruptedException, SignatureCardException { -// if (cardTerminal != null) { -// card_ = cardTerminal.connect("*"); -// } - byte[] selectMF = new byte[]{(byte) 0x00, (byte) 0xA4, (byte) 0x00, (byte) 0x0C, (byte) 0x02, (byte) 0x3F, (byte) 0x00}; - byte[] readEF_GDO = new byte[]{(byte) 0x00, (byte) 0xB0, (byte) 0x82, (byte) 0x00, (byte) 0x00}; - CommandAPDU cAPDU; - ResponseAPDU rAPDU; - byte[] sw; - cAPDU = new CommandAPDU(selectMF); - rAPDU = cardchannel.transmit(cAPDU); - sw = new byte[]{(byte) (0xFF & rAPDU.getSW1()), (byte) (0xFF & rAPDU.getSW2())}; - System.out.println("cAPDU: " + Formatter.byteArrayToHexString(cAPDU.getBytes())); - System.out.println("rAPDU (sw=" + Formatter.byteArrayToHexString(sw) + "): " + Formatter.byteArrayToHexString(rAPDU.getData())); - cAPDU = new CommandAPDU(readEF_GDO); - rAPDU = cardchannel.transmit(cAPDU); - sw = new byte[]{(byte) (0xFF & rAPDU.getSW1()), (byte) (0xFF & rAPDU.getSW2())}; - System.out.println("cAPDU: " + Formatter.byteArrayToHexString(cAPDU.getBytes())); - System.out.println("rAPDU (sw=" + Formatter.byteArrayToHexString(sw) + "): " + Formatter.byteArrayToHexString(rAPDU.getData())); - byte[] EF_GDO = rAPDU.getData(); - //RESET - System.out.println("RESET"); - signatureCard.reset(); - card = signatureCard.getCard(); -// card.disconnect(true); -// card = ct.connect("*"); - System.out.println("begin exclusive"); - card.beginExclusive(); - System.out.println("get cardchannel"); - cardchannel = card.getBasicChannel(); - byte[] getCLC = new byte[]{(byte) 0x00, (byte) 0xCA, (byte) 0xDF, (byte) 0x20, (byte) 0x00}; - byte[] verifyKartenPIN = new byte[]{(byte) 0x00, (byte) 0x20, (byte) 0x00, (byte) 0x01}; - byte[] selectDF_SichereSignatur = new byte[]{(byte) 0x00, (byte) 0xA4, (byte) 0x04, (byte) 0x00, (byte) 0x08, (byte) 0xD0, (byte) 0x40, (byte) 0x00, (byte) 0x00, (byte) 0x17, (byte) 0x00, (byte) 0x12, (byte) 0x01, (byte) 0x00}; - byte[] verifySignaturPIN = new byte[]{(byte) 0x00, (byte) 0x20, (byte) 0x00, (byte) 0x81}; - cAPDU = new CommandAPDU(getCLC); - rAPDU = cardchannel.transmit(cAPDU); - sw = new byte[]{(byte) (0xFF & rAPDU.getSW1()), (byte) (0xFF & rAPDU.getSW2())}; - System.out.println("cAPDU: " + Formatter.byteArrayToHexString(cAPDU.getBytes())); - System.out.println("rAPDU (sw=" + Formatter.byteArrayToHexString(sw) + "): " + Formatter.byteArrayToHexString(rAPDU.getData())); - byte[] clc = rAPDU.getData(); - cAPDU = new CommandAPDU(verifyKartenPIN); - rAPDU = cardchannel.transmit(cAPDU); - sw = new byte[]{(byte) (0xFF & rAPDU.getSW1()), (byte) (0xFF & rAPDU.getSW2())}; - System.out.println("cAPDU: " + Formatter.byteArrayToHexString(cAPDU.getBytes())); - System.out.println("rAPDU (sw=" + Formatter.byteArrayToHexString(sw) + "): " + Formatter.byteArrayToHexString(rAPDU.getData())); - cAPDU = new CommandAPDU(selectDF_SichereSignatur); - rAPDU = cardchannel.transmit(cAPDU); - sw = new byte[]{(byte) (0xFF & rAPDU.getSW1()), (byte) (0xFF & rAPDU.getSW2())}; - System.out.println("cAPDU: " + Formatter.byteArrayToHexString(cAPDU.getBytes())); - System.out.println("rAPDU (sw=" + Formatter.byteArrayToHexString(sw) + "): " + Formatter.byteArrayToHexString(rAPDU.getData())); - cAPDU = new CommandAPDU(verifySignaturPIN); - rAPDU = cardchannel.transmit(cAPDU); - sw = new byte[]{(byte) (0xFF & rAPDU.getSW1()), (byte) (0xFF & rAPDU.getSW2())}; - System.out.println("cAPDU: " + Formatter.byteArrayToHexString(cAPDU.getBytes())); - System.out.println("rAPDU (sw=" + Formatter.byteArrayToHexString(sw) + "): " + Formatter.byteArrayToHexString(rAPDU.getData())); - //RESET - System.out.println("RESET"); - signatureCard.reset(); - card = signatureCard.getCard(); - System.out.println("InfoboxReadRequests..."); - PINProvider pinProvider = new PINProvider() { - - @Override - public String providePIN(PINSpec spec, int retries) throws InterruptedException { - if (retries >= 3) { - return "2540"; - } else { - throw new InterruptedException("TOO FEW PIN RETRIES LEFT, ABORTING"); - } - } - }; - byte[] ehic = signatureCard.getInfobox("EHIC", pinProvider, null); - System.out.println("EHIC: " + Formatter.byteArrayToHexString(ehic)); - byte[] grunddaten = signatureCard.getInfobox("Grunddaten", pinProvider, null); - System.out.println("Grunddaten: " + Formatter.byteArrayToHexString(grunddaten)); - //RESET - System.out.println("RESET"); - signatureCard.reset(); - card = signatureCard.getCard(); -// card.disconnect(true); -// card = ct.connect("*"); - System.out.println("begin exclusive"); - card.beginExclusive(); - System.out.println("get cardchannel"); - cardchannel = card.getBasicChannel(); - cAPDU = new CommandAPDU(getCLC); - rAPDU = cardchannel.transmit(cAPDU); - sw = new byte[]{(byte) (0xFF & rAPDU.getSW1()), (byte) (0xFF & rAPDU.getSW2())}; - System.out.println("cAPDU: " + Formatter.byteArrayToHexString(cAPDU.getBytes())); - System.out.println("rAPDU (sw=" + Formatter.byteArrayToHexString(sw) + "): " + Formatter.byteArrayToHexString(rAPDU.getData())); - assertTrue(Arrays.equals(clc, rAPDU.getData())); - cAPDU = new CommandAPDU(readEF_GDO); - rAPDU = cardchannel.transmit(cAPDU); - sw = new byte[]{(byte) (0xFF & rAPDU.getSW1()), (byte) (0xFF & rAPDU.getSW2())}; - System.out.println("cAPDU: " + Formatter.byteArrayToHexString(cAPDU.getBytes())); - System.out.println("rAPDU (sw=" + Formatter.byteArrayToHexString(sw) + "): " + Formatter.byteArrayToHexString(rAPDU.getData())); - assertTrue(Arrays.equals(EF_GDO, rAPDU.getData())); -// } - } -} -- cgit v1.2.3 From 616e06910051528674165319a1d6d161dff5859c Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 27 Mar 2009 17:33:11 +0000 Subject: 1.1-RC6 (pinpad, pinmgmt, secureviewer) git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@323 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../java/at/gv/egiz/bku/gui/PINManagementGUI.java | 26 ++++++------- .../at/gv/egiz/bku/gui/PINManagementGUIFacade.java | 9 +++-- .../java/at/gv/egiz/bku/gui/PINStatusRenderer.java | 2 - .../smccstal/ext/ManagementPINProviderFactory.java | 13 ++++--- .../bku/smccstal/ext/PinpadPINProviderFactory.java | 45 +++++++++++++--------- .../gv/egiz/bku/gui/ActivationMessages.properties | 6 ++- .../egiz/bku/gui/ActivationMessages_en.properties | 6 ++- 7 files changed, 60 insertions(+), 47 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java index 159dd29d..d1ca6c00 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java @@ -118,18 +118,18 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac pinStatusTable.setDefaultRenderer(PINSpec.class, new PINSpecRenderer()); pinStatusTable.setDefaultRenderer(STATUS.class, new PINStatusRenderer(cardmgmtMessages)); pinStatusTable.setTableHeader(null); - - pinStatusTable.addMouseMotionListener(new MouseMotionAdapter() { - - @Override - public void mouseMoved(MouseEvent e) { - if (pinStatusTable.columnAtPoint(e.getPoint()) == 0) { - pinStatusTable.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); - } else { - pinStatusTable.setCursor(Cursor.getDefaultCursor()); - } - } - }); + pinStatusTable.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); +// pinStatusTable.addMouseMotionListener(new MouseMotionAdapter() { +// +// @Override +// public void mouseMoved(MouseEvent e) { +// if (pinStatusTable.columnAtPoint(e.getPoint()) == 0) { +// pinStatusTable.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); +// } else { +// pinStatusTable.setCursor(Cursor.getDefaultCursor()); +// } +// } +// }); final JButton activateButton = new JButton(); activateButton.setFont(activateButton.getFont().deriveFont(activateButton.getFont().getStyle() & ~java.awt.Font.BOLD)); @@ -392,7 +392,7 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac if (pinpad) { JLabel pinpadLabel = new JLabel(); pinpadLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() & ~Font.BOLD)); - String pinpadPattern = getMessage(MESSAGE_PINPAD); + String pinpadPattern = getMessage(MESSAGE_VERIFYPIN_PINPAD); pinpadLabel.setText(MessageFormat.format(pinpadPattern, new Object[] { pinSpec.getLocalizedName(), pinSize })); 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 45313f42..f0cc0a27 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 @@ -40,13 +40,16 @@ public interface PINManagementGUIFacade extends BKUGUIFacade { public static final String MESSAGE_ACTIVATE_SUCCESS = "activate.success"; public static final String MESSAGE_CHANGE_SUCCESS = "change.success"; public static final String MESSAGE_PINMGMT = "pin.mgmt"; - public static final String MESSAGE_PINPAD = "pinpad"; - public static final String MESSAGE_CHANGEPIN_PINPAD = "pinpad.change"; +// public static final String MESSAGE_PINPAD = "pinpad"; public static final String MESSAGE_ACTIVATE_PIN = "activate.pin"; public static final String MESSAGE_CHANGE_PIN = "change.pin"; public static final String MESSAGE_VERIFY_PIN = "verify.pin"; public static final String MESSAGE_UNBLOCK_PIN = "unblock.pin"; - + public static final String MESSAGE_ACTIVATEPIN_PINPAD = "activate.pinpad"; + public static final String MESSAGE_CHANGEPIN_PINPAD = "change.pinpad"; + public static final String MESSAGE_VERIFYPIN_PINPAD = "verify.pinpad"; + public static final String MESSAGE_UNBLOCKPIN_PINPAD = "unblock.pinpad"; + public static final String LABEL_OLD_PIN = "label.old.pin"; public static final String LABEL_NEW_PIN = "label.new.pin"; public static final String LABEL_REPEAT_PIN = "label.repeat.pin"; diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java index 4cb84b77..83ff74f2 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java @@ -22,8 +22,6 @@ import java.awt.Color; import java.awt.Font; import java.util.ResourceBundle; import javax.swing.table.DefaultTableCellRenderer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; /** * 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 b0dd8766..d635b8df 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 @@ -19,6 +19,7 @@ package at.gv.egiz.bku.smccstal.ext; import at.gv.egiz.smcc.ChangePINProvider; import at.gv.egiz.bku.gui.PINManagementGUIFacade; +import at.gv.egiz.smcc.ccid.CCID; import at.gv.egiz.smcc.PINProvider; import at.gv.egiz.smcc.SignatureCard; @@ -33,13 +34,13 @@ public abstract class ManagementPINProviderFactory { public static ManagementPINProviderFactory getInstance(SignatureCard forCard, PINManagementGUIFacade gui) { -// if (forCard.ifdSupportsFeature(SignatureCard.FEATURE_VERIFY_PIN_DIRECT)) { -//// forCard.ifdSupportsFeature(SignatureCard.FEATURE_MODIFY_PIN_DIRECT) -// return new PinpadPINProviderFactory(gui); -// -// } else { + if (forCard.getReader().hasFeature(CCID.FEATURE_VERIFY_PIN_DIRECT)) { +// forCard.ifdSupportsFeature(SignatureCard.FEATURE_MODIFY_PIN_DIRECT) + return new PinpadPINProviderFactory(gui); + + } else { return new SoftwarePINProviderFactory(gui); -// } + } } public abstract PINProvider getVerifyPINProvider(); 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 index 4176e0a9..a9ad5ef8 100644 --- 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 @@ -73,23 +73,6 @@ public class PinpadPINProviderFactory extends ManagementPINProviderFactory { showPinpadPINDialog(retries, spec); retry = true; return null; - -// gui.showPINDialog(type, spec, (retry) ? retries : -1, -// this, "exec", -// this, "back"); -// -// waitForAction(); -// -// if ("exec".equals(action)) { -// gui.showWaitDialog(null); -// retry = true; -// return gui.getPin(); -// } else if ("back".equals(action)) { -// throw new CancelledException(); -// } else { -// log.error("unsupported command " + action); -// throw new CancelledException(); -// } } /** @@ -111,14 +94,38 @@ public class PinpadPINProviderFactory extends ManagementPINProviderFactory { title = BKUGUIFacade.TITLE_RETRY; message = BKUGUIFacade.MESSAGE_RETRIES; params = new Object[]{String.valueOf(retries)}; - } else { - title = BKUGUIFacade.TITLE_SIGN; + } 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/resources/at/gv/egiz/bku/gui/ActivationMessages.properties b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties index 4ceacb21..c6d219d4 100644 --- a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties +++ b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties @@ -24,12 +24,14 @@ title.change.success=Erfolg # removed message.* prefix to reuse keys as help keys pin.mgmt=Die Karte verf\u00FCgt \u00FCber {0} PINs -pinpad={0} ({1} stellig) am Kartenleser eingeben und best\u00E4tigen. -pinpad.change={0} ({1} stellig) am Kartenleser eingeben und best\u00E4tigen. activate.pin={0} eingeben und best\u00E4tigen change.pin={0} eingeben und best\u00E4tigen unblock.pin=PUK zu {0} eingeben verify.pin={0} eingeben (TODO: Warning not activated) +verify.pinpad={0} ({1} stellig) am Kartenleser eingeben (und best\u00E4tigen). +activate.pinpad={0} ({1} stellig) am Kartenleser eingeben und wiederholen (jeweils best\u00E4tigen). +change.pinpad=Alte {0} ({1} stellig) am Kartenleser eingeben, danach neue {0} eingeben und wiederholen (jeweils best\u00E4tigen). +unblock.pinpad={0} ({1} stellig) am Kartenleser eingeben (und best\u00E4tigen). activate.success={0} wurde erfolgreich aktiviert. change.success={0} wurde erfolgreich ge\u00E4ndert. diff --git a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties index 9178d65c..b4bededf 100644 --- a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties +++ b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties @@ -23,11 +23,13 @@ title.change.success=Success # removed message.* prefix to reuse keys as help keys pin.mgmt=The smartcard has {0} PINs -pinpad=Enter {0} ({1} digits) on pinpad and confirm. -pinpad.change=Enter {0} ({1} digits) on pinpad and confirm. activate.pin=Enter and confirm {0} change.pin=Enter and confirm {0} unblock.pin=Enter PUK for {0} +verify.pinpad=Enter {0} ({1} digits) on cardreader (and confirm). +activate.pinpad=Enter {0} ({1} digits) on cardreader and repeat (confirm in each case). +change.pinpad=Enter old {0} ({1} digits) on cardreader, then enter new {0} and repeat (confirm in each case). +unblock.pinpad=Enter {0} ({1} digits) on cardreader (and confirm). activate.success={0} successfully activated change.success={0} successfully changed -- cgit v1.2.3 From 2dbf2347bc78fd835c857ad438514fb6251f6f7a Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 2 Apr 2009 19:13:48 +0000 Subject: 1.1-RC7 (pinpad revisited) git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@325 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../at/gv/egiz/bku/gui/PINManagementGUIFacade.java | 3 + .../smccstal/ext/ManagementPINProviderFactory.java | 230 +++++++++++++++++++-- .../smccstal/ext/PINManagementRequestHandler.java | 43 +++- .../bku/smccstal/ext/PinpadPINProviderFactory.java | 133 ------------ .../smccstal/ext/SoftwarePINProviderFactory.java | 148 ------------- .../gv/egiz/bku/gui/ActivationMessages.properties | 5 +- .../egiz/bku/gui/ActivationMessages_en.properties | 3 + 7 files changed, 260 insertions(+), 305 deletions(-) delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PinpadPINProviderFactory.java delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/SoftwarePINProviderFactory.java (limited to 'BKUAppletExt') 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 */ -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 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 - */ -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 - */ -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(); - } - } - } -} diff --git a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties index c6d219d4..15fc2827 100644 --- a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties +++ b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties @@ -55,9 +55,12 @@ err.activate=Beim Aktivieren der {0} trat ein Fehler auf. err.change=Beim \u00C4ndern der {0} trat ein Fehler auf. err.unblock=Das Entsperren der {0} wird nicht unterst\u00FCtzt. err.verify=VERIFY ERROR (TODO) -err.retries=Falscher {0}, noch {1} Versuche +err.retries=Falsche {0}, noch {1} Versuche err.locked={0} gesperrt. err.not.active={0} nicht aktiviert. +err.pin.format=Ung\u00FCltige {0} L\u00E4nge, verlangt sind {1} Stellen. +err.pin.confirmation={0} und Best\u00E4tigung stimmen nicht \u00FCberein. +err.pin.operation.aborted=Der Vorgang f\u00FCr {0} wurde abgebrochen. status.not.active=NICHT AKTIV status.active=AKTIV diff --git a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties index b4bededf..8cc9d01a 100644 --- a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties +++ b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties @@ -55,6 +55,9 @@ err.unblock=Unblocking of {0} is not supported. err.retries=Wrong {0}, {1} tries remaining err.locked={0} locked err.not.active={0} not activated. +err.pin.format=Invalid {0} length, {1} digit(s) required. +err.pin.confirmation={0} and confirmation do not match. +err.pin.operation.aborted=The operation on {0} was aborted. status.not.active=NOT ACTIVE status.active=ACTIVE -- cgit v1.2.3 From 78728a96af022bae87e4d0d11855f420736d87b7 Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 3 Apr 2009 15:04:26 +0000 Subject: applet dispatcher (prevent applet caching) git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@326 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../at/gv/egiz/bku/smccstal/ext/ManagementPINProviderFactory.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'BKUAppletExt') 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 090caf50..f54f89d4 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 @@ -122,8 +122,12 @@ public class ManagementPINProviderFactory extends PINProviderFactory { String title, message; Object[] params; if (retry) { + if (retries == 1) { + message = BKUGUIFacade.MESSAGE_LAST_RETRY_PINPAD; + } else { + message = BKUGUIFacade.MESSAGE_RETRIES_PINPAD; + } 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; -- cgit v1.2.3 From 1a75d2ae8fa57011166110754fed3ab082a52302 Mon Sep 17 00:00:00 2001 From: clemenso Date: Tue, 7 Apr 2009 09:09:21 +0000 Subject: [maven-release-plugin] prepare release mocca-1.1.0 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@329 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index 3ff88ed8..69daa021 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -3,34 +3,34 @@ bku at.gv.egiz - 1.0.5-SNAPSHOT + 1.1.0 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.0.2-SNAPSHOT - + 1.1.0 + at.gv.egiz STALExt - 1.0.2-SNAPSHOT + 1.1.0 at.gv.egiz STALXService - 1.0.2-SNAPSHOT + 1.1.0 at.gv.egiz smccSTAL - 1.0.5-SNAPSHOT + 1.1.0 at.gv.egiz BKUApplet - 1.0.5-SNAPSHOT + 1.1.0 -- cgit v1.2.3 From 47bc6ce0d569d7bff1bab891c2f6ce66cd2a544e Mon Sep 17 00:00:00 2001 From: clemenso Date: Tue, 7 Apr 2009 09:13:32 +0000 Subject: [maven-release-plugin] prepare for next development iteration git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@331 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index 69daa021..936b7d3a 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -3,34 +3,34 @@ bku at.gv.egiz - 1.1.0 + 1.1.1-SNAPSHOT 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.1.0 + 1.1.1-SNAPSHOT at.gv.egiz STALExt - 1.1.0 + 1.1.1-SNAPSHOT at.gv.egiz STALXService - 1.1.0 + 1.1.1-SNAPSHOT at.gv.egiz smccSTAL - 1.1.0 + 1.1.1-SNAPSHOT at.gv.egiz BKUApplet - 1.1.0 + 1.1.1-SNAPSHOT -- cgit v1.2.3 From 8a336c8343f86f69680817153334d0d37da56010 Mon Sep 17 00:00:00 2001 From: clemenso Date: Mon, 20 Apr 2009 14:56:16 +0000 Subject: en localization of pinMgmt (verifyPin, cancelbutton) no java message (todo: localize) git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@339 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../src/main/java/at/gv/egiz/bku/gui/PINManagementGUIFacade.java | 1 + .../src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties | 2 +- .../main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) (limited to 'BKUAppletExt') 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 848cd17f..e8415dc3 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 @@ -28,6 +28,7 @@ import java.util.Map; public interface PINManagementGUIFacade extends BKUGUIFacade { public static final String HELP_PINMGMT = "help.pin.mgmt"; +// public static final String HELP_VERIFY_PIN = "help.pin.verify"; public static final String TITLE_PINMGMT = "title.pin.mgmt"; public static final String TITLE_ACTIVATE_PIN = "title.activate.pin"; public static final String TITLE_CHANGE_PIN = "title.change.pin"; diff --git a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties index 15fc2827..bdf077d4 100644 --- a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties +++ b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties @@ -27,7 +27,7 @@ pin.mgmt=Die Karte verf\u00FCgt \u00FCber {0} PINs activate.pin={0} eingeben und best\u00E4tigen change.pin={0} eingeben und best\u00E4tigen unblock.pin=PUK zu {0} eingeben -verify.pin={0} eingeben (TODO: Warning not activated) +verify.pin={0} eingeben verify.pinpad={0} ({1} stellig) am Kartenleser eingeben (und best\u00E4tigen). activate.pinpad={0} ({1} stellig) am Kartenleser eingeben und wiederholen (jeweils best\u00E4tigen). change.pinpad=Alte {0} ({1} stellig) am Kartenleser eingeben, danach neue {0} eingeben und wiederholen (jeweils best\u00E4tigen). diff --git a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties index 8cc9d01a..037ae091 100644 --- a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties +++ b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties @@ -16,6 +16,7 @@ title.activation=Activation title.pin.mgmt=PIN Management title.activate.pin=Activate PIN +title.verify.pin=Enter PIN title.change.pin=Change PIN title.unblock.pin=Unblock PIN title.activate.success=Success @@ -26,6 +27,7 @@ pin.mgmt=The smartcard has {0} PINs activate.pin=Enter and confirm {0} change.pin=Enter and confirm {0} unblock.pin=Enter PUK for {0} +verify.pin=Enter {0} verify.pinpad=Enter {0} ({1} digits) on cardreader (and confirm). activate.pinpad=Enter {0} ({1} digits) on cardreader and repeat (confirm in each case). change.pinpad=Enter old {0} ({1} digits) on cardreader, then enter new {0} and repeat (confirm in each case). -- cgit v1.2.3 From 1ad17f951032d8b33c351d95d2f336c98d040d4d Mon Sep 17 00:00:00 2001 From: clemenso Date: Mon, 20 Apr 2009 15:01:52 +0000 Subject: [maven-release-plugin] prepare release mocca-1.1.1 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@340 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index 936b7d3a..757adca3 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -3,34 +3,34 @@ bku at.gv.egiz - 1.1.1-SNAPSHOT + 1.1.1 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.1.1-SNAPSHOT + 1.1.1 at.gv.egiz STALExt - 1.1.1-SNAPSHOT + 1.1.1 at.gv.egiz STALXService - 1.1.1-SNAPSHOT + 1.1.1 at.gv.egiz smccSTAL - 1.1.1-SNAPSHOT + 1.1.1 at.gv.egiz BKUApplet - 1.1.1-SNAPSHOT + 1.1.1 -- cgit v1.2.3 From 3b5c56568c01f6f012888ce958df8e6d8f5fb18f Mon Sep 17 00:00:00 2001 From: clemenso Date: Mon, 20 Apr 2009 15:30:31 +0000 Subject: [maven-release-plugin] rollback the release of mocca-1.1.1 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@343 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index 757adca3..936b7d3a 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -3,34 +3,34 @@ bku at.gv.egiz - 1.1.1 + 1.1.1-SNAPSHOT 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.1.1 + 1.1.1-SNAPSHOT at.gv.egiz STALExt - 1.1.1 + 1.1.1-SNAPSHOT at.gv.egiz STALXService - 1.1.1 + 1.1.1-SNAPSHOT at.gv.egiz smccSTAL - 1.1.1 + 1.1.1-SNAPSHOT at.gv.egiz BKUApplet - 1.1.1 + 1.1.1-SNAPSHOT -- cgit v1.2.3 From 9a04c66553e1f7a088407176299bb3acbb463e5a Mon Sep 17 00:00:00 2001 From: clemenso Date: Mon, 20 Apr 2009 15:41:17 +0000 Subject: [maven-release-plugin] prepare release mocca-1.1.1 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@344 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index 936b7d3a..757adca3 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -3,34 +3,34 @@ bku at.gv.egiz - 1.1.1-SNAPSHOT + 1.1.1 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.1.1-SNAPSHOT + 1.1.1 at.gv.egiz STALExt - 1.1.1-SNAPSHOT + 1.1.1 at.gv.egiz STALXService - 1.1.1-SNAPSHOT + 1.1.1 at.gv.egiz smccSTAL - 1.1.1-SNAPSHOT + 1.1.1 at.gv.egiz BKUApplet - 1.1.1-SNAPSHOT + 1.1.1 -- cgit v1.2.3 From 0843cee3fde9b3c81410e219e311e8e03aa9afcd Mon Sep 17 00:00:00 2001 From: clemenso Date: Mon, 20 Apr 2009 15:51:45 +0000 Subject: [maven-release-plugin] rollback the release of mocca-1.1.1 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@345 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index 757adca3..936b7d3a 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -3,34 +3,34 @@ bku at.gv.egiz - 1.1.1 + 1.1.1-SNAPSHOT 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.1.1 + 1.1.1-SNAPSHOT at.gv.egiz STALExt - 1.1.1 + 1.1.1-SNAPSHOT at.gv.egiz STALXService - 1.1.1 + 1.1.1-SNAPSHOT at.gv.egiz smccSTAL - 1.1.1 + 1.1.1-SNAPSHOT at.gv.egiz BKUApplet - 1.1.1 + 1.1.1-SNAPSHOT -- cgit v1.2.3 From 64efe970e2b053b8d058f5230c5bf8e2fb4666d5 Mon Sep 17 00:00:00 2001 From: clemenso Date: Mon, 20 Apr 2009 15:57:58 +0000 Subject: [maven-release-plugin] prepare release mocca-1.1.1 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@346 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index 936b7d3a..757adca3 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -3,34 +3,34 @@ bku at.gv.egiz - 1.1.1-SNAPSHOT + 1.1.1 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.1.1-SNAPSHOT + 1.1.1 at.gv.egiz STALExt - 1.1.1-SNAPSHOT + 1.1.1 at.gv.egiz STALXService - 1.1.1-SNAPSHOT + 1.1.1 at.gv.egiz smccSTAL - 1.1.1-SNAPSHOT + 1.1.1 at.gv.egiz BKUApplet - 1.1.1-SNAPSHOT + 1.1.1 -- cgit v1.2.3 From bbd9833a9ae0cbbc350eb4db8a001849bb6637ac Mon Sep 17 00:00:00 2001 From: clemenso Date: Mon, 20 Apr 2009 16:00:46 +0000 Subject: [maven-release-plugin] rollback the release of mocca-1.1.1 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@347 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index 757adca3..936b7d3a 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -3,34 +3,34 @@ bku at.gv.egiz - 1.1.1 + 1.1.1-SNAPSHOT 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.1.1 + 1.1.1-SNAPSHOT at.gv.egiz STALExt - 1.1.1 + 1.1.1-SNAPSHOT at.gv.egiz STALXService - 1.1.1 + 1.1.1-SNAPSHOT at.gv.egiz smccSTAL - 1.1.1 + 1.1.1-SNAPSHOT at.gv.egiz BKUApplet - 1.1.1 + 1.1.1-SNAPSHOT -- cgit v1.2.3 From 420e23a4e9f105defc502e8ec351e1e313a6b225 Mon Sep 17 00:00:00 2001 From: clemenso Date: Mon, 20 Apr 2009 16:03:29 +0000 Subject: [maven-release-plugin] prepare release mocca-1.1.1 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@348 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index 936b7d3a..757adca3 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -3,34 +3,34 @@ bku at.gv.egiz - 1.1.1-SNAPSHOT + 1.1.1 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.1.1-SNAPSHOT + 1.1.1 at.gv.egiz STALExt - 1.1.1-SNAPSHOT + 1.1.1 at.gv.egiz STALXService - 1.1.1-SNAPSHOT + 1.1.1 at.gv.egiz smccSTAL - 1.1.1-SNAPSHOT + 1.1.1 at.gv.egiz BKUApplet - 1.1.1-SNAPSHOT + 1.1.1 -- cgit v1.2.3 From 0ee51852335b820c51b7270df31c116a0826f9c7 Mon Sep 17 00:00:00 2001 From: clemenso Date: Mon, 20 Apr 2009 16:03:48 +0000 Subject: [maven-release-plugin] prepare for next development iteration git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@350 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index 757adca3..fba8aa02 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -3,34 +3,34 @@ bku at.gv.egiz - 1.1.1 + 1.1.2-SNAPSHOT 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.1.1 + 1.1.2-SNAPSHOT at.gv.egiz STALExt - 1.1.1 + 1.1.2-SNAPSHOT at.gv.egiz STALXService - 1.1.1 + 1.1.2-SNAPSHOT at.gv.egiz smccSTAL - 1.1.1 + 1.1.2-SNAPSHOT at.gv.egiz BKUApplet - 1.1.1 + 1.1.2-SNAPSHOT -- cgit v1.2.3 From 2cf8668b84d70877ed274d06727ef6a7e00aa05f Mon Sep 17 00:00:00 2001 From: clemenso Date: Tue, 30 Jun 2009 15:39:33 +0000 Subject: unsupported card (pinmanagement) git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@378 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../src/main/java/at/gv/egiz/bku/gui/PINManagementGUIFacade.java | 1 + .../src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties | 1 + .../main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties | 1 + 3 files changed, 3 insertions(+) (limited to 'BKUAppletExt') 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 e8415dc3..f99bcfd1 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 @@ -66,6 +66,7 @@ public interface PINManagementGUIFacade extends BKUGUIFacade { 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 ERR_UNSUPPORTED_CARD = "err.unsupported.card"; public static final String BUTTON_ACTIVATE = "button.activate"; public static final String BUTTON_UNBLOCK = "button.unblock"; diff --git a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties index bdf077d4..977d6e3a 100644 --- a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties +++ b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties @@ -61,6 +61,7 @@ err.not.active={0} nicht aktiviert. err.pin.format=Ung\u00FCltige {0} L\u00E4nge, verlangt sind {1} Stellen. err.pin.confirmation={0} und Best\u00E4tigung stimmen nicht \u00FCberein. err.pin.operation.aborted=Der Vorgang f\u00FCr {0} wurde abgebrochen. +err.unsupported.card=Die Karte wird nicht unterst\u00FCtzt status.not.active=NICHT AKTIV status.active=AKTIV diff --git a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties index 037ae091..7f01971b 100644 --- a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties +++ b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties @@ -60,6 +60,7 @@ err.not.active={0} not activated. err.pin.format=Invalid {0} length, {1} digit(s) required. err.pin.confirmation={0} and confirmation do not match. err.pin.operation.aborted=The operation on {0} was aborted. +err.unsupported.card=This card is not supported status.not.active=NOT ACTIVE status.active=ACTIVE -- cgit v1.2.3 From 6cb4a071eab9a3b8cf78b8ec7e407aa148f2d038 Mon Sep 17 00:00:00 2001 From: mcentner Date: Wed, 1 Jul 2009 13:03:41 +0000 Subject: Major refactoring of SMCC git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@381 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../smccstal/ext/PINManagementRequestHandler.java | 306 ++++----------------- 1 file changed, 60 insertions(+), 246 deletions(-) (limited to 'BKUAppletExt') 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 72a7c4cc..e0b09d63 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 @@ -16,41 +16,32 @@ */ package at.gv.egiz.bku.smccstal.ext; +import java.util.HashMap; +import java.util.Map; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + 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.gui.PINManagementGUIFacade.STATUS; import at.gv.egiz.bku.smccstal.AbstractRequestHandler; -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.PINMgmtSignatureCard; import at.gv.egiz.smcc.PINOperationAbortedException; -import at.gv.egiz.smcc.PINProvider; import at.gv.egiz.smcc.PINSpec; -import at.gv.egiz.smcc.STARCOSCard; -import at.gv.egiz.smcc.SignatureCard; import at.gv.egiz.smcc.SignatureCardException; import at.gv.egiz.smcc.TimeoutException; -import at.gv.egiz.smcc.VerificationFailedException; -import at.gv.egiz.smcc.util.SMCCHelper; +import at.gv.egiz.smcc.PINMgmtSignatureCard.PIN_STATE; import at.gv.egiz.stal.ErrorResponse; import at.gv.egiz.stal.STALRequest; import at.gv.egiz.stal.STALResponse; import at.gv.egiz.stal.ext.PINManagementRequest; import at.gv.egiz.stal.ext.PINManagementResponse; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import javax.smartcardio.Card; -import javax.smartcardio.CardChannel; -import javax.smartcardio.CardException; -import javax.smartcardio.CommandAPDU; -import javax.smartcardio.ResponseAPDU; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; /** * @@ -60,23 +51,36 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { protected static final Log log = LogFactory.getLog(PINManagementRequestHandler.class); - protected Map pinStatuses; + protected Map pinStates = new HashMap(); @Override public STALResponse handleRequest(STALRequest request) throws InterruptedException { if (request instanceof PINManagementRequest) { - PINManagementGUIFacade gui = (PINManagementGUIFacade) this.gui; + PINManagementGUIFacade gui = (PINManagementGUIFacade) this.gui; + + PINSpec selectedPIN = null; - PINSpec selectedPIN = null; + try { - try { + if (card instanceof PINMgmtSignatureCard) { - pinStatuses = getPINStatuses(); - - gui.showPINManagementDialog(pinStatuses, - this, "activate_enterpin", "change_enterpin", "unblock_enterpuk", "verify_enterpin", - this, "cancel"); + // 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"); + + } else { + + // card does not support PIN management + gui.showErrorDialog(PINManagementGUIFacade.ERR_UNSUPPORTED_CARD, + null, this, "cancel"); + + } while (true) { @@ -97,9 +101,9 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { try { if ("activate_enterpin".equals(actionCommand)) { log.info("activate " + selectedPIN.getLocalizedName()); - card.activatePIN(selectedPIN, + ((PINMgmtSignatureCard) card).activatePIN(selectedPIN, ppfac.getActivatePINProvider()); - updatePINStatus(selectedPIN, STATUS.ACTIV); + updatePINState(selectedPIN, STATUS.ACTIV); gui.showMessageDialog(PINManagementGUIFacade.TITLE_ACTIVATE_SUCCESS, PINManagementGUIFacade.MESSAGE_ACTIVATE_SUCCESS, new Object[] {selectedPIN.getLocalizedName()}, @@ -107,9 +111,9 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { waitForAction(); } else if ("change_enterpin".equals(actionCommand)) { log.info("change " + selectedPIN.getLocalizedName()); - card.changePIN(selectedPIN, + ((PINMgmtSignatureCard) card).changePIN(selectedPIN, ppfac.getChangePINProvider()); - updatePINStatus(selectedPIN, STATUS.ACTIV); + updatePINState(selectedPIN, STATUS.ACTIV); gui.showMessageDialog(PINManagementGUIFacade.TITLE_CHANGE_SUCCESS, PINManagementGUIFacade.MESSAGE_CHANGE_SUCCESS, new Object[] {selectedPIN.getLocalizedName()}, @@ -118,13 +122,13 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { } else if ("unblock_enterpuk".equals(actionCommand)) { log.info("unblock " + selectedPIN.getLocalizedName()); - card.unblockPIN(selectedPIN, + ((PINMgmtSignatureCard) card).unblockPIN(selectedPIN, ppfac.getUnblockPINProvider()); } else if ("verify_enterpin".equals(actionCommand)) { log.info("verify " + selectedPIN.getLocalizedName()); - card.verifyPIN(selectedPIN, + ((PINMgmtSignatureCard) card).verifyPIN(selectedPIN, ppfac.getVerifyPINProvider()); - updatePINStatus(selectedPIN, STATUS.ACTIV); + updatePINState(selectedPIN, STATUS.ACTIV); } } catch (CancelledException ex) { log.trace("cancelled"); @@ -137,14 +141,14 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { waitForAction(); } catch (LockedException ex) { log.error(selectedPIN.getLocalizedName() + " locked"); - updatePINStatus(selectedPIN, STATUS.BLOCKED); + 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"); - updatePINStatus(selectedPIN, STATUS.NOT_ACTIV); + updatePINState(selectedPIN, STATUS.NOT_ACTIV); gui.showErrorDialog(PINManagementGUIFacade.ERR_NOT_ACTIVE, new Object[] {selectedPIN.getLocalizedName()}, this, null); @@ -176,7 +180,7 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { } // end if selectedPIN = null; - gui.showPINManagementDialog(pinStatuses, + gui.showPINManagementDialog(pinStates, this, "activate_enterpin", "change_enterpin", "unblock_enterpuk", "verify_enterpin", this, "cancel"); } // end while @@ -206,70 +210,6 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { return true; } - private Map getPINStatuses() throws GetPINStatusException { - HashMap pinStatuses = new HashMap(); - List pins = card.getPINSpecs(); - - if (card instanceof STARCOSCard) { - Card icc = card.getCard(); - try { - icc.beginExclusive(); - CardChannel channel = icc.getBasicChannel(); - - for (PINSpec pinSpec : pins) { - byte kid = pinSpec.getKID(); - byte[] contextAID = pinSpec.getContextAID(); - - if (contextAID != null) { - CommandAPDU selectAPDU = new CommandAPDU(0x00, 0xa4, 0x04, 0x0c, contextAID); - ResponseAPDU responseAPDU = channel.transmit(selectAPDU); - if (responseAPDU.getSW() != 0x9000) { - icc.endExclusive(); - String msg = "Select AID " + SMCCHelper.toString(pinSpec.getContextAID()) + - ": SW=" + Integer.toHexString(responseAPDU.getSW()); - log.error(msg); - throw new GetPINStatusException(msg); - } - } - - CommandAPDU verifyAPDU = new CommandAPDU(new byte[] { - (byte) 0x00, (byte) 0x20, (byte) 00, kid }); - ResponseAPDU responseAPDU = channel.transmit(verifyAPDU); - - STATUS status = STATUS.UNKNOWN; - if (responseAPDU.getSW() == 0x6984) { - status = STATUS.NOT_ACTIV; - } else if (responseAPDU.getSW() == 0x63c0) { - status = STATUS.BLOCKED; - } else if (responseAPDU.getSW1() == 0x63) { - status = STATUS.ACTIV; - } - if (log.isDebugEnabled()) { - log.debug("PIN " + pinSpec.getLocalizedName() + - " status: " + SMCCHelper.toString(responseAPDU.getBytes())); - } - pinStatuses.put(pinSpec, status); - } - return pinStatuses; - - } catch (CardException ex) { - log.error("Failed to get PIN status: " + ex.getMessage(), ex); - throw new GetPINStatusException(ex.getMessage()); - } finally { - try { - icc.endExclusive(); - } catch (CardException ex) { - log.trace("failed to end exclusive card access: " + ex.getMessage()); - } - } - } else { - for (PINSpec pinSpec : pins) { - pinStatuses.put(pinSpec, STATUS.UNKNOWN); - } - } - return pinStatuses; - } - /** * query status for STARCOS card, * assume provided status for ACOS card @@ -277,154 +217,28 @@ public class PINManagementRequestHandler extends AbstractRequestHandler { * @param status * @throws at.gv.egiz.smcc.SignatureCardException if query status fails */ - private void updatePINStatus(PINSpec pinSpec, STATUS status) throws GetPINStatusException { - if (card instanceof STARCOSCard) { - Card icc = card.getCard(); - try { - icc.beginExclusive(); - CardChannel channel = icc.getBasicChannel(); - - byte kid = pinSpec.getKID(); - byte[] contextAID = pinSpec.getContextAID(); - - if (contextAID != null) { - CommandAPDU selectAPDU = new CommandAPDU(0x00, 0xa4, 0x04, 0x0c, contextAID); - ResponseAPDU responseAPDU = channel.transmit(selectAPDU); - if (responseAPDU.getSW() != 0x9000) { - icc.endExclusive(); - String msg = "Select AID " + SMCCHelper.toString(pinSpec.getContextAID()) + - ": SW=" + Integer.toHexString(responseAPDU.getSW()); - log.error(msg); - throw new GetPINStatusException(msg); - } - } - - CommandAPDU verifyAPDU = new CommandAPDU(new byte[] { - (byte) 0x00, (byte) 0x20, (byte) 00, kid }); - ResponseAPDU responseAPDU = channel.transmit(verifyAPDU); - - status = STATUS.UNKNOWN; - if (responseAPDU.getSW() == 0x6984) { - status = STATUS.NOT_ACTIV; - } else if (responseAPDU.getSW() == 0x63c0) { - status = STATUS.BLOCKED; - } else if (responseAPDU.getSW1() == 0x63) { - status = STATUS.ACTIV; - } - if (log.isDebugEnabled()) { - log.debug(pinSpec.getLocalizedName() + - " status: " + SMCCHelper.toString(responseAPDU.getBytes())); - } - pinStatuses.put(pinSpec, status); - - } catch (CardException ex) { - log.error("Failed to get PIN status: " + ex.getMessage(), ex); - throw new GetPINStatusException(ex.getMessage()); - } finally { - try { - icc.endExclusive(); - } catch (CardException ex) { - log.warn("failed to end exclusive card access: " + ex.getMessage()); - } - } + 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 { - pinStatuses.put(pinSpec, status); + pinStates.put(pinSpec, status); } } -// /** -// * provides oldPin and newPin from one dialog, -// * and don't know whether providePIN() or provideOldPIN() is called first. -// */ -// class SoftwarePinProvider implements PINProvider { -// -// private PINManagementGUIFacade.DIALOG type; -// private boolean retry = false; -// -// private char[] newPin; -// private char[] oldPin; -// -// public SoftwarePinProvider(DIALOG type) { -// this.type = type; -// } -// -// @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 = -// (PINManagementGUIFacade) PINManagementRequestHandler.this.gui; -// -// if (retry) { -// gui.showPINDialog(type, spec, retries, -// PINManagementRequestHandler.this, "exec", -// PINManagementRequestHandler.this, "back"); -// } else { -// gui.showPINDialog(type, spec, -// PINManagementRequestHandler.this, "exec", -// PINManagementRequestHandler.this, "back"); -// } -// waitForAction(); -// -// if (actionCommand.equals("exec")) { -// gui.showWaitDialog(null); -// retry = true; -// oldPin = gui.getOldPin(); -// newPin = gui.getPin(); -// } else if (actionCommand.equals("back")) { -// throw new CancelledException(); -// } else { -// log.error("unsupported command " + actionCommand); -// throw new CancelledException(); -// } -// } -// } -// -// -// class PinpadPinProvider implements PINProvider { -// -// private PINManagementGUIFacade.DIALOG type; -// private boolean retry = false; -// -// public PinpadPinProvider(DIALOG type) { -// this.type = type; -// } -// -// @Override -// public char[] providePIN(PINSpec spec, int retries) { -// log.debug("provide pin for " + type); -// if (retry) { -// ((PINManagementGUIFacade) gui).showPinpadPINDialog(type, spec, retries); -// } else { -// ((PINManagementGUIFacade) gui).showPinpadPINDialog(type, spec, -1); -// retry = true; -// } -// return null; -// } -// -// @Override -// public char[] provideOldPIN(PINSpec spec, int retries) { -// return null; -// } -// } } -- cgit v1.2.3 From 8c4be63080981cc85e1c1584f046dfd6035968c0 Mon Sep 17 00:00:00 2001 From: clemenso Date: Wed, 1 Jul 2009 15:05:23 +0000 Subject: [maven-release-plugin] prepare release mocca-1.2.0 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@385 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index fba8aa02..7962392f 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -3,34 +3,34 @@ bku at.gv.egiz - 1.1.2-SNAPSHOT + 1.2.0 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.1.2-SNAPSHOT + 1.2.0 at.gv.egiz STALExt - 1.1.2-SNAPSHOT + 1.2.0 at.gv.egiz STALXService - 1.1.2-SNAPSHOT + 1.2.0 at.gv.egiz smccSTAL - 1.1.2-SNAPSHOT + 1.2.0 at.gv.egiz BKUApplet - 1.1.2-SNAPSHOT + 1.2.0 -- cgit v1.2.3 From d23cff9c8f01f7fff85c183fd3b482b173bb3108 Mon Sep 17 00:00:00 2001 From: clemenso Date: Wed, 1 Jul 2009 15:07:04 +0000 Subject: [maven-release-plugin] prepare for next development iteration git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@387 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index 7962392f..ce9d9968 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -3,34 +3,34 @@ bku at.gv.egiz - 1.2.0 + 1.2.1-SNAPSHOT 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.2.0 + 1.2.1-SNAPSHOT at.gv.egiz STALExt - 1.2.0 + 1.2.1-SNAPSHOT at.gv.egiz STALXService - 1.2.0 + 1.2.1-SNAPSHOT at.gv.egiz smccSTAL - 1.2.0 + 1.2.1-SNAPSHOT at.gv.egiz BKUApplet - 1.2.0 + 1.2.1-SNAPSHOT -- cgit v1.2.3 From 2429c7e98cb9e47e36dc5ff07fd10bd18cc999bc Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 13 Aug 2009 09:11:09 +0000 Subject: [#436] resolve "#PIN digits" message via message resource bundle git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@419 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../main/java/at/gv/egiz/bku/gui/PINManagementGUI.java | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java index d1ca6c00..9057b45b 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java @@ -259,11 +259,7 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac } else { params[0] = pinSpec.getLocalizedName(); } - String pinSize = String.valueOf(pinSpec.getMinLength()); - if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { - pinSize += "-" + pinSpec.getMaxLength(); - } - params[1] = pinSize; + params[1] = pinSpec.getLocalizedLength(); if (type == DIALOG.CHANGE) { log.debug("show change pin dialog"); title = TITLE_CHANGE_PIN; @@ -361,11 +357,6 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac mgmtLabel.setText(getMessage(TITLE)); } - String pinSize = String.valueOf(pinSpec.getMinLength()); - if (pinSpec.getMinLength() != pinSpec.getMaxLength()) { - pinSize += "-" + pinSpec.getMaxLength(); - } - //////////////////////////////////////////////////////////////// // COMMON LAYOUT SECTION //////////////////////////////////////////////////////////////// @@ -394,7 +385,7 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac pinpadLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() & ~Font.BOLD)); String pinpadPattern = getMessage(MESSAGE_VERIFYPIN_PINPAD); pinpadLabel.setText(MessageFormat.format(pinpadPattern, - new Object[] { pinSpec.getLocalizedName(), pinSize })); + new Object[] { pinSpec.getLocalizedName(), pinSpec.getLocalizedLength() })); pinHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(pinpadLabel); @@ -489,7 +480,7 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac JLabel pinsizeLabel = new JLabel(); pinsizeLabel.setFont(pinsizeLabel.getFont().deriveFont(pinsizeLabel.getFont().getStyle() & ~Font.BOLD, pinsizeLabel.getFont().getSize()-2)); String pinsizePattern = getMessage(LABEL_PINSIZE); - pinsizeLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{pinSize})); + pinsizeLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{pinSpec.getLocalizedLength()})); //////////////////////////////////////////////////////////////// // NON-PINPAD SPECIFIC LAYOUT SECTION -- cgit v1.2.3 From 02f1619c3ccb1032c32c83c7d74395a2aadf58ba Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 13 Aug 2009 09:11:46 +0000 Subject: pkcs#11 sign PINManagementApplet/ActivationApplet git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@420 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index ce9d9968..105dfae7 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -37,6 +37,7 @@ maven-jar-plugin + org.apache.maven.plugins @@ -94,4 +95,25 @@ + + + pkcs11-sign + + + + maven-jar-plugin + org.apache.maven.plugins + 2.2-mocca + + NONE + PKCS11 + iaik.pkcs.pkcs11.provider.IAIKPkcs11 + a-sit + + + + + + + \ No newline at end of file -- cgit v1.2.3 From d791931ac69b0a2a1201ef7cd2f7ca247e92ba8c Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 14 Aug 2009 10:46:26 +0000 Subject: [#436] resolve "#PIN digits" message via message resource bundle only for activation git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@431 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java index 9057b45b..3b77daa5 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java @@ -300,9 +300,13 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac @Override public void run() { - String HELP_TOPIC, TITLE, MESSAGE_MGMT, MESSAGE_MGMT_PARAM; + String HELP_TOPIC, TITLE, MESSAGE_MGMT, MESSAGE_MGMT_PARAM, PINSIZE; HELP_TOPIC = HELP_PINMGMT; + PINSIZE = (pinSpec.getMaxLength() > pinSpec.getMinLength()) ? + pinSpec.getMinLength() + "-" + pinSpec.getMaxLength() : + String.valueOf(pinSpec.getMinLength()); + if (retries < 0) { if (type == DIALOG.CHANGE) { log.debug("show change pin dialog"); @@ -313,6 +317,7 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac TITLE = TITLE_ACTIVATE_PIN; MESSAGE_MGMT = MESSAGE_ACTIVATE_PIN; oldPinField = null; + PINSIZE = pinSpec.getLocalizedLength(); } else if (type == DIALOG.VERIFY) { log.debug("show verify pin dialog"); TITLE = TITLE_VERIFY_PIN; @@ -385,7 +390,7 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac pinpadLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() & ~Font.BOLD)); String pinpadPattern = getMessage(MESSAGE_VERIFYPIN_PINPAD); pinpadLabel.setText(MessageFormat.format(pinpadPattern, - new Object[] { pinSpec.getLocalizedName(), pinSpec.getLocalizedLength() })); + new Object[] { pinSpec.getLocalizedName(), PINSIZE })); pinHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) .addComponent(pinpadLabel); @@ -480,7 +485,7 @@ public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFac JLabel pinsizeLabel = new JLabel(); pinsizeLabel.setFont(pinsizeLabel.getFont().deriveFont(pinsizeLabel.getFont().getStyle() & ~Font.BOLD, pinsizeLabel.getFont().getSize()-2)); String pinsizePattern = getMessage(LABEL_PINSIZE); - pinsizeLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{pinSpec.getLocalizedLength()})); + pinsizeLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{PINSIZE})); //////////////////////////////////////////////////////////////// // NON-PINPAD SPECIFIC LAYOUT SECTION -- cgit v1.2.3 From fa928f387d17cb9658dd6f488c619cfcceab9801 Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 14 Aug 2009 13:05:44 +0000 Subject: [maven-release-plugin] prepare release mocca-1.2.1 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@440 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index 105dfae7..a62f7034 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -1,36 +1,35 @@ - bku at.gv.egiz - 1.2.1-SNAPSHOT + 1.2.1 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.2.1-SNAPSHOT + 1.2.1 at.gv.egiz STALExt - 1.2.1-SNAPSHOT + 1.2.1 at.gv.egiz STALXService - 1.2.1-SNAPSHOT + 1.2.1 at.gv.egiz smccSTAL - 1.2.1-SNAPSHOT + 1.2.1 at.gv.egiz BKUApplet - 1.2.1-SNAPSHOT + 1.2.1 @@ -109,7 +108,7 @@ PKCS11 iaik.pkcs.pkcs11.provider.IAIKPkcs11 a-sit - + -- cgit v1.2.3 From a4e2fb04ca7e5e2bf2352c0881bb686cb83aaf74 Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 14 Aug 2009 13:06:05 +0000 Subject: [maven-release-plugin] prepare for next development iteration git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@442 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index a62f7034..79fc5600 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -2,34 +2,34 @@ bku at.gv.egiz - 1.2.1 + 1.2.2-SNAPSHOT 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.2.1 + 1.2.2-SNAPSHOT at.gv.egiz STALExt - 1.2.1 + 1.2.2-SNAPSHOT at.gv.egiz STALXService - 1.2.1 + 1.2.2-SNAPSHOT at.gv.egiz smccSTAL - 1.2.1 + 1.2.2-SNAPSHOT at.gv.egiz BKUApplet - 1.2.1 + 1.2.2-SNAPSHOT -- cgit v1.2.3 From 22001c93bca360d1b15c252cb22d2a4147ff350d Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 20 Aug 2009 16:24:55 +0000 Subject: [#430] Activation/PIN-management in MOCCA Web Start - new Modules: smccSTALExt, BKUGuiExt in order not to depend on BKUAppletExt in BKULocal - provide stal-request handler de-registration in abstractSMCCSTAL git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@448 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 10 + .../java/at/gv/egiz/bku/gui/ActivationGUI.java | 249 -------- .../at/gv/egiz/bku/gui/ActivationGUIFacade.java | 33 - .../main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java | 70 --- .../java/at/gv/egiz/bku/gui/PINManagementGUI.java | 669 --------------------- .../at/gv/egiz/bku/gui/PINManagementGUIFacade.java | 117 ---- .../java/at/gv/egiz/bku/gui/PINSpecRenderer.java | 39 -- .../java/at/gv/egiz/bku/gui/PINStatusRenderer.java | 61 -- .../at/gv/egiz/bku/gui/PINStatusTableModel.java | 58 -- .../egiz/bku/online/applet/ActivationApplet.java | 2 +- .../bku/online/applet/PINManagementBKUWorker.java | 16 +- .../bku/smccstal/ext/CardMgmtRequestHandler.java | 177 ------ .../bku/smccstal/ext/GetPINStatusException.java | 41 -- .../smccstal/ext/ManagementPINProviderFactory.java | 262 -------- .../smccstal/ext/PINManagementRequestHandler.java | 244 -------- .../gv/egiz/bku/gui/ActivationMessages.properties | 69 --- .../egiz/bku/gui/ActivationMessages_en.properties | 68 --- .../java/at/gv/egiz/bku/gui/ActivationGuiTest.java | 62 -- .../test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java | 202 ------- 19 files changed, 24 insertions(+), 2425 deletions(-) delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUI.java delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUIFacade.java delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUIFacade.java delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINSpecRenderer.java delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusTableModel.java delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/CardMgmtRequestHandler.java delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/GetPINStatusException.java delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/ManagementPINProviderFactory.java delete mode 100644 BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PINManagementRequestHandler.java delete mode 100644 BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties delete mode 100644 BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties delete mode 100644 BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/ActivationGuiTest.java delete mode 100644 BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index 79fc5600..98502ab2 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -31,6 +31,16 @@ BKUApplet 1.2.2-SNAPSHOT + + at.gv.egiz + BKUGuiExt + 1.2.2-SNAPSHOT + + + at.gv.egiz + smccSTALExt + 1.2.2-SNAPSHOT + diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUI.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUI.java deleted file mode 100644 index 8134ac5f..00000000 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUI.java +++ /dev/null @@ -1,249 +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.gui; - -import java.awt.Container; -import java.awt.Cursor; -import java.awt.event.ActionListener; -import java.net.URL; -import java.text.MessageFormat; -import java.util.Locale; -import java.util.ResourceBundle; -import javax.swing.GroupLayout; -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JProgressBar; -import javax.swing.LayoutStyle; -import javax.swing.SwingUtilities; - -/** - * - * @author Clemens Orthacker - */ -public class ActivationGUI extends CardMgmtGUI implements ActivationGUIFacade { - - public static final String TITLE_ACTIVATION = "title.activation"; - public static final String LABEL_ACTIVATION = "label.activation"; - public static final String LABEL_ACTIVATION_STEP = "label.activation.step"; - public static final String LABEL_ACTIVATION_IDLE = "label.activation.idle"; - - public static final String HELP_ACTIVATION = "help.activation"; - - protected JProgressBar progressBar; - - public ActivationGUI(Container contentPane, - Locale locale, - Style guiStyle, - URL backgroundImgURL, - AbstractHelpListener helpListener) { - super(contentPane, locale, guiStyle, backgroundImgURL, helpListener); - - progressBar = new JProgressBar(); - } - - @Override - public void showActivationProgressDialog(final int currentStep, final int maxProgress, final ActionListener cancelListener, final String cancelCommand) { - - log.debug("scheduling activation progress dialog (step " + currentStep + ")"); - - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - - log.debug("show activation progress dialog (step " + currentStep + ")"); - - mainPanel.removeAll(); - buttonPanel.removeAll(); - - mainPanel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - - - JLabel infoLabel = new JLabel(); - infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - - if (renderHeaderPanel) { - titleLabel.setText(cardmgmtMessages.getString(TITLE_ACTIVATION)); - infoLabel.setText(cardmgmtMessages.getString(LABEL_ACTIVATION)); - } else { - infoLabel.setText(cardmgmtMessages.getString(TITLE_ACTIVATION)); - } - - helpListener.setHelpTopic(HELP_ACTIVATION); - - progressBar.setIndeterminate(false); - progressBar.setStringPainted(true); - progressBar.setString(null); //reset to percentage - progressBar.setMinimum(0); - progressBar.setMaximum(maxProgress); - - JLabel stepLabel = new JLabel(); - stepLabel.setFont(stepLabel.getFont().deriveFont(stepLabel.getFont().getStyle() & ~java.awt.Font.BOLD, stepLabel.getFont().getSize()-2)); - String stepPattern = cardmgmtMessages.getString(LABEL_ACTIVATION_STEP); - stepLabel.setText(MessageFormat.format(stepPattern, new Object[]{ currentStep })); - - GroupLayout mainPanelLayout = new GroupLayout(mainPanel); - mainPanel.setLayout(mainPanelLayout); - - GroupLayout.SequentialGroup infoHorizontal = mainPanelLayout.createSequentialGroup().addComponent(infoLabel); - GroupLayout.ParallelGroup infoVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(infoLabel); - - if (!renderHeaderPanel) { - infoHorizontal.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE).addComponent(helpLabel); - infoVertical.addComponent(helpLabel); - } - - mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addGroup(infoHorizontal) - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(stepLabel) - .addComponent(progressBar))); - - mainPanelLayout.setVerticalGroup( - mainPanelLayout.createSequentialGroup() - .addGroup(infoVertical) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addGroup(mainPanelLayout.createSequentialGroup() - .addComponent(stepLabel) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(progressBar))); - - JButton cancelButton = new JButton(); - cancelButton.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD)); - cancelButton.setText(messages.getString(BUTTON_CANCEL)); - cancelButton.addActionListener(cancelListener); - cancelButton.setActionCommand(cancelCommand); - - GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); - buttonPanel.setLayout(buttonPanelLayout); - - buttonPanelLayout.setHorizontalGroup( - buttonPanelLayout.createSequentialGroup() - .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); - buttonPanelLayout.setVerticalGroup( - buttonPanelLayout.createSequentialGroup() - .addComponent(cancelButton)); - - contentPanel.validate(); - - } - }); - - } - - @Override - public void incrementProgress() { - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - progressBar.setValue(progressBar.getValue() + 1); - } - }); - - } - - @Override - public void showIdleDialog(final ActionListener cancelListener, final String cancelCommand) { - log.debug("scheduling idle dialog"); - - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - - log.debug("show idle dialog"); - - mainPanel.removeAll(); - buttonPanel.removeAll(); - - mainPanel.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - - - JLabel infoLabel = new JLabel(); - infoLabel.setFont(infoLabel.getFont().deriveFont(infoLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - - if (renderHeaderPanel) { - titleLabel.setText(cardmgmtMessages.getString(TITLE_ACTIVATION)); - infoLabel.setText(cardmgmtMessages.getString(LABEL_ACTIVATION)); - } else { - infoLabel.setText(cardmgmtMessages.getString(TITLE_ACTIVATION)); - } - - helpListener.setHelpTopic(HELP_ACTIVATION); - - progressBar.setIndeterminate(true); - progressBar.setStringPainted(true); - progressBar.setString(""); //not string painted progressbar is smaller - - JLabel stepLabel = new JLabel(); - stepLabel.setFont(stepLabel.getFont().deriveFont(stepLabel.getFont().getStyle() & ~java.awt.Font.BOLD, stepLabel.getFont().getSize()-2)); - stepLabel.setText(cardmgmtMessages.getString(LABEL_ACTIVATION_IDLE)); - - GroupLayout mainPanelLayout = new GroupLayout(mainPanel); - mainPanel.setLayout(mainPanelLayout); - - GroupLayout.SequentialGroup infoHorizontal = mainPanelLayout.createSequentialGroup().addComponent(infoLabel); - GroupLayout.ParallelGroup infoVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(infoLabel); - - if (!renderHeaderPanel) { - infoHorizontal.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE).addComponent(helpLabel); - infoVertical.addComponent(helpLabel); - } - - mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addGroup(infoHorizontal) - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(stepLabel) - .addComponent(progressBar))); - - mainPanelLayout.setVerticalGroup( - mainPanelLayout.createSequentialGroup() - .addGroup(infoVertical) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addGroup(mainPanelLayout.createSequentialGroup() - .addComponent(stepLabel) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(progressBar))); - - JButton cancelButton = new JButton(); - cancelButton.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD)); - cancelButton.setText(messages.getString(BUTTON_CANCEL)); - cancelButton.addActionListener(cancelListener); - cancelButton.setActionCommand(cancelCommand); - - GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); - buttonPanel.setLayout(buttonPanelLayout); - - buttonPanelLayout.setHorizontalGroup( - buttonPanelLayout.createSequentialGroup() - .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE)); - buttonPanelLayout.setVerticalGroup( - buttonPanelLayout.createSequentialGroup() - .addComponent(cancelButton)); - - contentPanel.validate(); - - } - }); - - } -} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUIFacade.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUIFacade.java deleted file mode 100644 index 860a1097..00000000 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/ActivationGUIFacade.java +++ /dev/null @@ -1,33 +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.gui; - -import java.awt.event.ActionListener; - -/** - * - * @author Clemens Orthacker - */ -public interface ActivationGUIFacade extends BKUGUIFacade { - - public void showActivationProgressDialog(int currentStep, int maxProgress, ActionListener cancelListener, String cancelCommand); - - public void incrementProgress(); - - public void showIdleDialog(ActionListener cancelListener, String cancelCommand); - -} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java deleted file mode 100644 index ac9ab78b..00000000 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/CardMgmtGUI.java +++ /dev/null @@ -1,70 +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.gui; - -import java.awt.Container; -import java.net.URL; -import java.util.Locale; -import java.util.ResourceBundle; - -/** - * Common superclass for Activation and PinManagement GUIs - * - * @author Clemens Orthacker - */ -public class CardMgmtGUI extends BKUGUIImpl { - - public static final String CARDMGMT_MESSAGES_BUNDLE = "at/gv/egiz/bku/gui/ActivationMessages"; - - protected ResourceBundle cardmgmtMessages; - - public CardMgmtGUI(Container contentPane, - Locale locale, - Style guiStyle, - URL backgroundImgURL, - AbstractHelpListener helpListener) { - super(contentPane, locale, guiStyle, backgroundImgURL, helpListener); - - } - - @Override - protected void loadMessageBundle(Locale locale) { - super.loadMessageBundle(locale); - - if (locale != null) { - Locale lang = new Locale(locale.getLanguage().substring(0,2)); - log.debug("loading applet resources for language: " + lang.toString()); - cardmgmtMessages = ResourceBundle.getBundle(CARDMGMT_MESSAGES_BUNDLE, lang); - } else { - cardmgmtMessages = ResourceBundle.getBundle(CARDMGMT_MESSAGES_BUNDLE); - } - } - - @Override - protected String getMessage(String key) { - if (super.hasMessage(key)) { - return super.getMessage(key); - } - return cardmgmtMessages.getString(key); - } - - @Override - protected boolean hasMessage(String key) { - return (cardmgmtMessages.containsKey(key) || super.hasMessage(key)); - } -} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java deleted file mode 100644 index 3b77daa5..00000000 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUI.java +++ /dev/null @@ -1,669 +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.gui; - -import at.gv.egiz.smcc.PINSpec; -import java.awt.Container; -import java.awt.Cursor; -import java.awt.Font; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseEvent; -import java.awt.event.MouseMotionAdapter; -import java.net.URL; -import java.text.MessageFormat; -import java.util.Locale; -import java.util.Map; -import javax.swing.GroupLayout; -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JPasswordField; -import javax.swing.JScrollPane; -import javax.swing.JTable; -import javax.swing.LayoutStyle; -import javax.swing.ListSelectionModel; -import javax.swing.SwingUtilities; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * TODO pull out ResourceBundle to common superclass for activationGUI and pinMgmtGUI - * @author Clemens Orthacker - */ -public class PINManagementGUI extends CardMgmtGUI implements PINManagementGUIFacade { - - protected static final Log log = LogFactory.getLog(PINManagementGUI.class); - - /** remember the pinfield to return to worker */ - protected JPasswordField oldPinField; - /** remember the pinSpec to return to worker */ - protected PINSpec pinSpec; - - public PINManagementGUI(Container contentPane, - Locale locale, - Style guiStyle, - URL backgroundImgURL, - AbstractHelpListener helpListener) { - super(contentPane, locale, guiStyle, backgroundImgURL, helpListener); - } - - @Override - public char[] getOldPin() { - if (oldPinField != null) { - char[] pin = oldPinField.getPassword(); - oldPinField = null; - return pin; - } - return null; - } - - @Override - public PINSpec getSelectedPINSpec() { - return pinSpec; - } - - @Override - public void showPINManagementDialog(final Map pins, - final ActionListener activateListener, - final String activateCmd, - final String changeCmd, - final String unblockCmd, - final String verifyCmd, - final ActionListener cancelListener, - final String cancelCmd) { - - log.debug("scheduling PIN managment dialog"); - - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - log.debug("show PIN management dialog"); - - mainPanel.removeAll(); - buttonPanel.removeAll(); - - helpListener.setHelpTopic(HELP_PINMGMT); - - JLabel mgmtLabel = new JLabel(); - mgmtLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - - if (renderHeaderPanel) { - titleLabel.setText(getMessage(TITLE_PINMGMT)); - String infoPattern = getMessage(MESSAGE_PINMGMT); - mgmtLabel.setText(MessageFormat.format(infoPattern, pins.size())); - } else { - mgmtLabel.setText(getMessage(TITLE_PINMGMT)); - } - - final PINStatusTableModel tableModel = new PINStatusTableModel(pins); - final JTable pinStatusTable = new JTable(tableModel); - pinStatusTable.setDefaultRenderer(PINSpec.class, new PINSpecRenderer()); - pinStatusTable.setDefaultRenderer(STATUS.class, new PINStatusRenderer(cardmgmtMessages)); - pinStatusTable.setTableHeader(null); - pinStatusTable.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); -// pinStatusTable.addMouseMotionListener(new MouseMotionAdapter() { -// -// @Override -// public void mouseMoved(MouseEvent e) { -// if (pinStatusTable.columnAtPoint(e.getPoint()) == 0) { -// pinStatusTable.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); -// } else { -// pinStatusTable.setCursor(Cursor.getDefaultCursor()); -// } -// } -// }); - - final JButton activateButton = new JButton(); - activateButton.setFont(activateButton.getFont().deriveFont(activateButton.getFont().getStyle() & ~java.awt.Font.BOLD)); - activateButton.addActionListener(activateListener); - - pinStatusTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - pinStatusTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { - - @Override - public void valueChanged(final ListSelectionEvent e) { - //invoke later to allow thread to paint selection background - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - ListSelectionModel lsm = (ListSelectionModel) e.getSource(); - int selectionIdx = lsm.getMinSelectionIndex(); - if (selectionIdx >= 0) { - pinSpec = (PINSpec) tableModel.getValueAt(selectionIdx, 0); - STATUS status = (STATUS) tableModel.getValueAt(selectionIdx, 1); - - if (status == STATUS.NOT_ACTIV) { - activateButton.setText(getMessage(BUTTON_ACTIVATE)); - activateButton.setEnabled(true); - activateButton.setActionCommand(activateCmd); - } else if (status == STATUS.BLOCKED) { - activateButton.setText(getMessage(BUTTON_UNBLOCK)); - activateButton.setEnabled(true); - activateButton.setActionCommand(unblockCmd); - } else if (status == STATUS.ACTIV) { - activateButton.setText(getMessage(BUTTON_CHANGE)); - activateButton.setEnabled(true); - activateButton.setActionCommand(changeCmd); - } else if (status == STATUS.UNKNOWN) { - activateButton.setText(getMessage(BUTTON_VERIFY)); - activateButton.setEnabled(true); - activateButton.setActionCommand(verifyCmd); - } - } - } - }); - } - }); - - //select first entry - pinStatusTable.getSelectionModel().setSelectionInterval(0, 0); - - JScrollPane pinStatusScrollPane = new JScrollPane(pinStatusTable); - - GroupLayout mainPanelLayout = new GroupLayout(mainPanel); - mainPanel.setLayout(mainPanelLayout); - - GroupLayout.SequentialGroup messageHorizontal = mainPanelLayout.createSequentialGroup() - .addComponent(mgmtLabel); - GroupLayout.Group messageVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(mgmtLabel); - if (!renderHeaderPanel) { - messageHorizontal - .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) - .addComponent(helpLabel); - messageVertical - .addComponent(helpLabel); - } - - mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addGroup(messageHorizontal) - .addComponent(pinStatusScrollPane, 0, 0, Short.MAX_VALUE)); - - mainPanelLayout.setVerticalGroup( - mainPanelLayout.createSequentialGroup() - .addGroup(messageVertical) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pinStatusScrollPane, 0, 0, pinStatusTable.getPreferredSize().height+3)); - - JButton cancelButton = new JButton(); - cancelButton.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD)); - cancelButton.setText(getMessage(BUTTON_CLOSE)); - cancelButton.setActionCommand(cancelCmd); - cancelButton.addActionListener(cancelListener); - - GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); - buttonPanel.setLayout(buttonPanelLayout); - - GroupLayout.SequentialGroup buttonHorizontal = buttonPanelLayout.createSequentialGroup() - .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(activateButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE); - - GroupLayout.Group buttonVertical = buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(activateButton) - .addComponent(cancelButton); - - buttonPanelLayout.setHorizontalGroup(buttonHorizontal); - buttonPanelLayout.setVerticalGroup(buttonVertical); - - contentPanel.validate(); - } - }); - } - - @Override - public void showPINDialog(DIALOG type, PINSpec pinSpec, - ActionListener okListener, String okCommand, - ActionListener cancelListener, String cancelCommand) { - showPINDialog(type, pinSpec, -1, false, - okListener, okCommand, cancelListener, cancelCommand); - } - - @Override - public void showPINDialog(DIALOG type, PINSpec pinSpec, int retries, - ActionListener okListener, String okCommand, - ActionListener cancelListener, String cancelCommand) { - showPINDialog(type, pinSpec, retries, false, - okListener, okCommand, cancelListener, cancelCommand); - } - - @Override - public void showPinpadPINDialog(DIALOG type, PINSpec pinSpec, int retries) { - String title, msg; - Object[] params; - if (retries < 0) { - params = new Object[2]; - if (shortText) { - params[0] = "PIN"; - } else { - params[0] = pinSpec.getLocalizedName(); - } - params[1] = pinSpec.getLocalizedLength(); - if (type == DIALOG.CHANGE) { - log.debug("show change pin dialog"); - title = TITLE_CHANGE_PIN; - msg = MESSAGE_CHANGEPIN_PINPAD; - } else if (type == DIALOG.ACTIVATE) { - log.debug("show activate pin dialog"); - title = TITLE_ACTIVATE_PIN; - msg = MESSAGE_ENTERPIN_PINPAD; - } else if (type == DIALOG.VERIFY) { - log.debug("show verify pin dialog"); - title = TITLE_VERIFY_PIN; - msg = MESSAGE_ENTERPIN_PINPAD; - } else { - log.debug("show unblock pin dialog"); - title = TITLE_UNBLOCK_PIN; - msg = MESSAGE_ENTERPIN_PINPAD; - } - - } else { - log.debug("show retry pin dialog"); - title = TITLE_RETRY; - msg = (retries < 2) ? - MESSAGE_LAST_RETRY : MESSAGE_RETRIES; - params = new Object[] {String.valueOf(retries)}; - } - showMessageDialog(title, msg, params); - } - - private void showPINDialog(final DIALOG type, final PINSpec pinSpec, - final int retries, final boolean pinpad, - final ActionListener okListener, final String okCommand, - final ActionListener cancelListener, final String cancelCommand) { - - log.debug("scheduling pin dialog"); - - SwingUtilities.invokeLater(new Runnable() { - - @Override - public void run() { - - String HELP_TOPIC, TITLE, MESSAGE_MGMT, MESSAGE_MGMT_PARAM, PINSIZE; - HELP_TOPIC = HELP_PINMGMT; - - PINSIZE = (pinSpec.getMaxLength() > pinSpec.getMinLength()) ? - pinSpec.getMinLength() + "-" + pinSpec.getMaxLength() : - String.valueOf(pinSpec.getMinLength()); - - if (retries < 0) { - if (type == DIALOG.CHANGE) { - log.debug("show change pin dialog"); - TITLE = TITLE_CHANGE_PIN; - MESSAGE_MGMT = MESSAGE_CHANGE_PIN; - } else if (type == DIALOG.ACTIVATE) { - log.debug("show activate pin dialog"); - TITLE = TITLE_ACTIVATE_PIN; - MESSAGE_MGMT = MESSAGE_ACTIVATE_PIN; - oldPinField = null; - PINSIZE = pinSpec.getLocalizedLength(); - } else if (type == DIALOG.VERIFY) { - log.debug("show verify pin dialog"); - TITLE = TITLE_VERIFY_PIN; - MESSAGE_MGMT = MESSAGE_VERIFY_PIN; - } else { - log.debug("show unblock pin dialog"); - TITLE = TITLE_UNBLOCK_PIN; - MESSAGE_MGMT = MESSAGE_UNBLOCK_PIN; - } - if (shortText) { - MESSAGE_MGMT_PARAM = "PIN"; - } else { - MESSAGE_MGMT_PARAM = pinSpec.getLocalizedName(); - } - } else { - log.debug("show retry pin dialog"); - TITLE = TITLE_RETRY; - MESSAGE_MGMT = (retries < 2) ? - MESSAGE_LAST_RETRY : MESSAGE_RETRIES; - MESSAGE_MGMT_PARAM = String.valueOf(retries); - } - - mainPanel.removeAll(); - buttonPanel.removeAll(); - - helpListener.setHelpTopic(HELP_TOPIC); - - JLabel mgmtLabel = new JLabel(); - if (retries < 0) { - mgmtLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() & ~Font.BOLD)); - } else { - mgmtLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() | Font.BOLD)); - mgmtLabel.setForeground(ERROR_COLOR); - helpListener.setHelpTopic(HELP_RETRY); - } - - if (renderHeaderPanel) { - titleLabel.setText(getMessage(TITLE)); - String mgmtPattern = getMessage(MESSAGE_MGMT); - mgmtLabel.setText(MessageFormat.format(mgmtPattern, MESSAGE_MGMT_PARAM)); - } else { - mgmtLabel.setText(getMessage(TITLE)); - } - - //////////////////////////////////////////////////////////////// - // COMMON LAYOUT SECTION - //////////////////////////////////////////////////////////////// - - GroupLayout mainPanelLayout = new GroupLayout(mainPanel); - mainPanel.setLayout(mainPanelLayout); - - GroupLayout.SequentialGroup infoHorizontal = mainPanelLayout.createSequentialGroup() - .addComponent(mgmtLabel); - GroupLayout.ParallelGroup infoVertical = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(mgmtLabel); - - if (!renderHeaderPanel) { - infoHorizontal - .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) - .addComponent(helpLabel); - infoVertical - .addComponent(helpLabel); - } - - GroupLayout.ParallelGroup pinHorizontal; - GroupLayout.SequentialGroup pinVertical; - - if (pinpad) { - JLabel pinpadLabel = new JLabel(); - pinpadLabel.setFont(mgmtLabel.getFont().deriveFont(mgmtLabel.getFont().getStyle() & ~Font.BOLD)); - String pinpadPattern = getMessage(MESSAGE_VERIFYPIN_PINPAD); - pinpadLabel.setText(MessageFormat.format(pinpadPattern, - new Object[] { pinSpec.getLocalizedName(), PINSIZE })); - - pinHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(pinpadLabel); - pinVertical = mainPanelLayout.createSequentialGroup() - .addComponent(pinpadLabel); - } else { - - JButton okButton = new JButton(); - okButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle() & ~Font.BOLD)); - okButton.setText(getMessage(BUTTON_OK)); - okButton.setEnabled(pinSpec.getMinLength() <= 0); - okButton.setActionCommand(okCommand); - okButton.addActionListener(okListener); - - JLabel oldPinLabel = null; - JLabel repeatPinLabel = null; - JLabel pinLabel = new JLabel(); - pinLabel.setFont(pinLabel.getFont().deriveFont(pinLabel.getFont().getStyle() & ~Font.BOLD)); - String pinLabelPattern = (type == DIALOG.CHANGE) ? getMessage(LABEL_NEW_PIN) : getMessage(LABEL_PIN); - pinLabel.setText(MessageFormat.format(pinLabelPattern, new Object[]{pinSpec.getLocalizedName()})); - - final JPasswordField repeatPinField = new JPasswordField(); - pinField = new JPasswordField(); - pinField.setText(""); - pinField.setActionCommand(okCommand); - pinField.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - if (pinField.getPassword().length >= pinSpec.getMinLength()) { - if (type == DIALOG.VERIFY) { - okListener.actionPerformed(e); - } else { - repeatPinField.requestFocusInWindow(); - } - } - } - }); - - if (type != DIALOG.VERIFY) { - pinField.setDocument(new PINDocument(pinSpec, null)); - repeatPinLabel = new JLabel(); - repeatPinLabel.setFont(pinLabel.getFont()); - String repeatPinLabelPattern = getMessage(LABEL_REPEAT_PIN); - repeatPinLabel.setText(MessageFormat.format(repeatPinLabelPattern, new Object[]{pinSpec.getLocalizedName()})); - - repeatPinField.setText(""); -// repeatPinField.setDocument(new PINDocument(pinSpec, okButton, pinField.getDocument())); - repeatPinField.setActionCommand(okCommand); - repeatPinField.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - if (pinField.getPassword().length >= pinSpec.getMinLength()) { - okListener.actionPerformed(e); - } - } - }); - - if (type == DIALOG.CHANGE) { - oldPinLabel = new JLabel(); - oldPinLabel.setFont(oldPinLabel.getFont().deriveFont(oldPinLabel.getFont().getStyle() & ~java.awt.Font.BOLD)); - String oldPinLabelPattern = getMessage(LABEL_OLD_PIN); - oldPinLabel.setText(MessageFormat.format(oldPinLabelPattern, new Object[]{pinSpec.getLocalizedName()})); - - oldPinField = new JPasswordField(); - oldPinField.setText(""); - oldPinField.setDocument(new PINDocument(pinSpec, null)); - oldPinField.setActionCommand(okCommand); - oldPinField.addActionListener(new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - if (oldPinField.getPassword().length >= pinSpec.getMinLength()) { - pinField.requestFocusInWindow(); - } - } - }); - - repeatPinField.setDocument(new PINDocument( - pinSpec, okButton, - pinField.getDocument(), oldPinField.getDocument())); - } else { - // else -> ACTIVATE (not verify, not change) - repeatPinField.setDocument(new PINDocument( - pinSpec, okButton, pinField.getDocument())); - } - } else { - pinField.setDocument(new PINDocument(pinSpec, okButton)); - } - - JLabel pinsizeLabel = new JLabel(); - pinsizeLabel.setFont(pinsizeLabel.getFont().deriveFont(pinsizeLabel.getFont().getStyle() & ~Font.BOLD, pinsizeLabel.getFont().getSize()-2)); - String pinsizePattern = getMessage(LABEL_PINSIZE); - pinsizeLabel.setText(MessageFormat.format(pinsizePattern, new Object[]{PINSIZE})); - - //////////////////////////////////////////////////////////////// - // NON-PINPAD SPECIFIC LAYOUT SECTION - //////////////////////////////////////////////////////////////// - - pinHorizontal = mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING); - pinVertical = mainPanelLayout.createSequentialGroup(); - -// if (pinLabelPos == PinLabelPosition.ABOVE) { -// if (changePin) { -// pinHorizontal -// .addComponent(oldPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) -// .addComponent(oldPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE); -// pinVertical -// .addComponent(oldPinLabel) -// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) -// .addComponent(oldPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) -// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); -// } -// pinHorizontal -// .addComponent(pinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) -// .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) -// .addComponent(repeatPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) -// .addComponent(repeatPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) -// .addGroup(mainPanelLayout.createSequentialGroup() -// .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) -// .addComponent(pinsizeLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)); -// pinVertical -// .addComponent(pinLabel) -// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) -// .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) -// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) -// .addComponent(repeatPinLabel) -// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) -// .addComponent(repeatPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) -// .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) -// .addComponent(pinsizeLabel); -// } else { - - - if (type == DIALOG.CHANGE) { - pinHorizontal - .addGroup(mainPanelLayout.createSequentialGroup() - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(oldPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addComponent(pinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addComponent(repeatPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(oldPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(repeatPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); - - pinVertical - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(oldPinLabel) - .addComponent(oldPinField)) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(pinLabel) - .addComponent(pinField)) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(repeatPinLabel) - .addComponent(repeatPinField)) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); - } else if (type == DIALOG.ACTIVATE) { - pinHorizontal - .addGroup(mainPanelLayout.createSequentialGroup() - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(pinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addComponent(repeatPinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(repeatPinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))); - - pinVertical - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(pinLabel) - .addComponent(pinField)) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(repeatPinLabel) - .addComponent(repeatPinField)) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); - } else { // VERIFY - pinHorizontal - .addGroup(mainPanelLayout.createSequentialGroup() - .addComponent(pinLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pinField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)); - - pinVertical - .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(pinLabel) - .addComponent(pinField)) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED); - } - pinHorizontal - .addGroup(mainPanelLayout.createSequentialGroup() - .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED, 0, Short.MAX_VALUE) - .addComponent(pinsizeLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)); - pinVertical - .addComponent(pinsizeLabel); - - GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel); - buttonPanel.setLayout(buttonPanelLayout); - - GroupLayout.SequentialGroup buttonHorizontal = buttonPanelLayout.createSequentialGroup() - .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(okButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE); - GroupLayout.Group buttonVertical; - - JButton cancelButton = new JButton(); - cancelButton.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle() & ~java.awt.Font.BOLD)); - cancelButton.setText(getMessage(BUTTON_CANCEL)); - cancelButton.setActionCommand(cancelCommand); - cancelButton.addActionListener(cancelListener); - - buttonHorizontal - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE); - buttonVertical = buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) - .addComponent(okButton) - .addComponent(cancelButton); - - buttonPanelLayout.setHorizontalGroup(buttonHorizontal); - buttonPanelLayout.setVerticalGroup(buttonVertical); - - if (oldPinField != null) { - oldPinField.requestFocusInWindow(); - } else { - pinField.requestFocusInWindow(); - } - - } // END NON-PINPAD SECTION - - mainPanelLayout.setHorizontalGroup( - mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING) - .addGroup(infoHorizontal) - .addGroup(pinHorizontal)); - - mainPanelLayout.setVerticalGroup( - mainPanelLayout.createSequentialGroup() - .addGroup(infoVertical) - .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) - .addGroup(pinVertical)); - - contentPanel.validate(); - - } - }); - } - - @Override - protected int initButtonSize() { - int bs = super.initButtonSize(); - - JButton b = new JButton(); - b.setText(getMessage(BUTTON_ACTIVATE)); - if (b.getPreferredSize().width > bs) { - bs = b.getPreferredSize().width; - } - b.setText(getMessage(BUTTON_CHANGE)); - if (b.getPreferredSize().width > bs) { - bs = b.getPreferredSize().width; - } - b.setText(getMessage(BUTTON_UNBLOCK)); - if (b.getPreferredSize().width > bs) { - bs = b.getPreferredSize().width; - } - b.setText(getMessage(BUTTON_CANCEL)); - if (b.getPreferredSize().width > bs) { - bs = b.getPreferredSize().width; - } - - return bs; - } - -} 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 deleted file mode 100644 index f99bcfd1..00000000 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINManagementGUIFacade.java +++ /dev/null @@ -1,117 +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.gui; - -import at.gv.egiz.smcc.PINSpec; -import java.awt.event.ActionListener; -import java.util.Map; - -/** - * - * @author Clemens Orthacker - */ -public interface PINManagementGUIFacade extends BKUGUIFacade { - - public static final String HELP_PINMGMT = "help.pin.mgmt"; -// public static final String HELP_VERIFY_PIN = "help.pin.verify"; - public static final String TITLE_PINMGMT = "title.pin.mgmt"; - public static final String TITLE_ACTIVATE_PIN = "title.activate.pin"; - public static final String TITLE_CHANGE_PIN = "title.change.pin"; - public static final String TITLE_VERIFY_PIN = "title.verify.pin"; - public static final String TITLE_UNBLOCK_PIN = "title.unblock.pin"; - public static final String TITLE_ACTIVATE_SUCCESS = "title.activate.success"; - public static final String TITLE_CHANGE_SUCCESS = "title.change.success"; - - // removed message.* prefix to reuse keys as help keys - public static final String MESSAGE_ACTIVATE_SUCCESS = "activate.success"; - public static final String MESSAGE_CHANGE_SUCCESS = "change.success"; - public static final String MESSAGE_PINMGMT = "pin.mgmt"; -// public static final String MESSAGE_PINPAD = "pinpad"; - public static final String MESSAGE_ACTIVATE_PIN = "activate.pin"; - public static final String MESSAGE_CHANGE_PIN = "change.pin"; - public static final String MESSAGE_VERIFY_PIN = "verify.pin"; - public static final String MESSAGE_UNBLOCK_PIN = "unblock.pin"; - public static final String MESSAGE_ACTIVATEPIN_PINPAD = "activate.pinpad"; - public static final String MESSAGE_CHANGEPIN_PINPAD = "change.pinpad"; - public static final String MESSAGE_VERIFYPIN_PINPAD = "verify.pinpad"; - public static final String MESSAGE_UNBLOCKPIN_PINPAD = "unblock.pinpad"; - - public static final String LABEL_OLD_PIN = "label.old.pin"; - public static final String LABEL_NEW_PIN = "label.new.pin"; - public static final String LABEL_REPEAT_PIN = "label.repeat.pin"; - - public static final String ERR_STATUS = "err.status"; - public static final String ERR_ACTIVATE = "err.activate"; - public static final String ERR_CHANGE = "err.change"; - public static final String ERR_UNBLOCK = "err.unblock"; - public static final String ERR_VERIFY = "err.verify"; - 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 ERR_UNSUPPORTED_CARD = "err.unsupported.card"; - - public static final String BUTTON_ACTIVATE = "button.activate"; - public static final String BUTTON_UNBLOCK = "button.unblock"; - public static final String BUTTON_CHANGE = "button.change"; - public static final String BUTTON_VERIFY = "button.verify"; - - public static final String STATUS_ACTIVE = "status.active"; - public static final String STATUS_BLOCKED = "status.blocked"; - public static final String STATUS_NOT_ACTIVE = "status.not.active"; - public static final String STATUS_UNKNOWN = "status.unknown"; - - public enum STATUS { ACTIV, NOT_ACTIV, BLOCKED, UNKNOWN }; - public enum DIALOG { VERIFY, ACTIVATE, CHANGE, UNBLOCK }; - - public void showPINManagementDialog(Map pins, - ActionListener activateListener, String activateCmd, String changeCmd, String unblockCmd, String verifyCmd, - ActionListener cancelListener, String cancelCmd); - - public void showPINDialog(DIALOG type, PINSpec pin, - ActionListener okListener, String okCmd, - ActionListener cancelListener, String cancelCmd); - - public void showPINDialog(DIALOG type, PINSpec pin, int retries, - ActionListener okListener, String okCmd, - ActionListener cancelListener, String cancelCmd); - - public void showPinpadPINDialog(DIALOG type, PINSpec pin, int retries); - -// public void showActivatePINDialog(PINSpec pin, -// ActionListener okListener, String okCmd, -// ActionListener cancelListener, String cancelCmd); -// -// public void showChangePINDialog(PINSpec pin, -// ActionListener okListener, String okCmd, -// ActionListener cancelListener, String cancelCmd); -// -// public void showUnblockPINDialog(PINSpec pin, -// ActionListener okListener, String okCmd, -// ActionListener cancelListener, String cancelCmd); -// -// public void showVerifyPINDialog(PINSpec pin, -// ActionListener okListener, String okCmd, -// ActionListener cancelListener, String cancelCmd); - - public char[] getOldPin(); - - public PINSpec getSelectedPINSpec(); -} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINSpecRenderer.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINSpecRenderer.java deleted file mode 100644 index e3d73e1f..00000000 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINSpecRenderer.java +++ /dev/null @@ -1,39 +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.gui; - -import at.gv.egiz.smcc.PINSpec; -import javax.swing.table.DefaultTableCellRenderer; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -/** - * - * @author Clemens Orthacker - */ -public class PINSpecRenderer extends DefaultTableCellRenderer { - - private static final Log log = LogFactory.getLog(PINSpecRenderer.class); - - @Override - protected void setValue(Object value) { - PINSpec pinSpec = (PINSpec) value; - super.setText(pinSpec.getLocalizedName()); - } - -} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java deleted file mode 100644 index 83ff74f2..00000000 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusRenderer.java +++ /dev/null @@ -1,61 +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.gui; - -import at.gv.egiz.bku.gui.PINManagementGUIFacade.STATUS; -import java.awt.Color; -import java.awt.Font; -import java.util.ResourceBundle; -import javax.swing.table.DefaultTableCellRenderer; - -/** - * - * @author Clemens Orthacker - */ -public class PINStatusRenderer extends DefaultTableCellRenderer { - -// private static final Log log = LogFactory.getLog(PINStatusRenderer.class); - - public static final Color RED = new Color(0.9f, 0.0f, 0.0f); - public static final Color GREEN = new Color(0.0f, 0.8f, 0.0f); - protected ResourceBundle messages; - - public PINStatusRenderer(ResourceBundle messages) { - this.messages = messages; - } - - @Override - protected void setValue(Object value) { - STATUS pinStatus = (STATUS) value; - super.setFont(super.getFont().deriveFont(super.getFont().getStyle() | Font.BOLD)); - - if (pinStatus == STATUS.NOT_ACTIV) { - super.setForeground(RED); - super.setText("" + messages.getString(PINManagementGUIFacade.STATUS_NOT_ACTIVE) + ""); - } else if (pinStatus == STATUS.ACTIV) { - super.setForeground(GREEN); - super.setText("" + messages.getString(PINManagementGUIFacade.STATUS_ACTIVE) + ""); - } else if (pinStatus == STATUS.BLOCKED) { - super.setForeground(RED); - super.setText("" + messages.getString(PINManagementGUIFacade.STATUS_BLOCKED) + ""); - } else { - super.setForeground(Color.BLACK); - super.setText("" + messages.getString(PINManagementGUIFacade.STATUS_UNKNOWN) + ""); - } - } -} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusTableModel.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusTableModel.java deleted file mode 100644 index 052c13b2..00000000 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/gui/PINStatusTableModel.java +++ /dev/null @@ -1,58 +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.gui; - -import at.gv.egiz.bku.gui.PINManagementGUIFacade.STATUS; -import at.gv.egiz.smcc.PINSpec; -import java.util.Map; -import javax.swing.table.DefaultTableModel; - -/** - * - * @author Clemens Orthacker - */ -public class PINStatusTableModel extends DefaultTableModel { - -// protected static final Log log = LogFactory.getLog(PINStatusTableModel.class); - protected Class[] types; - - public PINStatusTableModel(Map pinStatuses) { - super(0, 2); - if (pinStatuses == null) { - throw new RuntimeException("pinStatuses must not be null"); - } -// log.trace(pinStatuses.size() + " PINs"); - types = new Class[] { PINSpec.class, STATUS.class }; - for (PINSpec pinSpec : pinStatuses.keySet()) { - addRow(new Object[] { pinSpec, pinStatuses.get(pinSpec) }); - } -// PINSpec activePIN = new PINSpec(0, 1, null, "active-PIN", (byte) 0x01); -// PINSpec blockedPIN = new PINSpec(0, 1, null, "blocked-PIN", (byte) 0x01); -// addRow(new Object[] { activePIN, PINStatusProvider.STATUS.ACTIV }); -// addRow(new Object[] { blockedPIN, PINStatusProvider.STATUS.BLOCKED }); - } - - @Override - public Class getColumnClass(int columnIndex) { - return types[columnIndex]; - } - - @Override - public boolean isCellEditable(int rowIndex, int columnIndex) { - return false; - } -} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java index 68f0cb72..cfd1e200 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java @@ -22,7 +22,7 @@ import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.gui.BKUGUIFacade.Style; import at.gv.egiz.bku.online.applet.BKUApplet; import at.gv.egiz.bku.smccstal.AbstractSMCCSTAL; -import at.gv.egiz.bku.smccstal.ext.CardMgmtRequestHandler; +import at.gv.egiz.bku.smccstal.CardMgmtRequestHandler; import at.gv.egiz.stal.ext.APDUScriptRequest; import at.gv.egiz.stal.service.STALPortType; import at.gv.egiz.stal.service.translator.STALTranslator; diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java index 81b635f8..d06c2865 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java @@ -18,11 +18,16 @@ package at.gv.egiz.bku.online.applet; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.gui.PINManagementGUIFacade; -import at.gv.egiz.bku.smccstal.ext.PINManagementRequestHandler; +import at.gv.egiz.bku.smccstal.PINManagementRequestHandler; import at.gv.egiz.stal.ErrorResponse; +import at.gv.egiz.stal.InfoboxReadRequest; +import at.gv.egiz.stal.QuitRequest; +import at.gv.egiz.stal.STALRequest; import at.gv.egiz.stal.STALResponse; +import at.gv.egiz.stal.SignRequest; import at.gv.egiz.stal.ext.PINManagementRequest; import at.gv.egiz.stal.ext.PINManagementResponse; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -36,7 +41,8 @@ public class PINManagementBKUWorker extends AppletBKUWorker { public PINManagementBKUWorker(BKUApplet applet, PINManagementGUIFacade gui) { super(applet, gui); - handlerMap.clear(); + removeRequestHandler(InfoboxReadRequest.class); + removeRequestHandler(SignRequest.class); addRequestHandler(PINManagementRequest.class, new PINManagementRequestHandler()); } @@ -46,7 +52,11 @@ public class PINManagementBKUWorker extends AppletBKUWorker { BKUGUIFacade.MESSAGE_WELCOME); try { - List responses = handleRequest(Collections.singletonList(new PINManagementRequest())); + + ArrayList reqs = new ArrayList(); + reqs.add(new PINManagementRequest()); + reqs.add(new QuitRequest()); + List responses = handleRequest(reqs); if (responses.size() == 1) { STALResponse response = responses.get(0); diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/CardMgmtRequestHandler.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/CardMgmtRequestHandler.java deleted file mode 100644 index 769342e7..00000000 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/CardMgmtRequestHandler.java +++ /dev/null @@ -1,177 +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.ActivationGUIFacade; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import javax.smartcardio.Card; -import javax.smartcardio.CardChannel; -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 at.gv.egiz.bku.smccstal.AbstractRequestHandler; -import at.gv.egiz.smcc.SignatureCardException; -import at.gv.egiz.stal.ErrorResponse; -import at.gv.egiz.stal.STALRequest; -import at.gv.egiz.stal.STALResponse; -import at.gv.egiz.stal.ext.APDUScriptRequest; -import at.gv.egiz.stal.ext.APDUScriptResponse; -import at.gv.egiz.stal.ext.APDUScriptRequest.Command; -import at.gv.egiz.stal.ext.APDUScriptRequest.RequestScriptElement; -import at.gv.egiz.stal.ext.APDUScriptRequest.Reset; -import at.gv.egiz.stal.ext.APDUScriptResponse.Response; -import at.gv.egiz.stal.ext.APDUScriptResponse.ATR; -import at.gv.egiz.stal.ext.APDUScriptResponse.ResponseScriptElement; -import java.awt.event.ActionListener; - -/** - * @author mcentner - * - */ -public class CardMgmtRequestHandler extends AbstractRequestHandler implements ActionListener { - - /** - * Logging facility. - */ - private static Log log = LogFactory.getLog(CardMgmtRequestHandler.class); - - /** - * The sequence counter. - */ - private int sequenceNum = 0; - - /** - * display script num - */ - private int currentActivationScript = 0; - - @Override - public STALResponse handleRequest(STALRequest request) - throws InterruptedException { - - // APDU Script Request - if (request instanceof APDUScriptRequest) { - - 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."); - return new ErrorResponse(1000); - } - - List script = ((APDUScriptRequest) request).getScript(); - ArrayList responses = new ArrayList(script.size()); - - ((ActivationGUIFacade) gui).showActivationProgressDialog(currentActivationScript, script.size(), this, "cancel"); - - try { - log.trace("begin exclusive"); - icc.beginExclusive(); - - for (RequestScriptElement scriptElement : script) { - ((ActivationGUIFacade) gui).incrementProgress(); - - if (scriptElement instanceof Command) { - log.trace("handling APDU script element COMMAND"); - Command command = (Command) scriptElement; - CommandAPDU commandAPDU = new CommandAPDU(command.getCommandAPDU()); - - log.trace("get basicchannel"); - CardChannel channel = icc.getBasicChannel(); - - sequenceNum = command.getSequence(); - log.debug("Transmit APDU (sequence=" + sequenceNum + ")"); - log.trace(commandAPDU.toString()); - ResponseAPDU responseAPDU = channel.transmit(commandAPDU); - log.trace(responseAPDU.toString()); - - byte[] sw = new byte[] { - (byte) (0xFF & responseAPDU.getSW1()), - (byte) (0xFF & responseAPDU.getSW2()) }; - - responses.add(new Response(sequenceNum, responseAPDU.getData(), sw, 0)); - - if (command.getExpectedSW() != null && - !Arrays.equals(sw, command.getExpectedSW())) { - // unexpected SW - log.warn("Got unexpected SW. APDU-script execution stopped."); - break; - } - - } else if (scriptElement instanceof Reset) { - - log.trace("handling APDU script element RESET"); - sequenceNum = 0; - card.reset(); - javax.smartcardio.ATR atr = icc.getATR(); - log.trace("got ATR: " + atr.toString()); - responses.add(new ATR(atr.getBytes())); - - log.trace("regain exclusive access to card"); - icc = card.getCard(); - icc.beginExclusive(); - } - - } - - } catch (CardException e) { - log.info("Failed to execute APDU script.", e); - responses.add(new Response(sequenceNum, null, null, Response.RC_UNSPECIFIED)); - } catch (SignatureCardException e) { - log.info("Failed to reset smart card.", e); - responses.add(new Response(sequenceNum, null, null, Response.RC_UNSPECIFIED)); - } catch (RuntimeException e) { - log.error(e); - throw e; - } finally { - try { - icc.endExclusive(); - } catch (CardException e) { - log.info(e); - } - } - - log.trace("done handling APDU script " + currentActivationScript + ", return response containing " + responses.size() + " elements"); - ((ActivationGUIFacade) gui).showIdleDialog(this, "cancel"); - return new APDUScriptResponse(responses); - - } else { - log.error("Got unexpected STAL request: " + request); - return new ErrorResponse(1000); - } - - } - - @Override - public boolean requireCard() { - return true; - } - -} diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/GetPINStatusException.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/GetPINStatusException.java deleted file mode 100644 index abbe66a1..00000000 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/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.ext; - -import at.gv.egiz.smcc.SignatureCardException; - -/** - * - * @author Clemens Orthacker - */ -public class GetPINStatusException extends SignatureCardException { - - /** - * Creates a new instance of GetStatusException without detail message. - */ - public GetPINStatusException() { - } - - - /** - * Constructs an instance of GetStatusException with the specified detail message. - * @param msg the detail message. - */ - public GetPINStatusException(String msg) { - super(msg); - } -} 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 deleted file mode 100644 index f54f89d4..00000000 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/ManagementPINProviderFactory.java +++ /dev/null @@ -1,262 +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.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 - */ -public class ManagementPINProviderFactory extends PINProviderFactory { - - 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)) { -// 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 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) { - if (retries == 1) { - message = BKUGUIFacade.MESSAGE_LAST_RETRY_PINPAD; - } else { - message = BKUGUIFacade.MESSAGE_RETRIES_PINPAD; - } - title = BKUGUIFacade.TITLE_RETRY; - 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); - } - } - - - 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 { - -// 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 { - - ((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 deleted file mode 100644 index e0b09d63..00000000 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/smccstal/ext/PINManagementRequestHandler.java +++ /dev/null @@ -1,244 +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 java.util.HashMap; -import java.util.Map; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import at.gv.egiz.bku.gui.BKUGUIFacade; -import at.gv.egiz.bku.gui.PINManagementGUIFacade; -import at.gv.egiz.bku.gui.PINManagementGUIFacade.STATUS; -import at.gv.egiz.bku.smccstal.AbstractRequestHandler; -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.PINMgmtSignatureCard; -import at.gv.egiz.smcc.PINOperationAbortedException; -import at.gv.egiz.smcc.PINSpec; -import at.gv.egiz.smcc.SignatureCardException; -import at.gv.egiz.smcc.TimeoutException; -import at.gv.egiz.smcc.PINMgmtSignatureCard.PIN_STATE; -import at.gv.egiz.stal.ErrorResponse; -import at.gv.egiz.stal.STALRequest; -import at.gv.egiz.stal.STALResponse; -import at.gv.egiz.stal.ext.PINManagementRequest; -import at.gv.egiz.stal.ext.PINManagementResponse; - -/** - * - * @author Clemens Orthacker - */ -public class PINManagementRequestHandler extends AbstractRequestHandler { - - protected static final Log log = LogFactory.getLog(PINManagementRequestHandler.class); - - protected Map pinStates = new HashMap(); - - @Override - public STALResponse handleRequest(STALRequest request) throws InterruptedException { - if (request instanceof PINManagementRequest) { - - PINManagementGUIFacade gui = (PINManagementGUIFacade) this.gui; - - PINSpec selectedPIN = null; - - try { - - if (card instanceof PINMgmtSignatureCard) { - - // 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"); - - } else { - - // card does not support PIN management - gui.showErrorDialog(PINManagementGUIFacade.ERR_UNSUPPORTED_CARD, - null, this, "cancel"); - - } - - while (true) { - - waitForAction(); - - if ("cancel".equals(actionCommand)) { - return new PINManagementResponse(); - } else { - selectedPIN = gui.getSelectedPINSpec(); - - if (selectedPIN == null) { - throw new NullPointerException("no PIN selected for activation/change"); - } - - ManagementPINProviderFactory ppfac = - new ManagementPINProviderFactory(card.getReader(), gui); - - try { - if ("activate_enterpin".equals(actionCommand)) { - log.info("activate " + selectedPIN.getLocalizedName()); - ((PINMgmtSignatureCard) card).activatePIN(selectedPIN, - ppfac.getActivatePINProvider()); - updatePINState(selectedPIN, STATUS.ACTIV); - gui.showMessageDialog(PINManagementGUIFacade.TITLE_ACTIVATE_SUCCESS, - PINManagementGUIFacade.MESSAGE_ACTIVATE_SUCCESS, - new Object[] {selectedPIN.getLocalizedName()}, - BKUGUIFacade.BUTTON_OK, this, "ok"); - waitForAction(); - } else if ("change_enterpin".equals(actionCommand)) { - log.info("change " + selectedPIN.getLocalizedName()); - ((PINMgmtSignatureCard) card).changePIN(selectedPIN, - ppfac.getChangePINProvider()); - updatePINState(selectedPIN, STATUS.ACTIV); - gui.showMessageDialog(PINManagementGUIFacade.TITLE_CHANGE_SUCCESS, - PINManagementGUIFacade.MESSAGE_CHANGE_SUCCESS, - new Object[] {selectedPIN.getLocalizedName()}, - BKUGUIFacade.BUTTON_OK, this, "ok"); - waitForAction(); - - } else if ("unblock_enterpuk".equals(actionCommand)) { - log.info("unblock " + selectedPIN.getLocalizedName()); - ((PINMgmtSignatureCard) card).unblockPIN(selectedPIN, - ppfac.getUnblockPINProvider()); - } else if ("verify_enterpin".equals(actionCommand)) { - log.info("verify " + selectedPIN.getLocalizedName()); - ((PINMgmtSignatureCard) card).verifyPIN(selectedPIN, - ppfac.getVerifyPINProvider()); - updatePINState(selectedPIN, STATUS.ACTIV); - } - } catch (CancelledException ex) { - log.trace("cancelled"); - } catch (TimeoutException ex) { - 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); - 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); - gui.showErrorDialog(PINManagementGUIFacade.ERR_NOT_ACTIVE, - 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 - - selectedPIN = null; - gui.showPINManagementDialog(pinStates, - 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 (SignatureCardException ex) { - log.error(ex.getMessage(), ex); - gui.showErrorDialog(PINManagementGUIFacade.ERR_UNKNOWN, null, - this, "ok"); - waitForAction(); - return new ErrorResponse(1000); - } - } else { - log.error("Got unexpected STAL request: " + request); - return new ErrorResponse(1000); - } - } - - @Override - public boolean requireCard() { - return true; - } - - /** - * query status for STARCOS card, - * assume provided status for ACOS card - * @param pinSpec - * @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); - } - } - -} diff --git a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties deleted file mode 100644 index 977d6e3a..00000000 --- a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties +++ /dev/null @@ -1,69 +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. - -title.activation=Aktivierung -title.pin.mgmt=PIN Verwaltung -title.activate.pin=PIN Aktivieren -title.change.pin=PIN \u00C4ndern -title.unblock.pin=PIN Entsperren -title.verify.pin=PIN Eingeben -title.activate.success=Erfolg -title.change.success=Erfolg - -# removed message.* prefix to reuse keys as help keys -pin.mgmt=Die Karte verf\u00FCgt \u00FCber {0} PINs -activate.pin={0} eingeben und best\u00E4tigen -change.pin={0} eingeben und best\u00E4tigen -unblock.pin=PUK zu {0} eingeben -verify.pin={0} eingeben -verify.pinpad={0} ({1} stellig) am Kartenleser eingeben (und best\u00E4tigen). -activate.pinpad={0} ({1} stellig) am Kartenleser eingeben und wiederholen (jeweils best\u00E4tigen). -change.pinpad=Alte {0} ({1} stellig) am Kartenleser eingeben, danach neue {0} eingeben und wiederholen (jeweils best\u00E4tigen). -unblock.pinpad={0} ({1} stellig) am Kartenleser eingeben (und best\u00E4tigen). -activate.success={0} wurde erfolgreich aktiviert. -change.success={0} wurde erfolgreich ge\u00E4ndert. - -label.activation=e-card Aktivierungsprozess -label.activation.step=Schritt {0} -label.activation.idle=Warte auf Server... -label.old.pin=Alte {0}: -label.new.pin=Neue {0}: -label.repeat.pin=Best\u00E4tigung: - -button.activate=Aktivieren -button.change=\u00C4ndern -button.unblock=Entsperren -button.verify=Abfragen - -help.activation=help.activation -help.pin.mgmt=help.pin.mgmt - -err.status=Der Status der PINs konnte nicht \u00FCberpr\u00FCft werden. -err.activate=Beim Aktivieren der {0} trat ein Fehler auf. -err.change=Beim \u00C4ndern der {0} trat ein Fehler auf. -err.unblock=Das Entsperren der {0} wird nicht unterst\u00FCtzt. -err.verify=VERIFY ERROR (TODO) -err.retries=Falsche {0}, noch {1} Versuche -err.locked={0} gesperrt. -err.not.active={0} nicht aktiviert. -err.pin.format=Ung\u00FCltige {0} L\u00E4nge, verlangt sind {1} Stellen. -err.pin.confirmation={0} und Best\u00E4tigung stimmen nicht \u00FCberein. -err.pin.operation.aborted=Der Vorgang f\u00FCr {0} wurde abgebrochen. -err.unsupported.card=Die Karte wird nicht unterst\u00FCtzt - -status.not.active=NICHT AKTIV -status.active=AKTIV -status.blocked=GESPERRT -status.unknown=UNBEKANNT diff --git a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties b/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties deleted file mode 100644 index 7f01971b..00000000 --- a/BKUAppletExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_en.properties +++ /dev/null @@ -1,68 +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. - -title.activation=Activation -title.pin.mgmt=PIN Management -title.activate.pin=Activate PIN -title.verify.pin=Enter PIN -title.change.pin=Change PIN -title.unblock.pin=Unblock PIN -title.activate.success=Success -title.change.success=Success - -# removed message.* prefix to reuse keys as help keys -pin.mgmt=The smartcard has {0} PINs -activate.pin=Enter and confirm {0} -change.pin=Enter and confirm {0} -unblock.pin=Enter PUK for {0} -verify.pin=Enter {0} -verify.pinpad=Enter {0} ({1} digits) on cardreader (and confirm). -activate.pinpad=Enter {0} ({1} digits) on cardreader and repeat (confirm in each case). -change.pinpad=Enter old {0} ({1} digits) on cardreader, then enter new {0} and repeat (confirm in each case). -unblock.pinpad=Enter {0} ({1} digits) on cardreader (and confirm). -activate.success={0} successfully activated -change.success={0} successfully changed - -label.activation=e-card activation process -label.activation.step=Step {0} -label.activation.idle=Wait for server... -label.old.pin=Old {0}: -label.new.pin=New {0}: -label.repeat.pin=Confirmation: - -button.activate=Activate -button.change=Change -button.unblock=Unblock -button.verify=Query - -help.activation=help.activation -help.pin.mgmt=help.pin.mgmt - -err.status=PIN statuses could not be read. -err.activate=An error occured during the activation of {0}. -err.change=An error occured during the changing of {0}. -err.unblock=Unblocking of {0} is not supported. -err.retries=Wrong {0}, {1} tries remaining -err.locked={0} locked -err.not.active={0} not activated. -err.pin.format=Invalid {0} length, {1} digit(s) required. -err.pin.confirmation={0} and confirmation do not match. -err.pin.operation.aborted=The operation on {0} was aborted. -err.unsupported.card=This card is not supported - -status.not.active=NOT ACTIVE -status.active=ACTIVE -status.blocked=BLOCKED -status.unknown=UNKNOWN diff --git a/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/ActivationGuiTest.java b/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/ActivationGuiTest.java deleted file mode 100644 index 95c5c678..00000000 --- a/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/ActivationGuiTest.java +++ /dev/null @@ -1,62 +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. -*/ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - -package at.gv.egiz.bku.gui; - -import java.awt.Container; -import java.awt.Dimension; -import javax.swing.JFrame; -import org.junit.Ignore; -import org.junit.Test; - - -/** - * - * @author clemens - */ -@Ignore -public class ActivationGuiTest { - - @Test - public void testBKUGUI() { - JFrame testFrame = new JFrame("BKUGUITest"); - Container contentPane = testFrame.getContentPane(); - contentPane.setPreferredSize(new Dimension(152, 145)); -// contentPane.setPreferredSize(new Dimension(300, 190)); - ActivationGUIFacade gui = new ActivationGUI(contentPane, null, BKUGUIFacade.Style.tiny, null, null); - BKUGUIWorker worker = new BKUGUIWorker(); - worker.init(gui); - testFrame.pack(); - testFrame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); - testFrame.setVisible(true); - new Thread(worker).start(); - - while(true) ; - } - - @Test - public void dummyTest() { - } - -// public static void main(String[] args) { -// new BKUGUITest().testBKUGUI(); -// } -} diff --git a/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java b/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java deleted file mode 100644 index b01abe72..00000000 --- a/BKUAppletExt/src/test/java/at/gv/egiz/bku/gui/BKUGUIWorker.java +++ /dev/null @@ -1,202 +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. - */ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ -package at.gv.egiz.bku.gui; - -import at.gv.egiz.smcc.PINSpec; -import at.gv.egiz.stal.HashDataInput; -import at.gv.egiz.stal.impl.ByteArrayHashDataInput; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.ArrayList; -import java.util.List; - -/** - * - * @author clemens - */ -public class BKUGUIWorker implements Runnable { - - ActivationGUIFacade gui; - - public void init(ActivationGUIFacade gui) { - this.gui = gui; - } - - @Override - public void run() { - try { - - final PINSpec signPinSpec = new PINSpec(6, 10, "[0-9]", "Signatur-PIN", (byte)0x00, null); - - - final ActionListener cancelListener = new ActionListener() { - - public void actionPerformed(ActionEvent e) { - System.out.println("CANCEL EVENT OCCURED: " + e); - } - }; - ActionListener okListener = new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - System.out.println("OK EVENT OCCURED: " + e); - } - }; - final ActionListener signListener = new ActionListener() { - - public void actionPerformed(ActionEvent e) { - System.out.println("SIGN EVENT OCCURED: " + e); - } - }; - ActionListener hashdataListener = new ActionListener() { - - public void actionPerformed(ActionEvent e) { - System.out.println("HASHDATA EVENT OCCURED: " + e); - ActionListener returnListener = new ActionListener() { - - @Override - public void actionPerformed(ActionEvent e) { - gui.showSignaturePINDialog(signPinSpec, -1, signListener, "sign", cancelListener, "cancel", null, "hashdata"); - } - }; - HashDataInput signedRef1 = new ByteArrayHashDataInput( - "Ich bin ein einfacher Text mit Umlauten: öäüßéç@€\n123\n456\n\tHello, world!\n\nlkjsd\nnksdjf".getBytes(), - "ref-id-0000000000000000000000001", - "text/plain", - "UTF-8"); - - HashDataInput signedRef2 = new ByteArrayHashDataInput( - "HashDataInput_002".getBytes(), - "ref-id-000000002", - "application/xhtml+xml", - "UTF-8"); - - HashDataInput signedRef3 = new ByteArrayHashDataInput( - "HashDataInput_003".getBytes(), - "ref-id-000000003", - "application/xhtml+xml", - "UTF-8"); - - HashDataInput signedRef4 = new ByteArrayHashDataInput( - "HashDataInput_004".getBytes(), - "ref-id-000000004", - "text/xml", - "UTF-8"); - - // - List signedRefs = new ArrayList(); - signedRefs.add(signedRef1); - signedRefs.add(signedRef2); - signedRefs.add(signedRef3); - signedRefs.add(signedRef4); -// signedRefs.add(signedRef4); -// signedRefs.add(signedRef4); -// signedRefs.add(signedRef4); -// signedRefs.add(signedRef4); -// signedRefs = Collections.singletonList(signedRef1); - gui.showSecureViewer(signedRefs, returnListener, "return"); - } - }; - - - -// gui.showWelcomeDialog(); -// -// Thread.sleep(2000); -// -// gui.showWaitDialog(null); -// -// Thread.sleep(1000); -// -// gui.showWaitDialog("test"); -// -// Thread.sleep(1000); -// -// -// gui.showInsertCardDialog(cancelListener, "cancel"); -// -// Thread.sleep(2000); -// -// gui.showCardNotSupportedDialog(cancelListener, "cancel"); -// -// Thread.sleep(2000); -// -// PINSpec cardPinSpec = new PINSpec(4, 4, "[0-9]", "Karten-PIN"); -// -// gui.showCardPINDialog(cardPinSpec, okListener, "ok", cancelListener, "cancel"); -// -// Thread.sleep(2000); -// -// gui.showSignaturePINDialog(signPinSpec, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata"); -// -// Thread.sleep(4000); -// - -// gui.showErrorDialog(BKUGUIFacade.ERR_NO_PCSC, null, null, null); - -// gui.showSignaturePINRetryDialog(signPinSpec, 2, signListener, "sign", cancelListener, "cancel", hashdataListener, "hashdata"); -// -// Thread.sleep(2000); -// -// gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, new Object[] {"Testfehler"}, null, null); -// -// Thread.sleep(2000); -// -// gui.showErrorDialog("error.test", new Object[] {"Testfehler", "noch ein TestFehler"}); -// -// Thread.sleep(2000); -// -// gui.showErrorDialog("error.no.hashdata", null); -// -// Thread.sleep(2000); -// -// gui.showErrorDialog(BKUGUIFacade.ERR_UNKNOWN, new Object[] {"Testfehler"}); -// -// Thread.sleep(2000); -// -// gui.showErrorDialog("error.unknown", null); - - gui.showActivationProgressDialog(1, 3, null, null); - - gui.incrementProgress(); - - Thread.sleep(1000); - - gui.incrementProgress(); - - Thread.sleep(1000); - - gui.incrementProgress(); - - - Thread.sleep(1000); - - gui.showIdleDialog(null, null); - -// gui.showTextPlainHashDataInput("hallo,\n welt!", "12345", null, "cancel", null, "save"); -// gui.showTextPlainHashDataInput("hallo,\n welt!", "12345", null, "cancel", null, "save"); -// Thread.sleep(2000); - - } catch (InterruptedException ex) { - ex.printStackTrace(); - } - } -} -- cgit v1.2.3 From b05ed4a6269f13602077047689c1a2e69f99bd4e Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 20 Aug 2009 16:44:17 +0000 Subject: pkcs11-pass property git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@450 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index 98502ab2..cbd12022 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -118,7 +118,7 @@ PKCS11 iaik.pkcs.pkcs11.provider.IAIKPkcs11 a-sit - + ${pkcs11-pass} -- cgit v1.2.3 From ac6d2a37ee43ddc48cc0a1e40371366607624db7 Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 20 Aug 2009 17:08:58 +0000 Subject: [maven-release-plugin] prepare for next development iteration git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@453 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index cbd12022..2cb095cc 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -2,13 +2,13 @@ bku at.gv.egiz - 1.2.2-SNAPSHOT + 1.2.3-SNAPSHOT 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.2.2-SNAPSHOT + 1.2.3-SNAPSHOT -- cgit v1.2.3 From ada7c53ce1c19ba26b988e43da51a1a99d584b14 Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 20 Aug 2009 17:10:52 +0000 Subject: [maven-release-plugin] rollback the release of mocca-1.2.2 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@454 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index 2cb095cc..cbd12022 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -2,13 +2,13 @@ bku at.gv.egiz - 1.2.3-SNAPSHOT + 1.2.2-SNAPSHOT 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.2.3-SNAPSHOT + 1.2.2-SNAPSHOT -- cgit v1.2.3 From e676ab1e361aff7ff7417f8f6e93ad176ef6cb60 Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 20 Aug 2009 17:27:08 +0000 Subject: [maven-release-plugin] prepare release mocca-1.2.2 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@455 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index cbd12022..0ba54934 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -2,44 +2,44 @@ bku at.gv.egiz - 1.2.2-SNAPSHOT + 1.2.2 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.2.2-SNAPSHOT + 1.2.2 at.gv.egiz STALExt - 1.2.2-SNAPSHOT + 1.2.2 at.gv.egiz STALXService - 1.2.2-SNAPSHOT + 1.2.2 at.gv.egiz smccSTAL - 1.2.2-SNAPSHOT + 1.2.2 at.gv.egiz BKUApplet - 1.2.2-SNAPSHOT + 1.2.2 at.gv.egiz BKUGuiExt - 1.2.2-SNAPSHOT + 1.2.2 at.gv.egiz smccSTALExt - 1.2.2-SNAPSHOT + 1.2.2 -- cgit v1.2.3 From 1102477bc94590a21eaf3bcbd50baa0b6ed13529 Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 20 Aug 2009 17:32:58 +0000 Subject: [maven-release-plugin] prepare for next development iteration git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@458 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index 0ba54934..d7a132d7 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -2,44 +2,44 @@ bku at.gv.egiz - 1.2.2 + 1.2.3-SNAPSHOT 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.2.2 + 1.2.3-SNAPSHOT at.gv.egiz STALExt - 1.2.2 + 1.2.3-SNAPSHOT at.gv.egiz STALXService - 1.2.2 + 1.2.3-SNAPSHOT at.gv.egiz smccSTAL - 1.2.2 + 1.2.3-SNAPSHOT at.gv.egiz BKUApplet - 1.2.2 + 1.2.3-SNAPSHOT at.gv.egiz BKUGuiExt - 1.2.2 + 1.2.3-SNAPSHOT at.gv.egiz smccSTALExt - 1.2.2 + 1.2.3-SNAPSHOT -- cgit v1.2.3 From c463f06a5b321c6b8b3d9029cbd03672c95eec3f Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 21 Aug 2009 15:59:35 +0000 Subject: PINManagmentRequest, QuitRequest git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@461 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java index d06c2865..5dedcedb 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementBKUWorker.java @@ -53,11 +53,9 @@ public class PINManagementBKUWorker extends AppletBKUWorker { try { - ArrayList reqs = new ArrayList(); - reqs.add(new PINManagementRequest()); - reqs.add(new QuitRequest()); - List responses = handleRequest(reqs); - + List responses = handleRequest(Collections.singletonList(new PINManagementRequest())); + handleRequest(Collections.singletonList(new QuitRequest())); + if (responses.size() == 1) { STALResponse response = responses.get(0); if (response instanceof PINManagementResponse) { -- cgit v1.2.3 From 45bae5a2d8b414ccb3ed4421eeee867b2a6e88b7 Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 21 Aug 2009 16:31:49 +0000 Subject: [maven-release-plugin] prepare release mocca-1.2.3 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@467 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index d7a132d7..82049917 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -2,44 +2,44 @@ bku at.gv.egiz - 1.2.3-SNAPSHOT + 1.2.3 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.2.3-SNAPSHOT + 1.2.3 at.gv.egiz STALExt - 1.2.3-SNAPSHOT + 1.2.3 at.gv.egiz STALXService - 1.2.3-SNAPSHOT + 1.2.3 at.gv.egiz smccSTAL - 1.2.3-SNAPSHOT + 1.2.3 at.gv.egiz BKUApplet - 1.2.3-SNAPSHOT + 1.2.3 at.gv.egiz BKUGuiExt - 1.2.3-SNAPSHOT + 1.2.3 at.gv.egiz smccSTALExt - 1.2.3-SNAPSHOT + 1.2.3 -- cgit v1.2.3 From 1f0a54980e6b3f60c3b3d935f22537ceba179100 Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 21 Aug 2009 16:32:05 +0000 Subject: [maven-release-plugin] prepare for next development iteration git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@469 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index 82049917..c85fc3d6 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -2,44 +2,44 @@ bku at.gv.egiz - 1.2.3 + 1.2.4-SNAPSHOT 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.2.3 + 1.2.4-SNAPSHOT at.gv.egiz STALExt - 1.2.3 + 1.2.4-SNAPSHOT at.gv.egiz STALXService - 1.2.3 + 1.2.4-SNAPSHOT at.gv.egiz smccSTAL - 1.2.3 + 1.2.4-SNAPSHOT at.gv.egiz BKUApplet - 1.2.3 + 1.2.4-SNAPSHOT at.gv.egiz BKUGuiExt - 1.2.3 + 1.2.4-SNAPSHOT at.gv.egiz smccSTALExt - 1.2.3 + 1.2.4-SNAPSHOT -- cgit v1.2.3 From 6d515d832b0c0828a63d0b68d7823054543761ff Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 27 Aug 2009 20:32:15 +0000 Subject: [maven-release-plugin] prepare release mocca-1.2.4 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@479 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index c85fc3d6..1cdfa5cc 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -2,44 +2,44 @@ bku at.gv.egiz - 1.2.4-SNAPSHOT + 1.2.4 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.2.4-SNAPSHOT + 1.2.4 at.gv.egiz STALExt - 1.2.4-SNAPSHOT + 1.2.4 at.gv.egiz STALXService - 1.2.4-SNAPSHOT + 1.2.4 at.gv.egiz smccSTAL - 1.2.4-SNAPSHOT + 1.2.4 at.gv.egiz BKUApplet - 1.2.4-SNAPSHOT + 1.2.4 at.gv.egiz BKUGuiExt - 1.2.4-SNAPSHOT + 1.2.4 at.gv.egiz smccSTALExt - 1.2.4-SNAPSHOT + 1.2.4 -- cgit v1.2.3 From 5eb05982f2e98f56569b4ea07b1961e3eed617d7 Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 27 Aug 2009 20:32:33 +0000 Subject: [maven-release-plugin] prepare for next development iteration git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@481 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index 1cdfa5cc..06cc6884 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -2,44 +2,44 @@ bku at.gv.egiz - 1.2.4 + 1.2.5-SNAPSHOT 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.2.4 + 1.2.5-SNAPSHOT at.gv.egiz STALExt - 1.2.4 + 1.2.5-SNAPSHOT at.gv.egiz STALXService - 1.2.4 + 1.2.5-SNAPSHOT at.gv.egiz smccSTAL - 1.2.4 + 1.2.5-SNAPSHOT at.gv.egiz BKUApplet - 1.2.4 + 1.2.5-SNAPSHOT at.gv.egiz BKUGuiExt - 1.2.4 + 1.2.5-SNAPSHOT at.gv.egiz smccSTALExt - 1.2.4 + 1.2.5-SNAPSHOT -- cgit v1.2.3 From 44ee3259546bdcfbdc54563aa2766cce3f5cd704 Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 28 Aug 2009 20:13:07 +0000 Subject: [maven-release-plugin] prepare release mocca-1.2.3 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@488 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index 06cc6884..413e2b18 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -2,44 +2,44 @@ bku at.gv.egiz - 1.2.5-SNAPSHOT + 1.2.5 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.2.5-SNAPSHOT + 1.2.5 at.gv.egiz STALExt - 1.2.5-SNAPSHOT + 1.2.5 at.gv.egiz STALXService - 1.2.5-SNAPSHOT + 1.2.5 at.gv.egiz smccSTAL - 1.2.5-SNAPSHOT + 1.2.5 at.gv.egiz BKUApplet - 1.2.5-SNAPSHOT + 1.2.5 at.gv.egiz BKUGuiExt - 1.2.5-SNAPSHOT + 1.2.5 at.gv.egiz smccSTALExt - 1.2.5-SNAPSHOT + 1.2.5 -- cgit v1.2.3 From 68ebb57a05d44b25b886749719e7bd9997b0bd11 Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 28 Aug 2009 20:16:01 +0000 Subject: [maven-release-plugin] prepare for next development iteration git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@490 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index 413e2b18..e43a70df 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -2,44 +2,44 @@ bku at.gv.egiz - 1.2.5 + 1.2.6-SNAPSHOT 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.2.5 + 1.2.6-SNAPSHOT at.gv.egiz STALExt - 1.2.5 + 1.2.6-SNAPSHOT at.gv.egiz STALXService - 1.2.5 + 1.2.6-SNAPSHOT at.gv.egiz smccSTAL - 1.2.5 + 1.2.6-SNAPSHOT at.gv.egiz BKUApplet - 1.2.5 + 1.2.6-SNAPSHOT at.gv.egiz BKUGuiExt - 1.2.5 + 1.2.6-SNAPSHOT at.gv.egiz smccSTALExt - 1.2.5 + 1.2.6-SNAPSHOT -- cgit v1.2.3 From 025657248e87001b91a5eb90cdc24fb20bc2c62b Mon Sep 17 00:00:00 2001 From: mcentner Date: Wed, 9 Sep 2009 07:54:21 +0000 Subject: [maven-release-plugin] prepare release mocca-1.2.6 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@506 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index e43a70df..efe233e7 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -2,44 +2,44 @@ bku at.gv.egiz - 1.2.6-SNAPSHOT + 1.2.6 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.2.6-SNAPSHOT + 1.2.6 at.gv.egiz STALExt - 1.2.6-SNAPSHOT + 1.2.6 at.gv.egiz STALXService - 1.2.6-SNAPSHOT + 1.2.6 at.gv.egiz smccSTAL - 1.2.6-SNAPSHOT + 1.2.6 at.gv.egiz BKUApplet - 1.2.6-SNAPSHOT + 1.2.6 at.gv.egiz BKUGuiExt - 1.2.6-SNAPSHOT + 1.2.6 at.gv.egiz smccSTALExt - 1.2.6-SNAPSHOT + 1.2.6 -- cgit v1.2.3 From ce450c6eee4977040072b5f51a91183c15846b1a Mon Sep 17 00:00:00 2001 From: mcentner Date: Wed, 9 Sep 2009 07:54:58 +0000 Subject: [maven-release-plugin] prepare for next development iteration git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@508 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index efe233e7..832ed03b 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -2,44 +2,44 @@ bku at.gv.egiz - 1.2.6 + 1.2.7-SNAPSHOT 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.2.6 + 1.2.7-SNAPSHOT at.gv.egiz STALExt - 1.2.6 + 1.2.7-SNAPSHOT at.gv.egiz STALXService - 1.2.6 + 1.2.7-SNAPSHOT at.gv.egiz smccSTAL - 1.2.6 + 1.2.7-SNAPSHOT at.gv.egiz BKUApplet - 1.2.6 + 1.2.7-SNAPSHOT at.gv.egiz BKUGuiExt - 1.2.6 + 1.2.7-SNAPSHOT at.gv.egiz smccSTALExt - 1.2.6 + 1.2.7-SNAPSHOT -- cgit v1.2.3 From 390f6aab59c3fb7a9250d087dc9aec77b6bd865b Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 2 Oct 2009 17:56:27 +0000 Subject: [maven-release-plugin] prepare release mocca-1.2.7 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@519 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index 832ed03b..5f19e8f2 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -2,44 +2,44 @@ bku at.gv.egiz - 1.2.7-SNAPSHOT + 1.2.7 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.2.7-SNAPSHOT + 1.2.7 at.gv.egiz STALExt - 1.2.7-SNAPSHOT + 1.2.7 at.gv.egiz STALXService - 1.2.7-SNAPSHOT + 1.2.7 at.gv.egiz smccSTAL - 1.2.7-SNAPSHOT + 1.2.7 at.gv.egiz BKUApplet - 1.2.7-SNAPSHOT + 1.2.7 at.gv.egiz BKUGuiExt - 1.2.7-SNAPSHOT + 1.2.7 at.gv.egiz smccSTALExt - 1.2.7-SNAPSHOT + 1.2.7 -- cgit v1.2.3 From a47eafbbc567163f0319b066f65eaa7d2d9226c2 Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 2 Oct 2009 17:56:38 +0000 Subject: [maven-release-plugin] prepare for next development iteration git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@521 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index 5f19e8f2..488d0808 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -2,44 +2,44 @@ bku at.gv.egiz - 1.2.7 + 1.2.8-SNAPSHOT 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.2.7 + 1.2.8-SNAPSHOT at.gv.egiz STALExt - 1.2.7 + 1.2.8-SNAPSHOT at.gv.egiz STALXService - 1.2.7 + 1.2.8-SNAPSHOT at.gv.egiz smccSTAL - 1.2.7 + 1.2.8-SNAPSHOT at.gv.egiz BKUApplet - 1.2.7 + 1.2.8-SNAPSHOT at.gv.egiz BKUGuiExt - 1.2.7 + 1.2.8-SNAPSHOT at.gv.egiz smccSTALExt - 1.2.7 + 1.2.8-SNAPSHOT -- cgit v1.2.3 From 91b596dcba1e95e787134d22a776ea0cee815e57 Mon Sep 17 00:00:00 2001 From: tzefferer Date: Fri, 16 Oct 2009 09:54:06 +0000 Subject: Keyboard accessibility for Online-BKU git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@527 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java | 6 ++++-- .../main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java index cfd1e200..5bab2ef8 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java @@ -19,6 +19,7 @@ package at.gv.egiz.bku.online.applet; import at.gv.egiz.bku.gui.AbstractHelpListener; import at.gv.egiz.bku.gui.ActivationGUI; import at.gv.egiz.bku.gui.BKUGUIFacade; +import at.gv.egiz.bku.gui.SwitchFocusListener; import at.gv.egiz.bku.gui.BKUGUIFacade.Style; import at.gv.egiz.bku.online.applet.BKUApplet; import at.gv.egiz.bku.smccstal.AbstractSMCCSTAL; @@ -84,7 +85,8 @@ public class ActivationApplet extends BKUApplet { Locale locale, Style guiStyle, URL backgroundImgURL, - AbstractHelpListener helpListener) { - return new ActivationGUI(contentPane, locale, guiStyle, backgroundImgURL, helpListener); + AbstractHelpListener helpListener, + SwitchFocusListener switchFocusListener) { + return new ActivationGUI(contentPane, locale, guiStyle, backgroundImgURL, helpListener, switchFocusListener); } } diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java index d948ac03..055e9c31 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java @@ -20,6 +20,7 @@ import at.gv.egiz.bku.gui.AbstractHelpListener; 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.SwitchFocusListener; import java.awt.Container; import java.net.URL; import java.util.Locale; @@ -40,8 +41,9 @@ public class PINManagementApplet extends BKUApplet { Locale locale, BKUGUIFacade.Style guiStyle, URL backgroundImgURL, - AbstractHelpListener helpListener) { - return new PINManagementGUI(contentPane, locale, guiStyle, backgroundImgURL, helpListener); + AbstractHelpListener helpListener, + SwitchFocusListener switchFocusListener) { + return new PINManagementGUI(contentPane, locale, guiStyle, backgroundImgURL, helpListener, switchFocusListener); } @Override -- cgit v1.2.3 From 83e8c95ea7d257166d350a59bfd81e9833ec14fd Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 5 Nov 2009 19:05:14 +0000 Subject: [#484] European Language support git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@535 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java | 4 +++- .../main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java index 5bab2ef8..4f2f1331 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/ActivationApplet.java @@ -21,6 +21,7 @@ import at.gv.egiz.bku.gui.ActivationGUI; import at.gv.egiz.bku.gui.BKUGUIFacade; import at.gv.egiz.bku.gui.SwitchFocusListener; import at.gv.egiz.bku.gui.BKUGUIFacade.Style; +import at.gv.egiz.bku.gui.viewer.FontProvider; import at.gv.egiz.bku.online.applet.BKUApplet; import at.gv.egiz.bku.smccstal.AbstractSMCCSTAL; import at.gv.egiz.bku.smccstal.CardMgmtRequestHandler; @@ -85,8 +86,9 @@ public class ActivationApplet extends BKUApplet { Locale locale, Style guiStyle, URL backgroundImgURL, + FontProvider fontProvider, AbstractHelpListener helpListener, SwitchFocusListener switchFocusListener) { - return new ActivationGUI(contentPane, locale, guiStyle, backgroundImgURL, helpListener, switchFocusListener); + return new ActivationGUI(contentPane, locale, guiStyle, backgroundImgURL, fontProvider, helpListener, switchFocusListener); } } diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java index 055e9c31..bf323969 100644 --- a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java +++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/PINManagementApplet.java @@ -21,6 +21,7 @@ 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.SwitchFocusListener; +import at.gv.egiz.bku.gui.viewer.FontProvider; import java.awt.Container; import java.net.URL; import java.util.Locale; @@ -41,9 +42,10 @@ public class PINManagementApplet extends BKUApplet { Locale locale, BKUGUIFacade.Style guiStyle, URL backgroundImgURL, + FontProvider fontProvider, AbstractHelpListener helpListener, SwitchFocusListener switchFocusListener) { - return new PINManagementGUI(contentPane, locale, guiStyle, backgroundImgURL, helpListener, switchFocusListener); + return new PINManagementGUI(contentPane, locale, guiStyle, backgroundImgURL, fontProvider, helpListener, switchFocusListener); } @Override -- cgit v1.2.3 From 04f0881563fdbecd8223627a7752e27690cc99c2 Mon Sep 17 00:00:00 2001 From: clemenso Date: Fri, 13 Nov 2009 16:18:32 +0000 Subject: [maven-release-plugin] prepare release mocca-1.2.8 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@549 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index 488d0808..d4ba7363 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -2,44 +2,44 @@ bku at.gv.egiz - 1.2.8-SNAPSHOT + 1.2.8 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.2.8-SNAPSHOT + 1.2.8 at.gv.egiz STALExt - 1.2.8-SNAPSHOT + 1.2.8 at.gv.egiz STALXService - 1.2.8-SNAPSHOT + 1.2.8 at.gv.egiz smccSTAL - 1.2.8-SNAPSHOT + 1.2.8 at.gv.egiz BKUApplet - 1.2.8-SNAPSHOT + 1.2.8 at.gv.egiz BKUGuiExt - 1.2.8-SNAPSHOT + 1.2.8 at.gv.egiz smccSTALExt - 1.2.8-SNAPSHOT + 1.2.8 -- cgit v1.2.3 From 8814f7675055585933d8dae365cf3a95906fac05 Mon Sep 17 00:00:00 2001 From: clemenso Date: Wed, 18 Nov 2009 17:04:48 +0000 Subject: [maven-release-plugin] prepare for next development iteration git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@551 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index d4ba7363..84c4844c 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -2,44 +2,44 @@ bku at.gv.egiz - 1.2.8 + 1.2.9-SNAPSHOT 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.2.8 + 1.2.9-SNAPSHOT at.gv.egiz STALExt - 1.2.8 + 1.2.9-SNAPSHOT at.gv.egiz STALXService - 1.2.8 + 1.2.9-SNAPSHOT at.gv.egiz smccSTAL - 1.2.8 + 1.2.9-SNAPSHOT at.gv.egiz BKUApplet - 1.2.8 + 1.2.9-SNAPSHOT at.gv.egiz BKUGuiExt - 1.2.8 + 1.2.9-SNAPSHOT at.gv.egiz smccSTALExt - 1.2.8 + 1.2.9-SNAPSHOT -- cgit v1.2.3 From ceeaeb1790d1ed1ef9565f7c47e8bf247a83f28c Mon Sep 17 00:00:00 2001 From: clemenso Date: Wed, 2 Dec 2009 09:19:40 +0000 Subject: [maven-release-plugin] prepare release mocca-1.2.9 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@558 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index 84c4844c..cb831cff 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -2,44 +2,44 @@ bku at.gv.egiz - 1.2.9-SNAPSHOT + 1.2.9 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.2.9-SNAPSHOT + 1.2.9 at.gv.egiz STALExt - 1.2.9-SNAPSHOT + 1.2.9 at.gv.egiz STALXService - 1.2.9-SNAPSHOT + 1.2.9 at.gv.egiz smccSTAL - 1.2.9-SNAPSHOT + 1.2.9 at.gv.egiz BKUApplet - 1.2.9-SNAPSHOT + 1.2.9 at.gv.egiz BKUGuiExt - 1.2.9-SNAPSHOT + 1.2.9 at.gv.egiz smccSTALExt - 1.2.9-SNAPSHOT + 1.2.9 -- cgit v1.2.3 From f03ce51929e344a92d04aeb4bba473ae47a913b2 Mon Sep 17 00:00:00 2001 From: clemenso Date: Wed, 2 Dec 2009 09:23:50 +0000 Subject: [maven-release-plugin] prepare for next development iteration git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@560 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index cb831cff..95ebcab5 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -2,44 +2,44 @@ bku at.gv.egiz - 1.2.9 + 1.2.10-SNAPSHOT 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.2.9 + 1.2.10-SNAPSHOT at.gv.egiz STALExt - 1.2.9 + 1.2.10-SNAPSHOT at.gv.egiz STALXService - 1.2.9 + 1.2.10-SNAPSHOT at.gv.egiz smccSTAL - 1.2.9 + 1.2.10-SNAPSHOT at.gv.egiz BKUApplet - 1.2.9 + 1.2.10-SNAPSHOT at.gv.egiz BKUGuiExt - 1.2.9 + 1.2.10-SNAPSHOT at.gv.egiz smccSTALExt - 1.2.9 + 1.2.10-SNAPSHOT -- cgit v1.2.3 From dbffe94889d61a98733103b43ed30e53cdefd6ac Mon Sep 17 00:00:00 2001 From: clemenso Date: Tue, 5 Jan 2010 12:18:12 +0000 Subject: [maven-release-plugin] prepare release mocca-1.2.10 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@567 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index 95ebcab5..05493cb1 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -2,44 +2,44 @@ bku at.gv.egiz - 1.2.10-SNAPSHOT + 1.2.10 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.2.10-SNAPSHOT + 1.2.10 at.gv.egiz STALExt - 1.2.10-SNAPSHOT + 1.2.10 at.gv.egiz STALXService - 1.2.10-SNAPSHOT + 1.2.10 at.gv.egiz smccSTAL - 1.2.10-SNAPSHOT + 1.2.10 at.gv.egiz BKUApplet - 1.2.10-SNAPSHOT + 1.2.10 at.gv.egiz BKUGuiExt - 1.2.10-SNAPSHOT + 1.2.10 at.gv.egiz smccSTALExt - 1.2.10-SNAPSHOT + 1.2.10 -- cgit v1.2.3 From 73065b1be0f839c09e8ca481a20f398167404ce4 Mon Sep 17 00:00:00 2001 From: clemenso Date: Tue, 5 Jan 2010 12:21:05 +0000 Subject: [maven-release-plugin] prepare for next development iteration git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@569 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index 05493cb1..122751c5 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -2,44 +2,44 @@ bku at.gv.egiz - 1.2.10 + 1.2.11-SNAPSHOT 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.2.10 + 1.2.11-SNAPSHOT at.gv.egiz STALExt - 1.2.10 + 1.2.11-SNAPSHOT at.gv.egiz STALXService - 1.2.10 + 1.2.11-SNAPSHOT at.gv.egiz smccSTAL - 1.2.10 + 1.2.11-SNAPSHOT at.gv.egiz BKUApplet - 1.2.10 + 1.2.11-SNAPSHOT at.gv.egiz BKUGuiExt - 1.2.10 + 1.2.11-SNAPSHOT at.gv.egiz smccSTALExt - 1.2.10 + 1.2.11-SNAPSHOT -- cgit v1.2.3 From b64fe87baf4f554411ca73fc3250fa515da3e69d Mon Sep 17 00:00:00 2001 From: clemenso Date: Tue, 5 Jan 2010 14:45:11 +0000 Subject: implementation-build manifest entry for AppletExt (version in log) git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@570 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index 122751c5..1440fc76 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -44,6 +44,22 @@ + + org.codehaus.mojo + maven-buildnumber-plugin + + + validate + + create + + + + + false + false + + maven-jar-plugin org.apache.maven.plugins @@ -62,6 +78,9 @@ false true + + ${project.version}-r${buildNumber} + test-applet signer ./keystore.ks -- cgit v1.2.3 From b2d6b1c93152bf94d25e992815d97d2322941de6 Mon Sep 17 00:00:00 2001 From: clemenso Date: Tue, 19 Jan 2010 16:07:11 +0000 Subject: [maven-release-plugin] copy for tag mocca-1.2.11 git-svn-id: https://joinup.ec.europa.eu/svn/mocca/tags/mocca-1.2.11@587 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUAppletExt/pom.xml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'BKUAppletExt') diff --git a/BKUAppletExt/pom.xml b/BKUAppletExt/pom.xml index 1440fc76..64236425 100644 --- a/BKUAppletExt/pom.xml +++ b/BKUAppletExt/pom.xml @@ -2,44 +2,44 @@ bku at.gv.egiz - 1.2.11-SNAPSHOT + 1.2.11 4.0.0 at.gv.egiz BKUAppletExt BKU Applet Extension - 1.2.11-SNAPSHOT + 1.2.11 at.gv.egiz STALExt - 1.2.11-SNAPSHOT + 1.2.11 at.gv.egiz STALXService - 1.2.11-SNAPSHOT + 1.2.11 at.gv.egiz smccSTAL - 1.2.11-SNAPSHOT + 1.2.11 at.gv.egiz BKUApplet - 1.2.11-SNAPSHOT + 1.2.11 at.gv.egiz BKUGuiExt - 1.2.11-SNAPSHOT + 1.2.11 at.gv.egiz smccSTALExt - 1.2.11-SNAPSHOT + 1.2.11 -- cgit v1.2.3