summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortkellner <tkellner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2012-04-02 16:38:59 +0000
committertkellner <tkellner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2012-04-02 16:38:59 +0000
commitf8db5af9c94285c4946bdf38407fe15ed1b7f818 (patch)
treebaf5d1db2da875abf1b90daf5119fe04f8a9db18
parent8a6896444ce9b14c27193e688a8eeb59e1f51a4d (diff)
downloadmocca-f8db5af9c94285c4946bdf38407fe15ed1b7f818.tar.gz
mocca-f8db5af9c94285c4946bdf38407fe15ed1b7f818.tar.bz2
mocca-f8db5af9c94285c4946bdf38407fe15ed1b7f818.zip
* Save certificates to local file system
* Show cardreader and smartcard information for Webstart and Applet version git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@1042 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
-rw-r--r--BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/GETCertificateApplet.java61
-rw-r--r--BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/GETCertificateBKUWorker.java100
-rw-r--r--BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/HardwareInfoApplet.java59
-rw-r--r--BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/HardwareInfoBKUWorker.java100
-rw-r--r--BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/GetCertificateGUI.java216
-rw-r--r--BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/GetCertificateGUIFacade.java51
-rw-r--r--BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/GetHardwareInfoGUI.java306
-rw-r--r--BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/GetHardwareInfoGUIFacade.java43
-rw-r--r--BKUGuiExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties12
-rw-r--r--BKUGuiExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_de.properties12
-rw-r--r--BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalBKUWorker.java6
-rw-r--r--BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalGETCertificateSTALFactory.java136
-rw-r--r--BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalGetHardwareInfoSTALFactory.java136
-rw-r--r--BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/GETCertificateServlet.java133
-rw-r--r--BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/GetHardwareInfoServlet.java133
-rw-r--r--BKULocal/src/main/webapp/WEB-INF/web.xml17
-rw-r--r--BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/MoccaParameterBean.java3
-rw-r--r--BKUOnline/src/main/webapp/SLRequestForm.html4
-rw-r--r--BKUOnline/src/main/webapp/applet.jsp8
-rw-r--r--BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/GetCertificateInvoker.java76
-rw-r--r--BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/HardwareInfoInvoker.java76
-rw-r--r--BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Launcher.java18
-rw-r--r--BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/BKUControllerInterface.java4
-rw-r--r--BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/MOCCAIcon.java53
-rw-r--r--BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/messages.properties9
-rw-r--r--BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/messages_de.properties8
-rw-r--r--STALExt/src/main/java/at/gv/egiz/stal/ext/GETCertificateRequest.java35
-rw-r--r--STALExt/src/main/java/at/gv/egiz/stal/ext/GETCertificateResponse.java35
-rw-r--r--STALExt/src/main/java/at/gv/egiz/stal/ext/GETHardwareInfoRequest.java35
-rw-r--r--STALExt/src/main/java/at/gv/egiz/stal/ext/GETHardwareInfoResponse.java35
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/AbstractSignatureCard.java6
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/SWCard.java4
-rw-r--r--smcc/src/main/java/at/gv/egiz/smcc/SignatureCard.java2
-rw-r--r--smccSTAL/src/test/java/at/gv/egiz/smcc/AbstractSMCCSTALTest.java8
-rw-r--r--smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/GETCertificateRequestHandler.java129
-rw-r--r--smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/GETHardwareInfoRequestHandler.java106
36 files changed, 2156 insertions, 19 deletions
diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/GETCertificateApplet.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/GETCertificateApplet.java
new file mode 100644
index 00000000..4a46f397
--- /dev/null
+++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/GETCertificateApplet.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2011 by Graz University of Technology, Austria
+ * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint
+ * initiative of the Federal Chancellery Austria and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
+package at.gv.egiz.bku.online.applet;
+
+import java.awt.Container;
+import java.net.URL;
+import java.util.Locale;
+
+import at.gv.egiz.bku.gui.BKUGUIFacade;
+import at.gv.egiz.bku.gui.GetCertificateGUI;
+import at.gv.egiz.bku.gui.GetCertificateGUIFacade;
+import at.gv.egiz.bku.gui.HelpListener;
+import at.gv.egiz.bku.gui.SwitchFocusListener;
+import at.gv.egiz.bku.gui.viewer.FontProvider;
+
+/**
+*
+* @author Thomas Lenz <thomas.lenz@iaik.tugraz.at>
+*/
+
+public class GETCertificateApplet extends BKUApplet {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected BKUGUIFacade createGUI(Container contentPane, Locale locale,
+ BKUGUIFacade.Style guiStyle, URL backgroundImgURL,
+ FontProvider fontProvider, HelpListener helpListener,
+ SwitchFocusListener switchFocusListener) {
+ return new GetCertificateGUI(contentPane, locale,
+ backgroundImgURL, fontProvider, helpListener,
+ switchFocusListener);
+ }
+
+ @Override
+ protected AppletBKUWorker createBKUWorker(BKUApplet applet, BKUGUIFacade gui) {
+ return new GETCertificateBKUWorker(applet, (GetCertificateGUIFacade) gui);
+ }
+
+}
diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/GETCertificateBKUWorker.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/GETCertificateBKUWorker.java
new file mode 100644
index 00000000..5b04e28b
--- /dev/null
+++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/GETCertificateBKUWorker.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2011 by Graz University of Technology, Austria
+ * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint
+ * initiative of the Federal Chancellery Austria and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
+package at.gv.egiz.bku.online.applet;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import at.gv.egiz.bku.gui.BKUGUIFacade;
+import at.gv.egiz.bku.gui.GetCertificateGUIFacade;
+import at.gv.egiz.bku.smccstal.GETCertificateRequestHandler;
+import at.gv.egiz.stal.ErrorResponse;
+import at.gv.egiz.stal.InfoboxReadRequest;
+import at.gv.egiz.stal.QuitRequest;
+import at.gv.egiz.stal.STALResponse;
+import at.gv.egiz.stal.SignRequest;
+import at.gv.egiz.stal.ext.GETCertificateRequest;
+import at.gv.egiz.stal.ext.GETCertificateResponse;
+
+/**
+*
+* @author Thomas Lenz <thomas.lenz@iaik.tugraz.at>
+*/
+
+public class GETCertificateBKUWorker extends AppletBKUWorker {
+
+ private final Logger log = LoggerFactory.getLogger(GETCertificateBKUWorker.class);
+
+ public GETCertificateBKUWorker(BKUApplet applet, GetCertificateGUIFacade gui) {
+ super(applet, gui);
+ removeRequestHandler(InfoboxReadRequest.class);
+ removeRequestHandler(SignRequest.class);
+ addRequestHandler(GETCertificateRequest.class, new GETCertificateRequestHandler());
+ }
+
+ @Override
+ public void run() {
+ gui.showMessageDialog(BKUGUIFacade.TITLE_WELCOME,
+ BKUGUIFacade.MESSAGE_WELCOME);
+
+ try {
+
+ List<STALResponse> responses = handleRequest(Collections.singletonList(new GETCertificateRequest()));
+ handleRequest(Collections.singletonList(new QuitRequest()));
+
+ if (responses.size() == 1) {
+ STALResponse response = responses.get(0);
+ if (response instanceof GETCertificateResponse) {
+ log.debug("GET certificate dialog terminated.");
+ } else if (response instanceof ErrorResponse) {
+ log.debug("GET certificate dialog terminated with error.");
+ } else {
+ throw new RuntimeException("Invalid STAL response: " + response.getClass().getName());
+ }
+ } else {
+ throw new RuntimeException("invalid number of STAL responses: " + responses.size());
+ }
+
+ } catch (RuntimeException 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);
+ showErrorDialog(BKUGUIFacade.ERR_UNKNOWN_WITH_PARAM, ex);
+ } finally {
+ if (signatureCard != null) {
+ signatureCard.disconnect(false);
+ }
+ }
+
+ applet.sendRedirect();
+ }
+}
diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/HardwareInfoApplet.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/HardwareInfoApplet.java
new file mode 100644
index 00000000..18397613
--- /dev/null
+++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/HardwareInfoApplet.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2012 by Graz University of Technology, Austria
+ * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint
+ * initiative of the Federal Chancellery Austria and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
+package at.gv.egiz.bku.online.applet;
+
+import java.awt.Container;
+import java.net.URL;
+import java.util.Locale;
+
+import at.gv.egiz.bku.gui.BKUGUIFacade;
+import at.gv.egiz.bku.gui.GetHardwareInfoGUI;
+import at.gv.egiz.bku.gui.GetHardwareInfoGUIFacade;
+import at.gv.egiz.bku.gui.HelpListener;
+import at.gv.egiz.bku.gui.SwitchFocusListener;
+import at.gv.egiz.bku.gui.viewer.FontProvider;
+
+/**
+*
+* @author Thomas Lenz <thomas.lenz@iaik.tugraz.at>
+*/
+
+public class HardwareInfoApplet extends BKUApplet {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected BKUGUIFacade createGUI(Container contentPane, Locale locale,
+ BKUGUIFacade.Style guiStyle, URL backgroundImgURL,
+ FontProvider fontProvider, HelpListener helpListener,
+ SwitchFocusListener switchFocusListener) {
+ return new GetHardwareInfoGUI(contentPane, locale,
+ backgroundImgURL, fontProvider, helpListener,
+ switchFocusListener);
+ }
+
+ @Override
+ protected AppletBKUWorker createBKUWorker(BKUApplet applet, BKUGUIFacade gui) {
+ return new HardwareInfoBKUWorker(applet, (GetHardwareInfoGUIFacade) gui);
+ }
+}
diff --git a/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/HardwareInfoBKUWorker.java b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/HardwareInfoBKUWorker.java
new file mode 100644
index 00000000..bfa4d71e
--- /dev/null
+++ b/BKUAppletExt/src/main/java/at/gv/egiz/bku/online/applet/HardwareInfoBKUWorker.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright 2012 by Graz University of Technology, Austria
+ * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint
+ * initiative of the Federal Chancellery Austria and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
+package at.gv.egiz.bku.online.applet;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import at.gv.egiz.bku.gui.BKUGUIFacade;
+import at.gv.egiz.bku.gui.GetHardwareInfoGUIFacade;
+import at.gv.egiz.bku.smccstal.GETHardwareInfoRequestHandler;
+import at.gv.egiz.stal.ErrorResponse;
+import at.gv.egiz.stal.InfoboxReadRequest;
+import at.gv.egiz.stal.QuitRequest;
+import at.gv.egiz.stal.STALResponse;
+import at.gv.egiz.stal.SignRequest;
+import at.gv.egiz.stal.ext.GETHardwareInfoRequest;
+import at.gv.egiz.stal.ext.GETHardwareInfoResponse;
+
+/**
+*
+* @author Thomas Lenz <thomas.lenz@iaik.tugraz.at>
+*/
+
+public class HardwareInfoBKUWorker extends AppletBKUWorker {
+ private final Logger log = LoggerFactory.getLogger(HardwareInfoBKUWorker.class);
+
+ public HardwareInfoBKUWorker(BKUApplet applet, GetHardwareInfoGUIFacade gui) {
+ super(applet, gui);
+ removeRequestHandler(InfoboxReadRequest.class);
+ removeRequestHandler(SignRequest.class);
+ addRequestHandler(GETHardwareInfoRequest.class, new GETHardwareInfoRequestHandler());
+ }
+
+ @Override
+ public void run() {
+ gui.showMessageDialog(BKUGUIFacade.TITLE_WELCOME,
+ BKUGUIFacade.MESSAGE_WELCOME);
+
+ try {
+
+ List<STALResponse> responses = handleRequest(Collections.singletonList(new GETHardwareInfoRequest()));
+ handleRequest(Collections.singletonList(new QuitRequest()));
+
+ if (responses.size() == 1) {
+ STALResponse response = responses.get(0);
+ if (response instanceof GETHardwareInfoResponse) {
+ log.debug("hardware-info dialog terminated.");
+ } else if (response instanceof ErrorResponse) {
+ log.debug("hardware-info dialog terminated with error.");
+ } else {
+ throw new RuntimeException("Invalid STAL response: " + response.getClass().getName());
+ }
+ } else {
+ throw new RuntimeException("invalid number of STAL responses: " + responses.size());
+ }
+
+ } catch (RuntimeException 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);
+ showErrorDialog(BKUGUIFacade.ERR_UNKNOWN_WITH_PARAM, ex);
+ } finally {
+ if (signatureCard != null) {
+ signatureCard.disconnect(false);
+ }
+ }
+
+ applet.sendRedirect();
+ }
+
+}
diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/GetCertificateGUI.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/GetCertificateGUI.java
new file mode 100644
index 00000000..3fb0bde4
--- /dev/null
+++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/GetCertificateGUI.java
@@ -0,0 +1,216 @@
+/*
+ * Copyright 2011 by Graz University of Technology, Austria
+ * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint
+ * initiative of the Federal Chancellery Austria and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
+package at.gv.egiz.bku.gui;
+
+import java.awt.Container;
+import java.awt.event.ActionListener;
+import java.io.File;
+import java.net.URL;
+import java.text.MessageFormat;
+import java.util.Locale;
+
+import javax.swing.GroupLayout;
+import javax.swing.JButton;
+import javax.swing.JFileChooser;
+import javax.swing.LayoutStyle;
+import javax.swing.SwingUtilities;
+import javax.swing.filechooser.FileFilter;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import at.gv.egiz.bku.gui.viewer.FontProvider;
+
+/**
+*
+* @author Thomas Lenz <thomas.lenz@iaik.tugraz.at>
+*/
+
+public class GetCertificateGUI extends CardMgmtGUI implements
+ GetCertificateGUIFacade {
+
+ private final Logger log = LoggerFactory.getLogger(GetCertificateGUI.class);
+
+ protected JButton getSimCertButton;
+ protected JButton getQualCertButton;
+
+ public GetCertificateGUI(Container contentPane, Locale locale,
+ URL backgroundImgURL, FontProvider fontProvider,
+ HelpListener helpListener, SwitchFocusListener switchFocusListener) {
+ super(contentPane, locale, Style.advanced, backgroundImgURL, fontProvider,
+ helpListener, switchFocusListener);
+
+
+ }
+
+ @Override
+ public void showGETCertificateDialog(final ActionListener certificateListener,
+ final String showGetQualCert, final String showGetSimCert,
+ final ActionListener cancelListener, final String cancelCmd) {
+
+ SwingUtilities.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+
+ mainPanel.removeAll();
+ buttonPanel.removeAll();
+
+ titleLabel.setText(getMessage(TITLE_GETCERTIFICATE));
+
+ getSimCertButton = new JButton();
+ getSimCertButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle()& ~java.awt.Font.BOLD));
+ getSimCertButton.setText(getMessage(BUTTON_SIM_CERT));
+ getSimCertButton.setActionCommand(showGetSimCert);
+ getSimCertButton.addActionListener(certificateListener);
+ getSimCertButton.setEnabled(true);
+
+ getQualCertButton = new JButton();
+ getQualCertButton.setFont(okButton.getFont().deriveFont(okButton.getFont().getStyle()& ~java.awt.Font.BOLD));
+ getQualCertButton.setText(getMessage(BUTTON_QUAL_CERT));
+ getQualCertButton.setActionCommand(showGetQualCert);
+ getQualCertButton.addActionListener(certificateListener);
+ getQualCertButton.setEnabled(true);
+
+ cancelButton.setFont(cancelButton.getFont().deriveFont(cancelButton.getFont().getStyle()& ~java.awt.Font.BOLD));
+ cancelButton.setText(getMessage(BUTTON_CLOSE));
+ cancelButton.setActionCommand(cancelCmd);
+ cancelButton.addActionListener(cancelListener);
+ cancelButton.setEnabled(true);
+
+ GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
+ buttonPanel.setLayout(buttonPanelLayout);
+
+ //---------------------------------------------------------------------------------------------------------
+
+ GroupLayout mainPanelLayout = new GroupLayout(mainPanel);
+ mainPanelLayout.setHorizontalGroup(
+ mainPanelLayout.createParallelGroup(GroupLayout.Alignment.CENTER)
+ .addGroup(mainPanelLayout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addGroup(GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup()
+ .addComponent(getQualCertButton, GroupLayout.DEFAULT_SIZE,
+ GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGap(12))
+ .addGroup(GroupLayout.Alignment.TRAILING, mainPanelLayout.createSequentialGroup()
+ .addGap(1)
+ .addComponent(getSimCertButton, GroupLayout.DEFAULT_SIZE,
+ getQualCertButton.getSize().width, Short.MAX_VALUE)
+ .addContainerGap())))
+ );
+ mainPanelLayout.setVerticalGroup(
+ mainPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addGroup(mainPanelLayout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(getSimCertButton, GroupLayout.DEFAULT_SIZE, 25, Short.MAX_VALUE)
+ .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(getQualCertButton, GroupLayout.DEFAULT_SIZE, 25, Short.MAX_VALUE)
+ ));
+
+ mainPanel.setLayout(mainPanelLayout);
+ //---------------------------------------------------------------------------------------------------------
+
+
+ GroupLayout.ParallelGroup buttonHorizontal = buttonPanelLayout
+ .createParallelGroup(GroupLayout.Alignment.CENTER)
+ .addComponent(cancelButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE);
+
+ GroupLayout.Group buttonVertical = buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(cancelButton);
+
+ buttonPanelLayout.setHorizontalGroup(buttonHorizontal);
+ buttonPanelLayout.setVerticalGroup(buttonVertical);
+
+
+
+ if (windowCloseAdapter != null) {
+ windowCloseAdapter.registerListener(cancelListener, cancelCmd);
+ }
+
+ contentPanel.validate();
+
+ resize();
+ }
+ });
+ }
+
+ @Override
+ public void resize() {
+
+ log.debug("Resizing Get-Certificate Applet ...");
+
+ float factor = getResizeFactor();
+
+ if (getQualCertButton != null) {
+
+ getQualCertButton.setFont(getQualCertButton.getFont().deriveFont(
+ (float) (baseFontSize * factor)));
+
+ }
+
+ if (getSimCertButton != null) {
+
+ getSimCertButton.setFont(getSimCertButton.getFont().deriveFont(
+ (float) (baseFontSize * factor)));
+
+ }
+
+
+ super.resize();
+ }
+
+ public File showSaveDialog(String defaultfilename) {
+
+
+ JFileChooser filechooser = new JFileChooser();
+
+ filechooser.setMultiSelectionEnabled(false);
+ filechooser.setDialogTitle(getMessage(TITEL_FILESAVE));
+ filechooser.setSelectedFile(new File(defaultfilename));
+ filechooser.setFileFilter( new FileFilter()
+ {
+ @Override public boolean accept( File f )
+ {
+ return f.isDirectory() ||
+ f.getName().toLowerCase().endsWith( ".cer" );
+ }
+ @Override public String getDescription()
+ {
+ return getMessage(FILE_TYPE_NAME);
+ }
+ } );
+
+ int state = filechooser.showSaveDialog(contentPane);
+
+ if (state == JFileChooser.APPROVE_OPTION) {
+ return filechooser.getSelectedFile();
+
+ } else {
+ log.info("Save certificate dialog canceled");
+ return null;
+ }
+ }
+
+}
diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/GetCertificateGUIFacade.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/GetCertificateGUIFacade.java
new file mode 100644
index 00000000..b327f385
--- /dev/null
+++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/GetCertificateGUIFacade.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2011 by Graz University of Technology, Austria
+ * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint
+ * initiative of the Federal Chancellery Austria and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
+package at.gv.egiz.bku.gui;
+
+import java.awt.event.ActionListener;
+import java.io.File;
+
+/**
+*
+* @author Thomas Lenz <thomas.lenz@iaik.tugraz.at>
+*/
+
+public interface GetCertificateGUIFacade extends BKUGUIFacade {
+
+ public static final String BUTTON_SIM_CERT = "button.simple.certificate";
+ public static final String BUTTON_QUAL_CERT = "button.qualified.certificate";
+ public static final String FILE_TYPE_NAME = "file.certificate";
+ public static final String TITEL_FILESAVE = "title.certificate.save";
+ public static final String TITLE_GETCERTIFICATE = "title.get.certificate";
+
+ public static final String FILENAME_QUAL_CERT = "qualified.cer";
+ public static final String FILENAME_SIM_CERT = "simple.cer";
+
+
+ public void showGETCertificateDialog(ActionListener certificateListener, String showGetQualCert,
+ String showGetSimCert, ActionListener cancelListener, String cancelCmd);
+
+ public File showSaveDialog(String defaultfilename);
+
+}
diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/GetHardwareInfoGUI.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/GetHardwareInfoGUI.java
new file mode 100644
index 00000000..1088545d
--- /dev/null
+++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/GetHardwareInfoGUI.java
@@ -0,0 +1,306 @@
+/*
+ * Copyright 2011 by Graz University of Technology, Austria
+ * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint
+ * initiative of the Federal Chancellery Austria and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
+package at.gv.egiz.bku.gui;
+
+import java.awt.Container;
+import java.awt.Font;
+import java.awt.event.ActionListener;
+import java.net.URL;
+import java.util.Locale;
+
+import javax.swing.GroupLayout;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.LayoutStyle.ComponentPlacement;
+import javax.swing.SwingConstants;
+import javax.swing.SwingUtilities;
+import javax.swing.border.TitledBorder;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import at.gv.egiz.bku.gui.viewer.FontProvider;
+
+/**
+*
+* @author Thomas Lenz <thomas.lenz@iaik.tugraz.at>
+*/
+
+public class GetHardwareInfoGUI extends CardMgmtGUI implements
+ GetHardwareInfoGUIFacade {
+
+ private final Logger log = LoggerFactory.getLogger(GetHardwareInfoGUI.class);
+
+ protected JLabel lblTyp;
+ protected JLabel lblAtr;
+ protected JLabel lblNewLabel;
+ protected JLabel lblNewLabel_1;
+ protected JLabel lblNewLabel_2;
+ protected JPanel cardpanel;
+ protected JPanel readerpanel;
+ protected TitledBorder readerpanel_border;
+ protected TitledBorder cardpanel_border;
+
+
+ public GetHardwareInfoGUI(Container contentPane, Locale locale,
+ URL backgroundImgURL, FontProvider fontProvider,
+ HelpListener helpListener, SwitchFocusListener switchFocusListener) {
+ super(contentPane, locale, Style.advanced, backgroundImgURL, fontProvider,
+ helpListener, switchFocusListener);
+ }
+
+
+ @Override
+ public void showHardwareInfoDialog(final ActionListener hardwareinfolistener, final String backcmd,
+ final String showcardreadername, final String showsmartcardname,
+ final String showsmartcardATR) {
+
+ SwingUtilities.invokeLater(new Runnable() {
+
+ @Override
+ public void run() {
+
+ headerPanel.removeAll();
+ mainPanel.removeAll();
+ buttonPanel.removeAll();
+
+ backButton.setFont(backButton.getFont().deriveFont(backButton.getFont().getStyle()& ~java.awt.Font.BOLD));
+ backButton.setText(getMessage(BUTTON_BACK));
+ backButton.setActionCommand(backcmd);
+ backButton.addActionListener(hardwareinfolistener);
+ backButton.setEnabled(true);
+
+ //------------------------------------------------------------------------------------
+
+ readerpanel_border = new TitledBorder(null, getMessage(LABEL_CARDREADER), TitledBorder.LEADING, TitledBorder.TOP, null, null);
+ readerpanel_border.setTitleFont(readerpanel_border.getTitleFont().deriveFont(
+ readerpanel_border.getTitleFont().getStyle()
+ & java.awt.Font.BOLD));
+ readerpanel = new JPanel();
+ readerpanel.setBorder(readerpanel_border);
+
+
+
+ cardpanel_border = new TitledBorder(null, getMessage(LABEL_SMARTCARD), TitledBorder.LEADING, TitledBorder.TOP, null, null);
+ cardpanel_border.setTitleFont(cardpanel_border.getTitleFont().deriveFont(
+ cardpanel_border.getTitleFont().getStyle()
+ & java.awt.Font.BOLD));
+ cardpanel = new JPanel();
+ cardpanel.setBorder(cardpanel_border);
+ cardpanel.setFont(cardpanel.getFont().deriveFont(
+ cardpanel.getFont().getStyle()
+ & java.awt.Font.BOLD));
+
+ GroupLayout gl_contentPane = new GroupLayout(mainPanel);
+ gl_contentPane.setHorizontalGroup(
+ gl_contentPane.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addGroup(gl_contentPane.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(gl_contentPane.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(cardpanel, GroupLayout.DEFAULT_SIZE, 298, Short.MAX_VALUE)
+ .addComponent(readerpanel, GroupLayout.DEFAULT_SIZE, 298, Short.MAX_VALUE)))
+ );
+ gl_contentPane.setVerticalGroup(
+ gl_contentPane.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addGroup(gl_contentPane.createSequentialGroup()
+ .addComponent(readerpanel, GroupLayout.DEFAULT_SIZE, 45, Short.MAX_VALUE)
+ .addGap(8)
+ .addComponent(cardpanel, GroupLayout.PREFERRED_SIZE, 89, Short.MAX_VALUE)
+ .addContainerGap())
+ );
+
+ lblTyp = new JLabel(getMessage(LABEL_SMARTCARD_TYPE));
+ lblTyp.setFont(lblTyp.getFont().deriveFont(
+ lblTyp.getFont().getStyle()
+ & java.awt.Font.BOLD));
+
+
+ lblAtr = new JLabel(getMessage(LABEL_SMARTCARD_ATR));
+ lblAtr.setFont(lblAtr.getFont().deriveFont(
+ lblAtr.getFont().getStyle()
+ & java.awt.Font.BOLD));
+
+ lblNewLabel_1 = new JLabel(showsmartcardname);
+ lblNewLabel_1.setFont(lblNewLabel_1.getFont().deriveFont(
+ lblNewLabel_1.getFont().getStyle()
+ & ~java.awt.Font.BOLD));
+
+
+ lblNewLabel_2 = new JLabel(makeATRString(showsmartcardATR, 40));
+ lblNewLabel_2.setVerticalAlignment(SwingConstants.CENTER);
+ lblNewLabel_2.setFont(lblNewLabel_2.getFont().deriveFont(
+ lblNewLabel_2.getFont().getStyle()
+ & ~java.awt.Font.BOLD));
+
+ GroupLayout gl_cardpanel = new GroupLayout(cardpanel);
+ gl_cardpanel.setHorizontalGroup(
+ gl_cardpanel.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addGroup(gl_cardpanel.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(gl_cardpanel.createParallelGroup(GroupLayout.Alignment.TRAILING)
+ .addComponent(lblTyp, GroupLayout.DEFAULT_SIZE, 31, Short.MAX_VALUE)
+ .addComponent(lblAtr, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addPreferredGap(ComponentPlacement.UNRELATED)
+ .addGroup(gl_cardpanel.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(lblNewLabel_1, GroupLayout.DEFAULT_SIZE, 236, Short.MAX_VALUE)
+ .addComponent(lblNewLabel_2, GroupLayout.DEFAULT_SIZE, 233, Short.MAX_VALUE)))
+ );
+ gl_cardpanel.setVerticalGroup(
+ gl_cardpanel.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addGroup(gl_cardpanel.createSequentialGroup()
+ .addGroup(gl_cardpanel.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addGroup(gl_cardpanel.createSequentialGroup()
+ .addGap(2)
+ .addComponent(lblTyp, GroupLayout.DEFAULT_SIZE, 21, Short.MAX_VALUE))
+ .addComponent(lblNewLabel_1, GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE))
+ .addPreferredGap(ComponentPlacement.RELATED)
+ .addGroup(gl_cardpanel.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(lblNewLabel_2, GroupLayout.DEFAULT_SIZE, 36, Short.MAX_VALUE)
+ .addGroup(gl_cardpanel.createSequentialGroup()
+ .addComponent(lblAtr, GroupLayout.DEFAULT_SIZE, 30, Short.MAX_VALUE)
+ .addGap(6)))
+ .addGap(3))
+ );
+ cardpanel.setLayout(gl_cardpanel);
+
+ lblNewLabel = new JLabel(showcardreadername);
+ lblNewLabel.setVerticalAlignment(SwingConstants.CENTER);
+ lblNewLabel.setFont(lblNewLabel.getFont().deriveFont(
+ lblNewLabel.getFont().getStyle()
+ & ~java.awt.Font.BOLD));
+
+ GroupLayout gl_readerpanel = new GroupLayout(readerpanel);
+ gl_readerpanel.setHorizontalGroup(
+ gl_readerpanel.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addGroup(gl_readerpanel.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(lblNewLabel, GroupLayout.PREFERRED_SIZE, 276, Short.MAX_VALUE))
+ );
+ gl_readerpanel.setVerticalGroup(
+ gl_readerpanel.createParallelGroup(GroupLayout.Alignment.LEADING)
+ .addComponent(lblNewLabel, GroupLayout.DEFAULT_SIZE, 15, Short.MAX_VALUE)
+ );
+ readerpanel.setLayout(gl_readerpanel);
+ mainPanel.setLayout(gl_contentPane);
+
+ //------------------------------------------------------------------------------------
+
+ GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
+ buttonPanel.setLayout(buttonPanelLayout);
+
+ GroupLayout.ParallelGroup buttonHorizontal = buttonPanelLayout
+ .createParallelGroup(GroupLayout.Alignment.CENTER)
+ .addComponent(backButton, GroupLayout.PREFERRED_SIZE, buttonSize, GroupLayout.PREFERRED_SIZE);
+
+ GroupLayout.Group buttonVertical = buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
+ .addComponent(backButton);
+
+
+ buttonPanelLayout.setHorizontalGroup(buttonHorizontal);
+ buttonPanelLayout.setVerticalGroup(buttonVertical);
+
+
+ if (windowCloseAdapter != null) {
+ windowCloseAdapter.registerListener(hardwareinfolistener, backcmd);
+ }
+
+ contentPanel.validate();
+
+ resize();
+ }
+ });
+ }
+
+ @Override
+ public void resize() {
+
+ log.debug("Resizing Hardware-Info Applet ...");
+
+ float factor = getResizeFactor();
+
+
+ if (lblTyp != null) {
+ lblTyp.setFont(lblTyp.getFont().deriveFont(
+ (float) ((baseFontSize - 2)* factor)));
+ }
+
+ if (lblAtr != null) {
+ lblAtr.setFont(lblAtr.getFont().deriveFont(
+ (float) ((baseFontSize - 2)* factor)));
+ }
+
+ if (lblNewLabel != null) {
+ lblNewLabel.setFont(lblNewLabel.getFont().deriveFont(
+ (float) ((baseFontSize - 2)* factor)));
+ }
+
+ if (lblNewLabel_1 != null) {
+ lblNewLabel_1.setFont(lblNewLabel_1.getFont().deriveFont(
+ (float) ((baseFontSize - 2)* factor)));
+ }
+
+ if (lblNewLabel_2 != null) {
+ lblNewLabel_2.setFont(lblNewLabel_2.getFont().deriveFont(
+ (float) ((baseFontSize - 2)* factor)));
+ }
+
+ if (cardpanel_border != null) {
+ cardpanel_border.setTitleFont(cardpanel_border.getTitleFont().deriveFont(
+ (float) ((baseFontSize)* factor)));
+ }
+
+ if (readerpanel_border != null) {
+ readerpanel_border.setTitleFont(readerpanel_border.getTitleFont().deriveFont(
+ (float) ((baseFontSize)* factor)));
+ }
+
+ if (backButton != null) {
+
+ backButton.setFont(backButton.getFont().deriveFont(
+ (float) (baseFontSize * factor)));
+
+ }
+
+ super.resize();
+ }
+
+ private String makeATRString(String ATR, int width) {
+
+ String line = new String();
+
+ if (ATR.length() > width) {
+
+ line = line.concat("<html><body>");
+ line = line.concat(ATR.substring(1, width));
+ line = line.concat("<br>");
+ line = line.concat(ATR.substring(width,ATR.length()-1));
+ line = line.concat("</body></html>");
+
+ return line;
+ }
+ else
+ return ATR;
+ }
+
+}
diff --git a/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/GetHardwareInfoGUIFacade.java b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/GetHardwareInfoGUIFacade.java
new file mode 100644
index 00000000..c121417e
--- /dev/null
+++ b/BKUGuiExt/src/main/java/at/gv/egiz/bku/gui/GetHardwareInfoGUIFacade.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2011 by Graz University of Technology, Austria
+ * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint
+ * initiative of the Federal Chancellery Austria and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
+package at.gv.egiz.bku.gui;
+
+import java.awt.event.ActionListener;
+
+/**
+*
+* @author Thomas Lenz <thomas.lenz@iaik.tugraz.at>
+*/
+
+public interface GetHardwareInfoGUIFacade extends BKUGUIFacade {
+
+ public static final String LABEL_CARDREADER = "label.hardwareinfo.cardreader";
+ public static final String LABEL_SMARTCARD = "label.hardwareinfo.smartcard";
+ public static final String LABEL_SMARTCARD_TYPE = "label.hardwareinfo.smartcard.type";
+ public static final String LABEL_SMARTCARD_ATR = "label.hardwareinfo.smartcard.atr";
+
+ public void showHardwareInfoDialog(final ActionListener hardwareinfolistener, final String backcmd, final String showcardreadername,
+ final String showsmartcardname, final String showsmartcardATR);
+
+}
diff --git a/BKUGuiExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties b/BKUGuiExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties
index a5e582a1..eefd451b 100644
--- a/BKUGuiExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties
+++ b/BKUGuiExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages.properties
@@ -29,6 +29,8 @@ title.activate.success=<html>Success</html>
title.change.success=<html>Success</html>
title.unblock.success=<html>Success</html>
title.identity=<html>Person Identity Link</html>
+title.certificate.save=Save certificate
+title.get.certificate=Save certificates
# removed message.* prefix to reuse keys as help keys
pin.mgmt=<html>{0} PINs available
@@ -69,11 +71,21 @@ label.puk=<html>{0} PUK:</html>
label.new.pin=<html>New {0}:</html>
label.repeat.pin=<html>Confirmation:</html>
+label.hardwareinfo.cardreader = Cardreader
+label.hardwareinfo.smartcard = Smartcard
+label.hardwareinfo.smartcard.type = Type:
+label.hardwareinfo.smartcard.atr = ATR:
+
+file.certificate = Certificate
+
button.activate=Activate
button.change=Change
button.unblock=Unblock
button.verify=Query
+button.qualified.certificate = qualified certificate
+button.simple.certificate = basic certificate
+
help.activation=help.activation
help.pin.mgmt=help.pin.mgmt
diff --git a/BKUGuiExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_de.properties b/BKUGuiExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_de.properties
index 1935d31b..30a80e6f 100644
--- a/BKUGuiExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_de.properties
+++ b/BKUGuiExt/src/main/resources/at/gv/egiz/bku/gui/ActivationMessages_de.properties
@@ -35,6 +35,8 @@ identity.button=<html>Abbrechen</html>
identity.firstname=<html>Vorname</html>
identity.dateofbirth=<html>Geburtsdatum</html>
identity.lastname=<html>Nachname</html>
+title.certificate.save=Zertifikat speichern
+title.get.certificate=Zertifikate speichern
# removed message.* prefix to reuse keys as help keys
pin.mgmt=<html>Die Karte verf\u00FCgt \u00FCber {0} PINs</html>
@@ -69,11 +71,21 @@ label.puk=<html>{0} PUK:</html>
label.new.pin=<html>Neue {0}:</html>
label.repeat.pin=<html>Best\u00E4tigung:</html>
+label.hardwareinfo.cardreader = Kartenlesegerät
+label.hardwareinfo.smartcard = Chipkarte
+label.hardwareinfo.smartcard.type = Typ:
+label.hardwareinfo.smartcard.atr = ATR:
+
+file.certificate = Zertifikat
+
button.activate=Aktivieren
button.change=\u00C4ndern
button.unblock=Entsperren
button.verify=Abfragen
+button.qualified.certificate = Qualifiziertes Zertifikat
+button.simple.certificate = Einfaches Zertifikat
+
help.activation=help.activation
help.pin.mgmt=help.pin.mgmt
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalBKUWorker.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalBKUWorker.java
index c41ac234..27a5d8ca 100644
--- a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalBKUWorker.java
+++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalBKUWorker.java
@@ -26,6 +26,8 @@ package at.gv.egiz.bku.local.stal;
import at.gv.egiz.bku.gui.BKUGUIFacade;
import at.gv.egiz.bku.smccstal.AbstractBKUWorker;
+import at.gv.egiz.bku.smccstal.GETCertificateRequestHandler;
+import at.gv.egiz.bku.smccstal.GETHardwareInfoRequestHandler;
import at.gv.egiz.bku.smccstal.PINManagementRequestHandler;
import at.gv.egiz.bku.smccstal.PersonIdentityLinkRequestHandler;
import at.gv.egiz.stal.QuitRequest;
@@ -34,6 +36,8 @@ import at.gv.egiz.stal.STALResponse;
import at.gv.egiz.stal.SignRequest;
import at.gv.egiz.stal.ext.PersonIdentityLinkRequest;
+import at.gv.egiz.stal.ext.GETCertificateRequest;
+import at.gv.egiz.stal.ext.GETHardwareInfoRequest;
import at.gv.egiz.stal.ext.PINManagementRequest;
import java.util.List;
import javax.swing.JFrame;
@@ -53,6 +57,8 @@ public class LocalBKUWorker extends AbstractBKUWorker {
new LocalSignRequestHandler(new LocalSecureViewer(gui)));
addRequestHandler(PINManagementRequest.class, new PINManagementRequestHandler());
addRequestHandler(PersonIdentityLinkRequest.class, new PersonIdentityLinkRequestHandler());
+ addRequestHandler(GETCertificateRequest.class, new GETCertificateRequestHandler());
+ addRequestHandler(GETHardwareInfoRequest.class, new GETHardwareInfoRequestHandler());
}
/** does not change container's visibility (use quit request to close) */
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalGETCertificateSTALFactory.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalGETCertificateSTALFactory.java
new file mode 100644
index 00000000..50c6c632
--- /dev/null
+++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalGETCertificateSTALFactory.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright 2011 by Graz University of Technology, Austria
+ * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint
+ * initiative of the Federal Chancellery Austria and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
+package at.gv.egiz.bku.local.stal;
+
+import at.gv.egiz.bku.viewer.ResourceFontLoader;
+import java.awt.Dimension;
+import java.awt.Toolkit;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Locale;
+
+
+import at.gv.egiz.bku.gui.BKUGUIFacade;
+import at.gv.egiz.bku.gui.BKUIcons;
+import at.gv.egiz.bku.gui.GetCertificateGUI;
+import at.gv.egiz.bku.gui.GetCertificateGUIFacade;
+import at.gv.egiz.bku.local.gui.GUIProxy;
+import at.gv.egiz.bku.local.gui.LocalHelpListener;
+import at.gv.egiz.stal.STAL;
+import at.gv.egiz.stal.STALFactory;
+import javax.swing.JFrame;
+
+import org.apache.commons.configuration.Configuration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+*
+* @author Thomas Lenz <thomas.lenz@iaik.tugraz.at>
+*/
+
+public class LocalGETCertificateSTALFactory implements STALFactory {
+
+ private final Logger log = LoggerFactory.getLogger(LocalGETCertificateSTALFactory.class);
+ protected static final Dimension PREFERRED_SIZE = new Dimension(318, 200);
+ protected URL helpURL;
+ protected Locale locale;
+
+ protected Configuration configuration;
+
+ @Override
+ public STAL createSTAL() {
+ final LocalBKUWorker stal;
+ //http://java.sun.com/docs/books/tutorial/uiswing/misc/focus.html
+ // use undecorated JFrame instead of JWindow,
+ // which creates an invisible owning frame and therefore cannot getFocusInWindow()
+ JFrame dialog = new JFrame("Bürgerkarte");
+ log.debug("AlwaysOnTop supported: {}.", dialog.isAlwaysOnTopSupported());
+ // [#439] make mocca dialog alwaysOnTop
+ dialog.setAlwaysOnTop(true);
+ dialog.setIconImages(BKUIcons.icons);
+// dialog.setUndecorated(true);
+// dialog.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
+
+ if (locale != null) {
+ dialog.setLocale(locale);
+ }
+ LocalHelpListener helpListener = null;
+ if (helpURL != null) {
+ helpListener = new LocalHelpListener(helpURL, locale);
+ } else {
+ log.warn("No HELP URL configured, help system disabled.");
+ }
+ GetCertificateGUIFacade gui = new GetCertificateGUI(dialog.getContentPane(),
+ dialog.getLocale(),
+ null,
+ new ResourceFontLoader(),
+ helpListener,
+ null);
+ BKUGUIFacade proxy = (BKUGUIFacade) GUIProxy.newInstance(gui, dialog, new Class[] { GetCertificateGUIFacade.class, } );
+ stal = new LocalBKUWorker(proxy, dialog);
+ dialog.setPreferredSize(PREFERRED_SIZE);
+ dialog.pack();
+ Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+ Dimension frameSize = dialog.getSize();
+ if (frameSize.height > screenSize.height) {
+ frameSize.height = screenSize.height;
+ }
+ if (frameSize.width > screenSize.width) {
+ frameSize.width = screenSize.width;
+ }
+ dialog.setLocation((screenSize.width - frameSize.width) / 2,
+ (screenSize.height - frameSize.height) / 2);
+
+ return stal;
+ }
+
+ @Override
+ public void setLocale(Locale locale) {
+ this.locale = locale;
+ }
+
+ /**
+ * spring injects helpURL
+ * @param helpURL
+ * @throws MalformedURLException if helpURL is not a valid URL
+ */
+ public void setHelpURL(String helpURL) throws MalformedURLException {
+ this.helpURL = new URL(helpURL);
+ }
+
+ /**
+ * @return the configuration
+ */
+ public Configuration getConfiguration() {
+ return configuration;
+ }
+
+ /**
+ * @param configuration the configuration to set
+ */
+ public void setConfiguration(Configuration configuration) {
+ this.configuration = configuration;
+ }
+}
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalGetHardwareInfoSTALFactory.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalGetHardwareInfoSTALFactory.java
new file mode 100644
index 00000000..1caccf6f
--- /dev/null
+++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/stal/LocalGetHardwareInfoSTALFactory.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright 2011 by Graz University of Technology, Austria
+ * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint
+ * initiative of the Federal Chancellery Austria and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
+package at.gv.egiz.bku.local.stal;
+
+import java.awt.Dimension;
+import java.awt.Toolkit;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Locale;
+
+import javax.swing.JFrame;
+
+import org.apache.commons.configuration.Configuration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import at.gv.egiz.bku.gui.BKUGUIFacade;
+import at.gv.egiz.bku.gui.BKUIcons;
+import at.gv.egiz.bku.gui.GetHardwareInfoGUI;
+import at.gv.egiz.bku.gui.GetHardwareInfoGUIFacade;
+import at.gv.egiz.bku.local.gui.GUIProxy;
+import at.gv.egiz.bku.local.gui.LocalHelpListener;
+import at.gv.egiz.bku.viewer.ResourceFontLoader;
+import at.gv.egiz.stal.STAL;
+import at.gv.egiz.stal.STALFactory;
+
+/**
+*
+* @author Thomas Lenz <thomas.lenz@iaik.tugraz.at>
+*/
+
+public class LocalGetHardwareInfoSTALFactory implements STALFactory {
+
+ private final Logger log = LoggerFactory.getLogger(LocalGetHardwareInfoSTALFactory.class);
+ protected static final Dimension PREFERRED_SIZE = new Dimension(320, 270);
+ protected URL helpURL;
+ protected Locale locale;
+
+ protected Configuration configuration;
+
+ @Override
+ public STAL createSTAL() {
+ final LocalBKUWorker stal;
+ //http://java.sun.com/docs/books/tutorial/uiswing/misc/focus.html
+ // use undecorated JFrame instead of JWindow,
+ // which creates an invisible owning frame and therefore cannot getFocusInWindow()
+ JFrame dialog = new JFrame("Bürgerkarte");
+ log.debug("AlwaysOnTop supported: {}.", dialog.isAlwaysOnTopSupported());
+ // [#439] make mocca dialog alwaysOnTop
+ dialog.setAlwaysOnTop(true);
+ dialog.setIconImages(BKUIcons.icons);
+// dialog.setUndecorated(true);
+// dialog.getRootPane().setWindowDecorationStyle(JRootPane.NONE);
+
+ if (locale != null) {
+ dialog.setLocale(locale);
+ }
+ LocalHelpListener helpListener = null;
+ if (helpURL != null) {
+ helpListener = new LocalHelpListener(helpURL, locale);
+ } else {
+ log.warn("No HELP URL configured, help system disabled.");
+ }
+ GetHardwareInfoGUIFacade gui = new GetHardwareInfoGUI(dialog.getContentPane(),
+ dialog.getLocale(),
+ null,
+ new ResourceFontLoader(),
+ helpListener,
+ null);
+ BKUGUIFacade proxy = (BKUGUIFacade) GUIProxy.newInstance(gui, dialog, new Class[] { GetHardwareInfoGUIFacade.class, } );
+ stal = new LocalBKUWorker(proxy, dialog);
+ dialog.setPreferredSize(PREFERRED_SIZE);
+ dialog.pack();
+ Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+ Dimension frameSize = dialog.getSize();
+ if (frameSize.height > screenSize.height) {
+ frameSize.height = screenSize.height;
+ }
+ if (frameSize.width > screenSize.width) {
+ frameSize.width = screenSize.width;
+ }
+ dialog.setLocation((screenSize.width - frameSize.width) / 2,
+ (screenSize.height - frameSize.height) / 2);
+
+ return stal;
+ }
+
+ @Override
+ public void setLocale(Locale locale) {
+ this.locale = locale;
+ }
+
+ /**
+ * spring injects helpURL
+ * @param helpURL
+ * @throws MalformedURLException if helpURL is not a valid URL
+ */
+ public void setHelpURL(String helpURL) throws MalformedURLException {
+ this.helpURL = new URL(helpURL);
+ }
+
+ /**
+ * @return the configuration
+ */
+ public Configuration getConfiguration() {
+ return configuration;
+ }
+
+ /**
+ * @param configuration the configuration to set
+ */
+ public void setConfiguration(Configuration configuration) {
+ this.configuration = configuration;
+ }
+}
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/GETCertificateServlet.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/GETCertificateServlet.java
new file mode 100644
index 00000000..d23937f9
--- /dev/null
+++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/GETCertificateServlet.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright 2011 by Graz University of Technology, Austria
+ * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint
+ * initiative of the Federal Chancellery Austria and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
+package at.gv.egiz.bku.local.webapp;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Collections;
+import java.util.List;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import at.gv.egiz.bku.local.stal.LocalGETCertificateSTALFactory;
+import at.gv.egiz.stal.QuitRequest;
+import at.gv.egiz.stal.STAL;
+import at.gv.egiz.stal.STALResponse;
+import at.gv.egiz.stal.ext.GETCertificateRequest;
+
+/**
+*
+* @author Thomas Lenz <thomas.lenz@iaik.tugraz.at>
+*/
+
+public class GETCertificateServlet extends HttpServlet {
+ private static final long serialVersionUID = 1L;
+
+ private final Logger log = LoggerFactory.getLogger(GETCertificateServlet.class);
+
+ LocalGETCertificateSTALFactory stalFactory;
+
+ public GETCertificateServlet() {
+ log.debug("Constuctor: " + GETCertificateServlet.class);
+ stalFactory = new LocalGETCertificateSTALFactory();
+ try {
+ stalFactory.setHelpURL("http://localhost:3495/help/");
+ } catch (MalformedURLException e) {
+ log.info("Failed to set help URL.", e);
+ }
+ }
+
+ /**
+ * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
+ * @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet-specific error occurs
+ * @throws IOException if an I/O error occurs
+ */
+ protected void processRequest(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+
+ STAL getCerTificateSTAL = stalFactory.createSTAL();
+
+ List<STALResponse> stalResps = getCerTificateSTAL.handleRequest(Collections.singletonList(new GETCertificateRequest()));
+
+ log.debug("Received STAL reponse {}.", stalResps.get(0).getClass());
+
+ getCerTificateSTAL.handleRequest(Collections.singletonList(new QuitRequest()));
+
+ String redirect = request.getParameter("redirect");
+ if (redirect != null) {
+ String referer = request.getHeader("Referer");
+ if (referer != null) {
+ redirect = new URL(new URL(referer), redirect).toExternalForm();
+ }
+ response.sendRedirect(redirect);
+ } else {
+ response.setStatus(HttpServletResponse.SC_OK);
+ }
+ }
+
+ // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
+ /**
+ * Handles the HTTP <code>GET</code> method.
+ * @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet-specific error occurs
+ * @throws IOException if an I/O error occurs
+ */
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ processRequest(request, response);
+ }
+
+ /**
+ * Handles the HTTP <code>POST</code> method.
+ * @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet-specific error occurs
+ * @throws IOException if an I/O error occurs
+ */
+ @Override
+ protected void doPost(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ processRequest(request, response);
+ }
+
+ /**
+ * Returns a short description of the servlet.
+ * @return a String containing servlet description
+ */
+ @Override
+ public String getServletInfo() {
+ return "Short description";
+ }
+}
diff --git a/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/GetHardwareInfoServlet.java b/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/GetHardwareInfoServlet.java
new file mode 100644
index 00000000..dc7762a8
--- /dev/null
+++ b/BKULocal/src/main/java/at/gv/egiz/bku/local/webapp/GetHardwareInfoServlet.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright 2011 by Graz University of Technology, Austria
+ * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint
+ * initiative of the Federal Chancellery Austria and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
+package at.gv.egiz.bku.local.webapp;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Collections;
+import java.util.List;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import at.gv.egiz.bku.local.stal.LocalGetHardwareInfoSTALFactory;
+import at.gv.egiz.stal.QuitRequest;
+import at.gv.egiz.stal.STAL;
+import at.gv.egiz.stal.STALResponse;
+import at.gv.egiz.stal.ext.GETHardwareInfoRequest;
+
+/**
+*
+* @author Thomas Lenz <thomas.lenz@iaik.tugraz.at>
+*/
+
+public class GetHardwareInfoServlet extends HttpServlet {
+ private static final long serialVersionUID = 1L;
+
+ private final Logger log = LoggerFactory.getLogger(GetHardwareInfoServlet.class);
+
+ LocalGetHardwareInfoSTALFactory stalFactory;
+
+ public GetHardwareInfoServlet() {
+ log.debug("Constuctor: " + GetHardwareInfoServlet.class);
+ stalFactory = new LocalGetHardwareInfoSTALFactory();
+ try {
+ stalFactory.setHelpURL("http://localhost:3495/help/");
+ } catch (MalformedURLException e) {
+ log.info("Failed to set help URL.", e);
+ }
+ }
+
+ /**
+ * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
+ * @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet-specific error occurs
+ * @throws IOException if an I/O error occurs
+ */
+ protected void processRequest(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+
+ STAL getHardwareInfoSTAL = stalFactory.createSTAL();
+
+ List<STALResponse> stalResps = getHardwareInfoSTAL.handleRequest(Collections.singletonList(new GETHardwareInfoRequest()));
+
+ log.debug("Received STAL reponse {}.", stalResps.get(0).getClass());
+
+ getHardwareInfoSTAL.handleRequest(Collections.singletonList(new QuitRequest()));
+
+ String redirect = request.getParameter("redirect");
+ if (redirect != null) {
+ String referer = request.getHeader("Referer");
+ if (referer != null) {
+ redirect = new URL(new URL(referer), redirect).toExternalForm();
+ }
+ response.sendRedirect(redirect);
+ } else {
+ response.setStatus(HttpServletResponse.SC_OK);
+ }
+ }
+
+ // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
+ /**
+ * Handles the HTTP <code>GET</code> method.
+ * @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet-specific error occurs
+ * @throws IOException if an I/O error occurs
+ */
+ @Override
+ protected void doGet(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ processRequest(request, response);
+ }
+
+ /**
+ * Handles the HTTP <code>POST</code> method.
+ * @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet-specific error occurs
+ * @throws IOException if an I/O error occurs
+ */
+ @Override
+ protected void doPost(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException {
+ processRequest(request, response);
+ }
+
+ /**
+ * Returns a short description of the servlet.
+ * @return a String containing servlet description
+ */
+ @Override
+ public String getServletInfo() {
+ return "Short description";
+ }
+}
diff --git a/BKULocal/src/main/webapp/WEB-INF/web.xml b/BKULocal/src/main/webapp/WEB-INF/web.xml
index 628bb044..41d5ab37 100644
--- a/BKULocal/src/main/webapp/WEB-INF/web.xml
+++ b/BKULocal/src/main/webapp/WEB-INF/web.xml
@@ -51,6 +51,14 @@
<servlet-name>IdentityLinkServlet</servlet-name>
<servlet-class>at.gv.egiz.bku.local.webapp.IdentityLinkServlet</servlet-class>
</servlet>
+ <servlet>
+ <servlet-name>GETCertificateServlet</servlet-name>
+ <servlet-class>at.gv.egiz.bku.local.webapp.GETCertificateServlet</servlet-class>
+ </servlet>
+ <servlet>
+ <servlet-name>GETHardwareInfoServlet</servlet-name>
+ <servlet-class>at.gv.egiz.bku.local.webapp.GetHardwareInfoServlet</servlet-class>
+ </servlet>
<servlet-mapping>
<servlet-name>BKUServlet</servlet-name>
<url-pattern>/http-security-layer-request</url-pattern>
@@ -60,7 +68,6 @@
<url-pattern>/https-security-layer-request</url-pattern>
</servlet-mapping>
<!-- Begin BKU Config -->
-
<servlet-mapping>
<servlet-name>PINManagementServlet</servlet-name>
<url-pattern>/PINManagement</url-pattern>
@@ -69,6 +76,14 @@
<servlet-name>IdentityLinkServlet</servlet-name>
<url-pattern>/IdentityLink</url-pattern>
</servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>GETCertificateServlet</servlet-name>
+ <url-pattern>/GETCertificate</url-pattern>
+ </servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>GETHardwareInfoServlet</servlet-name>
+ <url-pattern>/GETHardwareinfo</url-pattern>
+ </servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
diff --git a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/MoccaParameterBean.java b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/MoccaParameterBean.java
index b507ea70..e6a79e97 100644
--- a/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/MoccaParameterBean.java
+++ b/BKUOnline/src/main/java/at/gv/egiz/bku/online/webapp/MoccaParameterBean.java
@@ -61,7 +61,8 @@ public class MoccaParameterBean {
public static final String[] VALUES_APPLET_GUI_STYLE = new String[] {"tiny", "simple", "advanced"};
public static final String PARAM_APPLET_EXTENSION = "appletExtension";
- public static final String[] VALUES_APPLET_EXTENSION = new String[] {"pin", "activation", "identity"};
+ public static final String[] VALUES_APPLET_EXTENSION = new String[] {"pin", "activation",
+ "getcertificate", "hardwareinfo", "identity"};
public static final String PARAM_LOCALE = "locale";
public static final Pattern PATTERN_LOCALE = Pattern.compile("[a-zA-Z][a-zA-Z](_[a-zA-Z][a-zA-Z]){0,2}");
diff --git a/BKUOnline/src/main/webapp/SLRequestForm.html b/BKUOnline/src/main/webapp/SLRequestForm.html
index fb910264..cdfc4508 100644
--- a/BKUOnline/src/main/webapp/SLRequestForm.html
+++ b/BKUOnline/src/main/webapp/SLRequestForm.html
@@ -200,11 +200,13 @@
<label for="appletPage">Locale</label>
<input value="de_AT" name="locale"/>
</p>
+
<p>
<label for="appletExtension">Extensions</label>
<input type="radio" name="appletExtension" value="pin" onclick="setAppletDimension(295, 235)">PIN Management Applet
<input type="radio" name="appletExtension" value="identity" onclick="setAppletDimension(295, 235)">Identity Link Applet
- <!--<input type="checkbox" name="appletExtension" value="pin" onclick="setAppletDimension(295, 235)">PIN Management Applet-->
+ <input type="radio" name="appletExtension" value="getcertificate" onclick="setAppletDimension(295, 235)">Get Certificate Applet
+ <input type="radio" name="appletExtension" value="hardwareinfo" onclick="setAppletDimension(295, 235)">Hardwareinfo Applet
</p>
<!--
diff --git a/BKUOnline/src/main/webapp/applet.jsp b/BKUOnline/src/main/webapp/applet.jsp
index bf657a9e..f6b07e7f 100644
--- a/BKUOnline/src/main/webapp/applet.jsp
+++ b/BKUOnline/src/main/webapp/applet.jsp
@@ -65,6 +65,14 @@
<c:set var="appletArchive" value="BKUAppletExt-single.jar"/>
<c:set var="appletClass" value="at.gv.egiz.bku.online.applet.IdentityLinkApplet.class"/>
</c:when>
+ <c:when test="${requestScope.moccaParam.extension == 'getcertificate'}">
+ <c:set var="appletArchive" value="BKUAppletExt-single.jar"/>
+ <c:set var="appletClass" value="at.gv.egiz.bku.online.applet.GETCertificateApplet.class"/>
+ </c:when>
+ <c:when test="${requestScope.moccaParam.extension == 'hardwareinfo'}">
+ <c:set var="appletArchive" value="BKUAppletExt-single.jar"/>
+ <c:set var="appletClass" value="at.gv.egiz.bku.online.applet.HardwareInfoApplet.class"/>
+ </c:when>
<c:otherwise>
<c:set var="appletArchive" value="BKUApplet-single.jar"/>
<c:set var="appletClass" value="at.gv.egiz.bku.online.applet.BKUApplet.class"/>
diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/GetCertificateInvoker.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/GetCertificateInvoker.java
new file mode 100644
index 00000000..888206a6
--- /dev/null
+++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/GetCertificateInvoker.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2011 by Graz University of Technology, Austria
+ * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint
+ * initiative of the Federal Chancellery Austria and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
+package at.gv.egiz.bku.webstart;
+
+import java.io.IOException;
+import java.net.HttpURLConnection;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import at.gv.egiz.bku.webstart.gui.StatusNotifier;
+
+/**
+*
+* @author Thomas Lenz <thomas.lenz@iaik.tugraz.at>
+*/
+
+public class GetCertificateInvoker implements Runnable {
+
+ private static final Logger log = LoggerFactory.getLogger(GetCertificateInvoker.class);
+
+ StatusNotifier status;
+
+ public GetCertificateInvoker(StatusNotifier status) {
+ this.status = status;
+ }
+
+ @Override
+ public void run() {
+ HttpURLConnection connection = null;
+ try {
+ log.debug("Connecting to: " + Launcher.GETCERTIFICATE_URL);
+
+ connection = (HttpURLConnection) Launcher.GETCERTIFICATE_URL.openConnection();
+
+ connection.setRequestMethod("GET");
+ connection.setReadTimeout(0);
+ connection.connect();
+
+ if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
+ log.debug("get-certificate dialog returned");
+ } else {
+ log.error("unexpected response from get-certificate dialog: " + connection.getResponseMessage());
+ }
+ } catch (IOException ex) {
+ log.error("Failed to connect to get-certificate dialog", ex);
+ status.error(StatusNotifier.ERROR_PIN);
+ } finally {
+ if (connection != null) {
+ connection.disconnect();
+ }
+ }
+ }
+
+}
diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/HardwareInfoInvoker.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/HardwareInfoInvoker.java
new file mode 100644
index 00000000..6baabfe1
--- /dev/null
+++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/HardwareInfoInvoker.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2012 by Graz University of Technology, Austria
+ * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint
+ * initiative of the Federal Chancellery Austria and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
+package at.gv.egiz.bku.webstart;
+
+import java.io.IOException;
+import java.net.HttpURLConnection;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import at.gv.egiz.bku.webstart.gui.StatusNotifier;
+
+/**
+*
+* @author Thomas Lenz <thomas.lenz@iaik.tugraz.at>
+*/
+
+public class HardwareInfoInvoker implements Runnable {
+
+ private static final Logger log = LoggerFactory.getLogger(HardwareInfoInvoker.class);
+
+ StatusNotifier status;
+
+ public HardwareInfoInvoker(StatusNotifier status) {
+ this.status = status;
+ }
+
+ @Override
+ public void run() {
+ HttpURLConnection connection = null;
+ try {
+ log.debug("Connecting to: " + Launcher.HARDWAREINFO_URL);
+
+ connection = (HttpURLConnection) Launcher.HARDWAREINFO_URL.openConnection();
+
+ connection.setRequestMethod("GET");
+ connection.setReadTimeout(0);
+ connection.connect();
+
+ if (connection.getResponseCode() == HttpURLConnection.HTTP_OK) {
+ log.debug("hardware-info dialog returned");
+ } else {
+ log.error("unexpected response from hardware-info dialog: " + connection.getResponseMessage());
+ }
+ } catch (IOException ex) {
+ log.error("Failed to connect to hardware-info dialog", ex);
+ status.error(StatusNotifier.ERROR_PIN);
+ } finally {
+ if (connection != null) {
+ connection.disconnect();
+ }
+ }
+ }
+
+}
diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Launcher.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Launcher.java
index 2719e990..0e510e2f 100644
--- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Launcher.java
+++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/Launcher.java
@@ -66,19 +66,25 @@ public class Launcher implements BKUControllerInterface {
public static final URL INSTALL_CERT_URL;
public static final URL PIN_MANAGEMENT_URL;
public static final URL IDENTITY_LINK_URL;
+ public static final URL GETCERTIFICATE_URL;
public static final URL HELP_URL;
+ public static final URL HARDWAREINFO_URL;
static {
URL http = null;
URL https = null;
URL pin = null;
URL ident = null;
+ URL getcertificate = null;
+ URL hardwareinfo = null;
URL cert = null;
URL help = null;
try {
http = new URL("http://localhost:" + Integer.getInteger(Container.HTTPS_PORT_PROPERTY, 3495).intValue() + '/');
https = new URL("https://localhost:" + Integer.getInteger(Container.HTTPS_PORT_PROPERTY, 3496).intValue() + '/');
pin = new URL(http, "/PINManagement");
+ getcertificate = new URL(http, "/GETCertificate");
+ hardwareinfo = new URL(http, "/GETHardwareinfo");
cert = new URL(http, "/ca.crt");
help = new URL(http, "/help/");
ident = new URL(http, "/IdentityLink");
@@ -89,6 +95,8 @@ public class Launcher implements BKUControllerInterface {
HTTPS_SECURITY_LAYER_URL = https;
PIN_MANAGEMENT_URL = pin;
IDENTITY_LINK_URL = ident;
+ GETCERTIFICATE_URL = getcertificate;
+ HARDWAREINFO_URL = hardwareinfo;
INSTALL_CERT_URL = cert;
HELP_URL = help;
}
@@ -316,4 +324,14 @@ public class Launcher implements BKUControllerInterface {
public void personIdentityLink(Locale locale) {
new Thread(new PersonIdentityLinkInvoker(status)).start();
}
+
+ @Override
+ public void getCertificate(Locale locale) {
+ new Thread(new GetCertificateInvoker(status)).start();
+ }
+
+ @Override
+ public void hardwareInfo(Locale locale) {
+ new Thread(new HardwareInfoInvoker(status)).start();
+ }
}
diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/BKUControllerInterface.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/BKUControllerInterface.java
index 2d91f2f2..8c05f137 100644
--- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/BKUControllerInterface.java
+++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/BKUControllerInterface.java
@@ -35,9 +35,13 @@ public interface BKUControllerInterface {
public void showHelp(Locale locale);
public void pinManagement(Locale locale);
+
+ public void getCertificate(Locale locale);
public void personIdentityLink(Locale locale);
+ public void hardwareInfo(Locale locale);
+
/**
* Check if MOCCA Autostart is possible
* @return autostart possibility
diff --git a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/MOCCAIcon.java b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/MOCCAIcon.java
index 3c6fe6f0..f0b60877 100644
--- a/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/MOCCAIcon.java
+++ b/BKUWebStart/src/main/java/at/gv/egiz/bku/webstart/gui/MOCCAIcon.java
@@ -48,6 +48,8 @@ import org.slf4j.LoggerFactory;
/**
* @author clemenso
* @author tkellner
+ * @author tlenz
+ * @author afitzek
*/
public class MOCCAIcon implements StatusNotifier, ActionListener, ItemListener {
@@ -57,14 +59,17 @@ public class MOCCAIcon implements StatusNotifier, ActionListener, ItemListener {
public static final String LABEL_ABOUT = "tray.label.about";
public static final String LABEL_SETTINGS = "tray.label.settings";
public static final String LABEL_AUTOSTART = "tray.label.autostart";
- public static final String LABEL_IDENTITYLINK = "tray.label.identitylink";
- public static final String LABEL_INFOMENU = "tray.label.infomenu";
public static final String TOOLTIP_DEFAULT = "tray.tooltip.default";
+ public static final String LABEL_CARD = "tray.label.card";
+ public static final String LABEL_GETCERTIFICATE = "tray.label.getcertificate";
+ public static final String LABEL_INFO = "tray.label.info";
+ public static final String LABEL_IDENTITYLINK = "tray.label.identitylink";
+ public static final String LABEL_HARDWAREINFO = "tray.label.hardwareinfo";
/** action commands for tray menu */
private static enum COMMANDS {
- SHUTDOWN_COMMAND, PIN_COMMAND, ABOUT_COMMAND,
- HELP_COMMAND, AUTOSTART_COMMAND, IDENTITYLINK_COMMAND
+ SHUTDOWN_COMMAND, PIN_COMMAND, ABOUT_COMMAND, HELP_COMMAND, AUTOSTART_COMMAND,
+ GETCERTIFICATE_COMMAND, HARDWAREINFO_COMMAND, IDENTITYLINK_COMMAND
};
private static final Logger log = LoggerFactory.getLogger(MOCCAIcon.class);
@@ -107,19 +112,33 @@ public class MOCCAIcon implements StatusNotifier, ActionListener, ItemListener {
helpItem.addActionListener(this);
helpItem.setActionCommand(COMMANDS.HELP_COMMAND.name());
menu.add(helpItem);
-
- Menu infoMenu = new Menu(messages.getString(LABEL_INFOMENU));
-
- MenuItem identityLinkItem = new MenuItem(messages.getString(LABEL_IDENTITYLINK));
- identityLinkItem.addActionListener(this);
- identityLinkItem.setActionCommand(COMMANDS.IDENTITYLINK_COMMAND.name());
- infoMenu.add(identityLinkItem);
+ Menu cardMenu = new Menu(messages.getString(LABEL_CARD));
+ menu.add(cardMenu);
+
MenuItem pinItem = new MenuItem(messages.getString(LABEL_PIN));
pinItem.addActionListener(this);
pinItem.setActionCommand(COMMANDS.PIN_COMMAND.name());
- menu.add(pinItem);
+ cardMenu.add(pinItem);
+
+ MenuItem getcertificateItem = new MenuItem(messages.getString(LABEL_GETCERTIFICATE));
+ getcertificateItem.addActionListener(this);
+ getcertificateItem.setActionCommand(COMMANDS.GETCERTIFICATE_COMMAND.name());
+ cardMenu.add(getcertificateItem);
+
+ Menu infoMenu = new Menu(messages.getString(LABEL_INFO));
+ menu.add(infoMenu);
+ MenuItem identitylinkItem = new MenuItem(messages.getString(LABEL_IDENTITYLINK));
+ identitylinkItem.addActionListener(this);
+ identitylinkItem.setActionCommand(COMMANDS.IDENTITYLINK_COMMAND.name());
+ infoMenu.add(identitylinkItem);
+
+ MenuItem hardwareinfoItem = new MenuItem(messages.getString(LABEL_HARDWAREINFO));
+ hardwareinfoItem.addActionListener(this);
+ hardwareinfoItem.setActionCommand(COMMANDS.HARDWAREINFO_COMMAND.name());
+ infoMenu.add(hardwareinfoItem);
+
MenuItem aboutItem = new MenuItem(
messages.getString(LABEL_ABOUT));
aboutItem.setActionCommand(COMMANDS.ABOUT_COMMAND.name());
@@ -239,6 +258,16 @@ public class MOCCAIcon implements StatusNotifier, ActionListener, ItemListener {
controller.pinManagement(messages.getLocale());
break;
+ case GETCERTIFICATE_COMMAND:
+ log.debug("get-certificate dialog requested via tray menu");
+ controller.getCertificate(messages.getLocale());
+ break;
+
+ case HARDWAREINFO_COMMAND:
+ log.debug("hardware-info dialog requested via tray menu");
+ controller.hardwareInfo(messages.getLocale());
+ break;
+
case HELP_COMMAND:
log.debug("help page requested via tray menu");
controller.showHelp(messages.getLocale());
diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/messages.properties b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/messages.properties
index 6069874f..3a01570e 100644
--- a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/messages.properties
+++ b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/messages.properties
@@ -38,9 +38,14 @@ tray.label.pin=PIN management
tray.label.help=Help
tray.label.about=About...
tray.label.settings=Settings
-tray.label.infomenu=Infos
tray.label.autostart=Autostart
-tray.label.identitylink=IdentityLink
+
+tray.label.card=Card
+tray.label.getcertificate=Save certificate
+tray.label.info=Info
+tray.label.identitylink=Identitylink
+tray.label.hardwareinfo=Hardware
+
tray.tooltip.default=CitizenCard
about.frame.title=CitizenCard
about.title=<html>CitizenCard Environment
diff --git a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/messages_de.properties b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/messages_de.properties
index a07abb63..da4ff47d 100644
--- a/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/messages_de.properties
+++ b/BKUWebStart/src/main/resources/at/gv/egiz/bku/webstart/messages_de.properties
@@ -38,11 +38,17 @@ tray.label.help=Hilfe
tray.label.about=\u00DCber...
tray.label.settings=Einstellungen
tray.label.autostart=Autostart
-tray.label.infomenu=Informationen
+
+tray.label.card=Karte
+tray.label.getcertificate=Zertifikat speichern
+tray.label.info=Infos
tray.label.identitylink=Personenbindung
+tray.label.hardwareinfo=Hardware
+
tray.tooltip.default=B\u00FCrgerkartenumgebung
about.frame.title=B\u00FCrgerkarte
about.title=<html>B\u00FCrgerkartenumgebung
about.version=<html>Version: {0}
button.ok=Best\u00E4tigen
button.close=Schlie\u00DFen
+
diff --git a/STALExt/src/main/java/at/gv/egiz/stal/ext/GETCertificateRequest.java b/STALExt/src/main/java/at/gv/egiz/stal/ext/GETCertificateRequest.java
new file mode 100644
index 00000000..7d488170
--- /dev/null
+++ b/STALExt/src/main/java/at/gv/egiz/stal/ext/GETCertificateRequest.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2011 by Graz University of Technology, Austria
+ * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint
+ * initiative of the Federal Chancellery Austria and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
+package at.gv.egiz.stal.ext;
+
+import at.gv.egiz.stal.STALRequest;
+
+/**
+*
+* @author Thomas Lenz <thomas.lenz@iaik.tugraz.at>
+*/
+
+public class GETCertificateRequest extends STALRequest {
+
+}
diff --git a/STALExt/src/main/java/at/gv/egiz/stal/ext/GETCertificateResponse.java b/STALExt/src/main/java/at/gv/egiz/stal/ext/GETCertificateResponse.java
new file mode 100644
index 00000000..bb95cc5b
--- /dev/null
+++ b/STALExt/src/main/java/at/gv/egiz/stal/ext/GETCertificateResponse.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2011 by Graz University of Technology, Austria
+ * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint
+ * initiative of the Federal Chancellery Austria and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
+package at.gv.egiz.stal.ext;
+
+import at.gv.egiz.stal.STALResponse;
+
+/**
+*
+* @author Thomas Lenz <thomas.lenz@iaik.tugraz.at>
+*/
+
+public class GETCertificateResponse extends STALResponse {
+
+}
diff --git a/STALExt/src/main/java/at/gv/egiz/stal/ext/GETHardwareInfoRequest.java b/STALExt/src/main/java/at/gv/egiz/stal/ext/GETHardwareInfoRequest.java
new file mode 100644
index 00000000..e4204a9e
--- /dev/null
+++ b/STALExt/src/main/java/at/gv/egiz/stal/ext/GETHardwareInfoRequest.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2011 by Graz University of Technology, Austria
+ * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint
+ * initiative of the Federal Chancellery Austria and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
+package at.gv.egiz.stal.ext;
+
+import at.gv.egiz.stal.STALRequest;
+
+/**
+*
+* @author Thomas Lenz <thomas.lenz@iaik.tugraz.at>
+*/
+
+public class GETHardwareInfoRequest extends STALRequest {
+
+}
diff --git a/STALExt/src/main/java/at/gv/egiz/stal/ext/GETHardwareInfoResponse.java b/STALExt/src/main/java/at/gv/egiz/stal/ext/GETHardwareInfoResponse.java
new file mode 100644
index 00000000..cbe5c965
--- /dev/null
+++ b/STALExt/src/main/java/at/gv/egiz/stal/ext/GETHardwareInfoResponse.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2011 by Graz University of Technology, Austria
+ * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint
+ * initiative of the Federal Chancellery Austria and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
+package at.gv.egiz.stal.ext;
+
+import at.gv.egiz.stal.STALResponse;
+
+/**
+*
+* @author Thomas Lenz <thomas.lenz@iaik.tugraz.at>
+*/
+
+public class GETHardwareInfoResponse extends STALResponse {
+
+}
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/AbstractSignatureCard.java b/smcc/src/main/java/at/gv/egiz/smcc/AbstractSignatureCard.java
index 0104cdb3..deed447d 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/AbstractSignatureCard.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/AbstractSignatureCard.java
@@ -43,6 +43,7 @@ public abstract class AbstractSignatureCard implements SignatureCard {
protected Locale locale = Locale.getDefault();
private Card card_;
+ private String cardterminalname;
protected CardReader reader;
@@ -67,6 +68,7 @@ public abstract class AbstractSignatureCard implements SignatureCard {
public void init(Card card, CardTerminal cardTerminal) {
this.card_ = card;
this.reader = ReaderFactory.getReader(card, cardTerminal);
+ this.cardterminalname = cardTerminal.getName();
}
@Override
@@ -74,6 +76,10 @@ public abstract class AbstractSignatureCard implements SignatureCard {
return card_;
}
+ public String getTerminalName() {
+ return(cardterminalname);
+ }
+
protected CardChannel getCardChannel() {
if(card_.getProtocol().equalsIgnoreCase("T=0")) {
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/SWCard.java b/smcc/src/main/java/at/gv/egiz/smcc/SWCard.java
index 33f4019b..7150c8b4 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/SWCard.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/SWCard.java
@@ -121,6 +121,10 @@ public class SWCard implements SignatureCard {
return null;
}
+ public String getTerminalName() {
+ return null;
+ }
+
private String getFileName(String fileName) {
String fs = System.getProperty("file.separator");
return swCardDir + fs + fileName;
diff --git a/smcc/src/main/java/at/gv/egiz/smcc/SignatureCard.java b/smcc/src/main/java/at/gv/egiz/smcc/SignatureCard.java
index 56ae7b74..b3cbaec8 100644
--- a/smcc/src/main/java/at/gv/egiz/smcc/SignatureCard.java
+++ b/smcc/src/main/java/at/gv/egiz/smcc/SignatureCard.java
@@ -85,6 +85,8 @@ public interface SignatureCard {
public Card getCard();
+ public String getTerminalName();
+
public byte[] getCertificate(KeyboxName keyboxName, PINGUI pinGUI)
throws SignatureCardException, InterruptedException;
diff --git a/smccSTAL/src/test/java/at/gv/egiz/smcc/AbstractSMCCSTALTest.java b/smccSTAL/src/test/java/at/gv/egiz/smcc/AbstractSMCCSTALTest.java
index 993b8425..a9e5bce3 100644
--- a/smccSTAL/src/test/java/at/gv/egiz/smcc/AbstractSMCCSTALTest.java
+++ b/smccSTAL/src/test/java/at/gv/egiz/smcc/AbstractSMCCSTALTest.java
@@ -110,7 +110,13 @@ public class AbstractSMCCSTALTest extends AbstractSMCCSTAL implements
public void reset() throws SignatureCardException {
// TODO Auto-generated method stub
- }
+ }
+
+ @Override
+ public String getTerminalName() {
+ // TODO Auto-generated method stub
+ return null;
+ }
};
return false;
}
diff --git a/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/GETCertificateRequestHandler.java b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/GETCertificateRequestHandler.java
new file mode 100644
index 00000000..d564b735
--- /dev/null
+++ b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/GETCertificateRequestHandler.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright 2011 by Graz University of Technology, Austria
+ * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint
+ * initiative of the Federal Chancellery Austria and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
+package at.gv.egiz.bku.smccstal;
+
+/**
+*
+* @author Thomas Lenz <thomas.lenz@iaik.tugraz.at>
+*/
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import at.gv.egiz.bku.gui.GetCertificateGUIFacade;
+import at.gv.egiz.bku.pin.gui.VerifyPINGUI;
+import at.gv.egiz.smcc.SignatureCard;
+import at.gv.egiz.smcc.SignatureCardException;
+import at.gv.egiz.stal.STALRequest;
+import at.gv.egiz.stal.STALResponse;
+import at.gv.egiz.stal.ext.GETCertificateRequest;
+import at.gv.egiz.stal.ext.GETCertificateResponse;
+
+public class GETCertificateRequestHandler extends AbstractRequestHandler {
+
+ private final Logger log = LoggerFactory.getLogger(GETCertificateRequestHandler.class);
+
+ @Override
+ public boolean requireCard() {
+ return true;
+ }
+
+ @Override
+ public STALResponse handleRequest(STALRequest request)
+ throws InterruptedException {
+
+ log.debug("handle a GETCertificateRequest");
+
+ if (request instanceof GETCertificateRequest) {
+
+ GetCertificateGUIFacade gui = (GetCertificateGUIFacade) this.gui;
+
+ gui.showGETCertificateDialog(this, "getqualcert", "getsimcert", this, "cancel");
+
+ while (true) {
+
+ waitForAction();
+
+ try {
+
+ if ("cancel".equals(actionCommand)) {
+ log.debug("get certificate response cancel.");
+ return new GETCertificateResponse();
+
+ } else if ("getqualcert".equals(actionCommand)) {
+
+ File file = gui.showSaveDialog(GetCertificateGUIFacade.FILENAME_QUAL_CERT);
+ byte[] cert = card.getCertificate(SignatureCard.KeyboxName.SECURE_SIGNATURE_KEYPAIR,
+ new VerifyPINGUI(gui));
+
+ FileOutputStream fstream = new FileOutputStream(file);
+ fstream.write(cert);
+ fstream.close();
+
+ log.debug("qualified certificate are saved to | " + file.getAbsolutePath() + ".");
+
+ return new GETCertificateResponse();
+
+ } else if ("getsimcert".equals(actionCommand)) {
+
+ File file = gui.showSaveDialog(GetCertificateGUIFacade.FILENAME_SIM_CERT);
+
+ FileOutputStream fstream = new FileOutputStream(file);
+ fstream.write(card.getCertificate(SignatureCard.KeyboxName.CERTIFIED_KEYPAIR,
+ new VerifyPINGUI(gui)));
+ fstream.close();
+
+ log.debug("simple certificate are saved to | " + file.getAbsolutePath() + ".");
+
+ return new GETCertificateResponse();
+ }
+ else {
+ log.info("unknown command resolved.");
+ }
+
+ } catch (FileNotFoundException e) {
+ log.error("file to save the certificate could not be found.", e);
+
+ } catch (SignatureCardException e) {
+ log.error("Card not activated or certificate is not available.", e);
+ gui.showErrorDialog(GetCertificateGUIFacade.ERR_CARD_NOTACTIVATED,
+ null, this, "cancel");
+
+ } catch (NullPointerException e) {
+ log.error("save certificate file selection aborted.", e);
+
+ } catch (Exception e) {
+ log.error("a general error occur during the certificate save operation.", e);
+ }
+ }
+ }
+
+ return new GETCertificateResponse();
+ }
+
+}
diff --git a/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/GETHardwareInfoRequestHandler.java b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/GETHardwareInfoRequestHandler.java
new file mode 100644
index 00000000..d2b3b050
--- /dev/null
+++ b/smccSTALExt/src/main/java/at/gv/egiz/bku/smccstal/GETHardwareInfoRequestHandler.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2011 by Graz University of Technology, Austria
+ * MOCCA has been developed by the E-Government Innovation Center EGIZ, a joint
+ * initiative of the Federal Chancellery Austria and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ */
+
+package at.gv.egiz.bku.smccstal;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import at.gv.egiz.bku.gui.GetHardwareInfoGUIFacade;
+import at.gv.egiz.stal.STALRequest;
+import at.gv.egiz.stal.STALResponse;
+import at.gv.egiz.stal.ext.GETHardwareInfoRequest;
+import at.gv.egiz.stal.ext.GETHardwareInfoResponse;
+
+/**
+*
+* @author Thomas Lenz <thomas.lenz@iaik.tugraz.at>
+*/
+
+public class GETHardwareInfoRequestHandler extends AbstractRequestHandler {
+
+ private final Logger log = LoggerFactory.getLogger(GETHardwareInfoRequestHandler.class);
+
+ @Override
+ public boolean requireCard() {
+ return true;
+ }
+
+ @Override
+ public STALResponse handleRequest(STALRequest request)
+ throws InterruptedException {
+
+ log.debug("handle a get-hardware info request");
+
+ if (request instanceof GETHardwareInfoRequest) {
+
+ try {
+ String terminal = card.getTerminalName();
+ String smartcard = card.toString();
+ String smartcard_ATR = toString(card.getCard().getATR().getBytes());
+
+ } catch (SignatureCardException e) {
+ log.error("Some error occur during card communication.", e);
+ gui.showErrorDialog(GetHardwareInfoGUIFacade.ERR_CARD_NOTACTIVATED,
+ null, this, "cancel");
+ }
+
+
+
+ GetHardwareInfoGUIFacade gui = (GetHardwareInfoGUIFacade) this.gui;
+
+ gui.showHardwareInfoDialog(this, "back", terminal, smartcard, smartcard_ATR);
+
+ while (true) {
+
+ waitForAction();
+
+ if ("back".equals(actionCommand)) {
+ log.debug("show hardware info response back.");
+ return new GETHardwareInfoResponse();
+
+ } else {
+ log.info("unknown command resolved.");
+ }
+ }
+ }
+ return new GETHardwareInfoResponse();
+ }
+
+ private static String toString(byte[] b) {
+ StringBuffer sb = new StringBuffer();
+ sb.append('[');
+ 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((i % 32 == 0) ? '\n' : ':');
+ sb.append(Integer.toHexString((b[i] & 240) >> 4));
+ sb.append(Integer.toHexString(b[i] & 15));
+ }
+ }
+ sb.append(']');
+ return sb.toString();
+ }
+
+}