diff options
| author | clemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2009-11-13 15:13:21 +0000 | 
|---|---|---|
| committer | clemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2009-11-13 15:13:21 +0000 | 
| commit | b7dd29046e232e4d42623655efc28965cce942b8 (patch) | |
| tree | 0939e64d925f108756207d6981ebf5d2dbe2a24a | |
| parent | 1b6da29d3871b51daa2a6dff9bb85c84cb8d3093 (diff) | |
| download | mocca-b7dd29046e232e4d42623655efc28965cce942b8.tar.gz mocca-b7dd29046e232e4d42623655efc28965cce942b8.tar.bz2 mocca-b7dd29046e232e4d42623655efc28965cce942b8.zip | |
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@546 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
15 files changed, 587 insertions, 382 deletions
| diff --git a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletSecureViewer.java b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletSecureViewer.java index 929cecb1..2e0cb331 100644 --- a/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletSecureViewer.java +++ b/BKUApplet/src/main/java/at/gv/egiz/bku/online/applet/AppletSecureViewer.java @@ -185,13 +185,13 @@ public class AppletSecureViewer implements SecureViewer {            throw new Exception("No hashdata input for reference " + signedRefId + " provided by service");          }          if (log.isDebugEnabled()) { -          log.debug("Got HashDataInput " + signedRefId + " (" + mimeType + ";" + encoding + ")"); +          log.debug("Digesting reference " + signedRefId + " (" + mimeType + ";" + encoding + ")");          }          byte[] hashDataInputDigest = digest(hdi, signedDigestAlg);          if (log.isDebugEnabled()) { -          log.debug("Comparing digest values... "); +          log.debug("Comparing digest to claimed digest value for reference " + signedRefId);          }  //        log.warn("***************** DISABLED HASHDATA VERIFICATION");          if (!Arrays.equals(hashDataInputDigest, signedDigest)) { diff --git a/BKUApplet/src/test/resources/DejaVuLGCSansMono.ttf b/BKUApplet/src/test/resources/DejaVuLGCSansMono.ttfBinary files differ new file mode 100644 index 00000000..21647753 --- /dev/null +++ b/BKUApplet/src/test/resources/DejaVuLGCSansMono.ttf diff --git a/BKUApplet/src/test/resources/appletTest.html b/BKUApplet/src/test/resources/appletTest.html index 85834763..22495a32 100644 --- a/BKUApplet/src/test/resources/appletTest.html +++ b/BKUApplet/src/test/resources/appletTest.html @@ -21,7 +21,7 @@      <link rel="shortcut icon" href="img/chip16.ico" type="image/x-icon">    </head>    <body> -  	<p>Run applet test with appletviewer -J-Djava.security.policy=appletviewer.policy appletTest.html</p> +  	<p>Run applet test with appletviewer (-J-d32) -J-Djava.security.policy=appletviewer.policy appletTest.html</p>      <applet code="at.gv.egiz.bku.online.applet.BKUApplet.class"              archive="../BKUApplet-1.2.8-SNAPSHOT.jar, commons-logging.jar , iaik_jce_me4se.jar"              width=190 height=130 name="moccaapplet" id="moccaapplet"> @@ -30,8 +30,8 @@        <!--param name="Background" value="jar:file:/home/clemens/workspace/mocca/BKUApplet/target/BKUApplet-1.0-SNAPSHOT.jar!/images/help.png"/-->        <!--param name="Background" value="http://localhost:3495/img/BackgroundChipperling.png"/-->        <param name="BackgroundColor" value="#ff0000"/> -      <param name="WSDL_URL" value="https://localhost:8080/stal?wsdl"/> -      <param name="HelpURL" value="http://apps.egiz.gv.at/bkuonline/help/"/> +      <param name="WSDL_URL" value="http://localhost:8080/BKUOnline/stal?wsdl"/> +      <param name="HelpURL" value="http://localhost:8080/BKUOnline/help/"/>        <param name="SessionId" value="TestSession"/>        <param name="RedirectURL" value="http://www.google.com/bkuResult"/>        <param name="RedirectTarget" value="_parent"/> diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java index e4af6443..91c91dcb 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIFacade.java @@ -46,7 +46,7 @@ public interface BKUGUIFacade {    public static final String DEFAULT_BACKGROUND = "/at/gv/egiz/bku/gui/chip32.png";    public static final String DEFAULT_ICON = "/at/gv/egiz/bku/gui/chiperling105.png";    public static final String HELP_IMG = "/at/gv/egiz/bku/gui/help.png"; -  public static final String HELP_IMG_FOCUS = "/at/gv/egiz/bku/gui/help_focus.png"; +  public static final String HELP_IMG_FOCUS = "/at/gv/egiz/bku/gui/help.png"; //help_focus.png";    public static final String HASHDATA_FONT = "Monospaced";    public static final Color ERROR_COLOR = Color.RED;    public static final Color HYPERLINK_COLOR = Color.BLUE; @@ -56,6 +56,7 @@ public interface BKUGUIFacade {    public static final String TITLE_CARDPIN = "title.cardpin";    public static final String TITLE_SIGN = "title.sign";    public static final String TITLE_ERROR = "title.error"; +  public static final String TITLE_WARNING = "title.warning";    public static final String TITLE_ENTRY_TIMEOUT = "title.entry.timeout";    public static final String TITLE_RETRY = "title.retry";    public static final String TITLE_WAIT = "title.wait"; @@ -79,6 +80,8 @@ public interface BKUGUIFacade {    public static final String MESSAGE_HASHDATALINK_FOCUS = "hashdatalink.focus";    public static final String MESSAGE_HASHDATALINK_TINY_FOCUS = "hashdatalink.tiny.focus";    public static final String MESSAGE_HASHDATALIST = "hashdatalist"; +  public static final String MESSAGE_HASHDATA_VIEWER = "hashdata.viewer"; +  public static final String MESSAGE_UNSUPPORTED_MIMETYPE = "unsupported.mimetype";    public static final String MESSAGE_RETRIES = "retries";    public static final String MESSAGE_LAST_RETRY = "retries.last";    public static final String MESSAGE_RETRIES_PINPAD = "retries.pinpad"; diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java index 20fe4f56..baffb3fd 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java @@ -19,6 +19,7 @@ package at.gv.egiz.bku.gui;  import at.gv.egiz.bku.gui.viewer.FontProviderException;  import at.gv.egiz.bku.gui.viewer.FontProvider; +import at.gv.egiz.bku.gui.viewer.SecureViewerSaveDialog;  import at.gv.egiz.smcc.PINSpec;  import at.gv.egiz.stal.HashDataInput;  import java.awt.Color; @@ -1384,26 +1385,34 @@ public class BKUGUIImpl implements BKUGUIFacade {                  new Object[] {"no signature data provided"},                  backListener, backCommand);        } else if (dataToBeSigned.size() == 1) { -        try { -          log.debug("[" + Thread.currentThread().getName() + "] scheduling secure viewer"); - -          SwingUtilities.invokeLater(new Runnable() { - -            @Override -            public void run() { -              try { -                showSecureViewer(dataToBeSigned.get(0)); -              } catch (FontProviderException ex) { -                log.error("failed to display secure viewer", ex); -                showErrorDialog(ERR_VIEWER, new Object[] {ex.getMessage()}, backListener, backCommand); +        //TODO pull out (see also SignedReferencesSelectionListener) +        if (SecureViewerDialog.SUPPORTED_MIME_TYPES.contains(dataToBeSigned.get(0).getMimeType())) { +          try { +            log.debug("[" + Thread.currentThread().getName() + "] scheduling secure viewer"); +   +            SwingUtilities.invokeLater(new Runnable() { +   +              @Override +              public void run() { +                try { +                  showMessageDialog(TITLE_HASHDATA, MESSAGE_HASHDATA_VIEWER); +                  showSecureViewer(dataToBeSigned.get(0), backListener, backCommand); +                } catch (FontProviderException ex) { +                  log.error("failed to display secure viewer", ex); +                  showErrorDialog(ERR_VIEWER, new Object[] {ex.getMessage()}, backListener, backCommand); +                }                } -            } -          }); -        -        } catch (Exception ex) { //InterruptedException InvocationTargetException -          log.error("Failed to display secure viewer: " + ex.getMessage()); -          log.trace(ex); -          showErrorDialog(ERR_UNKNOWN, null, backListener, backCommand); +            }); +          +          } catch (Exception ex) { //InterruptedException InvocationTargetException +            log.error("Failed to display secure viewer: " + ex.getMessage()); +            log.trace(ex); +            showErrorDialog(ERR_UNKNOWN, null, backListener, backCommand); +          } +        } else { +          log.debug("[" + Thread.currentThread().getName() + "] mime-type not supported by secure viewer, scheduling save dialog"); +          showMessageDialog(TITLE_HASHDATA, MESSAGE_UNSUPPORTED_MIMETYPE); +          SecureViewerSaveDialog.showSaveDialog(dataToBeSigned.get(0), messages, backListener, backCommand);           }        } else {          showSignedReferencesListDialog(dataToBeSigned, backListener, backCommand); @@ -1412,30 +1421,48 @@ public class BKUGUIImpl implements BKUGUIFacade {      /**       * has to be called from event dispatcher thread -     * This method blocks until the dialog's close button is pressed.       * @param hashDataText       * @param saveListener       * @param saveCommand       */ -    private void showSecureViewer(HashDataInput dataToBeSigned) throws FontProviderException { +//    private void showSecureViewer(HashDataInput dataToBeSigned) throws FontProviderException { +//       +//      log.debug("[" + Thread.currentThread().getName() + "] show secure viewer"); +//      if (secureViewer == null) { +//        secureViewer = new SecureViewerDialog(null, messages, +//                fontProvider, helpMouseListener.getActionListener()); +// +//        // workaround for [#439] +//        // avoid AlwaysOnTop at least in applet, otherwise make secureViewer AlwaysOnTop since MOCCA Dialog (JFrame created in LocalSTALFactory) is always on top. +//        Window window = SwingUtilities.getWindowAncestor(contentPane); +//        if (window != null && window.isAlwaysOnTop()) { +//          log.debug("make secureViewer alwaysOnTop"); +//          secureViewer.setAlwaysOnTop(true); +//        } +//      } +//      secureViewer.setContent(dataToBeSigned); +//      log.trace("show secure viewer returned"); +//    } +    private void showSecureViewer(HashDataInput dataToBeSigned, ActionListener closeListener, String closeCommand) throws FontProviderException {        log.debug("[" + Thread.currentThread().getName() + "] show secure viewer"); -      if (secureViewer == null) { -        secureViewer = new SecureViewerDialog(null, messages, -                fontProvider, helpMouseListener.getActionListener()); - -        // workaround for [#439] -        // avoid AlwaysOnTop at least in applet, otherwise make secureViewer AlwaysOnTop since MOCCA Dialog (JFrame created in LocalSTALFactory) is always on top. -        Window window = SwingUtilities.getWindowAncestor(contentPane); -        if (window != null && window.isAlwaysOnTop()) { -          log.debug("make secureViewer alwaysOnTop"); -          secureViewer.setAlwaysOnTop(true); -        } +      SecureViewerDialog secureViewer = new SecureViewerDialog(null, messages, +          closeListener, closeCommand, +            fontProvider, helpMouseListener.getActionListener()); +         +      // workaround for [#439] +      // avoid AlwaysOnTop at least in applet, otherwise make secureViewer AlwaysOnTop since MOCCA Dialog (JFrame created in LocalSTALFactory) is always on top. +      Window window = SwingUtilities.getWindowAncestor(contentPane); +      if (window != null && window.isAlwaysOnTop()) { +        log.debug("make secureViewer alwaysOnTop"); +        secureViewer.setAlwaysOnTop(true);        }        secureViewer.setContent(dataToBeSigned); -      log.trace("show secure viewer returned"); +      log.trace("viewer setContent returned");      } +     +          private void showSignedReferencesListDialog(final List<HashDataInput> signedReferences,              final ActionListener backListener, final String backCommand) { @@ -1468,44 +1495,10 @@ public class BKUGUIImpl implements BKUGUIFacade {            hashDataTable.setDefaultRenderer(HashDataInput.class, new HyperlinkRenderer(renderRefId));            hashDataTable.setTableHeader(null); -          // not possible to add mouse listener to TableCellRenderer -          hashDataTable.addMouseMotionListener(new MouseMotionAdapter() { - -            @Override -            public void mouseMoved(MouseEvent e) { -              if (hashDataTable.columnAtPoint(e.getPoint()) == 0) { -                hashDataTable.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); -              } else { -                hashDataTable.setCursor(Cursor.getDefaultCursor()); -              } -            } -          }); +          hashDataTable.addMouseMotionListener(new SignedReferencesMouseMotionListener(hashDataTable));            hashDataTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); -          hashDataTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { - -            @Override -            public void valueChanged(final ListSelectionEvent e) { -              //invoke later to allow thread to paint selection background -              SwingUtilities.invokeLater(new Runnable() { - -                @Override -                public void run() { -                  ListSelectionModel lsm = (ListSelectionModel) e.getSource(); -                  int selectionIdx = lsm.getMinSelectionIndex(); -                  if (selectionIdx >= 0) { -                    final HashDataInput selection = signedReferences.get(selectionIdx); -                    try { -                      showSecureViewer(selection); -                    } catch (FontProviderException ex) { -                      log.error("failed to display secure viewer", ex); -                      showErrorDialog(ERR_VIEWER, new Object[] {ex.getMessage()}, backListener, backCommand); -                    } -                  } -                } -              }); -            } -          }); +          hashDataTable.getSelectionModel().addListSelectionListener(new SignedReferencesSelectionListener(signedReferences, backListener, backCommand));            JScrollPane hashDataScrollPane = new JScrollPane(hashDataTable); @@ -1560,97 +1553,106 @@ public class BKUGUIImpl implements BKUGUIFacade {        });      } +    +          /** -     * @param okListener may be null +     * not possible to add mouse listener to TableCellRenderer +     * to change cursor on specific columns only, use table.columnAtPoint(e.getPoint())  +     *       */ -//    private void showSaveDialog(final List<HashDataInput> signedRefs, -//            final ActionListener okListener, final String okCommand) { -// -//      log.debug("scheduling save dialog"); -// -//      SwingUtilities.invokeLater(new Runnable() { -// -//        @Override -//        public void run() { -// -//          log.debug("show save dialog"); -// -//          String userHome = System.getProperty("user.home"); -// -//          JFileChooser fileDialog = new JFileChooser(userHome); -//          fileDialog.setMultiSelectionEnabled(false); -//          fileDialog.setDialogType(JFileChooser.SAVE_DIALOG); -//          fileDialog.setFileHidingEnabled(true); -//          if (signedRefs.size() == 1) { -//            fileDialog.setDialogTitle(getMessage(WINDOWTITLE_SAVE)); -//            fileDialog.setFileSelectionMode(JFileChooser.FILES_ONLY); -//            String mimeType = signedRefs.get(0).getMimeType(); -//            MimeFilter mimeFilter = new MimeFilter(mimeType, messages); -//            fileDialog.setFileFilter(mimeFilter); -//            String filename = getMessage(SAVE_HASHDATAINPUT_PREFIX) + MimeFilter.getExtension(mimeType); -//            fileDialog.setSelectedFile(new File(userHome, filename)); -//          } else { -//            fileDialog.setDialogTitle(getMessage(WINDOWTITLE_SAVEDIR)); -//            fileDialog.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); -//          } -// -//          //parent contentPane -> placed over applet -//          switch (fileDialog.showSaveDialog(fileDialog)) { -//            case JFileChooser.APPROVE_OPTION: -//              File f = fileDialog.getSelectedFile(); -//              for (HashDataInput hashDataInput : signedRefs) { -//                String mimeType = hashDataInput.getMimeType(); -//                String id = hashDataInput.getReferenceId(); -//                File file; -//                if (f.isDirectory()) { -//                  String filename = getMessage(SAVE_HASHDATAINPUT_PREFIX) + '_' + id + MimeFilter.getExtension(mimeType); -//                  file = new File(f, filename); -//                } else { -//                  file = f; -//                } -//                if (file.exists()) { -//                  String ovrwrt = getMessage(MESSAGE_OVERWRITE); -//                  int overwrite = JOptionPane.showConfirmDialog(fileDialog, MessageFormat.format(ovrwrt, file), getMessage(WINDOWTITLE_OVERWRITE), JOptionPane.OK_CANCEL_OPTION); -//                  if (overwrite != JOptionPane.OK_OPTION) { -//                    continue; -//                  } -//                } -//                if (log.isDebugEnabled()) { -//                    log.debug("writing hashdata input " + id + " (" + mimeType + ") to file " + file); -//                } -//                FileOutputStream fos = null; -//                try { -//                    fos = new FileOutputStream(file); -//                    BufferedOutputStream bos = new BufferedOutputStream(fos); -//                    InputStream hdi = hashDataInput.getHashDataInput(); -//                    int b; -//                    while ((b = hdi.read()) != -1) { -//                        bos.write(b); -//                    } -//                    bos.flush(); -//                    bos.close(); -//                } catch (IOException ex) { -//                    log.error("Failed to write " + file + ": " + ex.getMessage()); -//                    showErrorDialog(ERR_WRITE_HASHDATA, new Object[] {ex.getMessage()}, null, null); -//                    ex.printStackTrace(); -//                } finally { -//                    try { -//                        fos.close(); -//                    } catch (IOException ex) { -//                    } -//                } -//              } -//              break; -//            case JFileChooser.CANCEL_OPTION : -//              log.debug("cancelled save dialog"); -//              break; -//          } -//          if (okListener != null) { -//            okListener.actionPerformed(new ActionEvent(fileDialog, ActionEvent.ACTION_PERFORMED, okCommand)); -//          } -//        } -//      }); -//    } +    private class SignedReferencesMouseMotionListener extends MouseMotionAdapter { + +      JTable hashDataTable; +       +      public SignedReferencesMouseMotionListener(JTable table) { +        this.hashDataTable = table; +      } +       +      @Override +      public void mouseMoved(MouseEvent e) { +//        if (hashDataTable.columnAtPoint(e.getPoint()) == 0) { +          hashDataTable.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); +      } +    } +     +    /////////// +    // SignedReferencesList (TODO pull out) +     +    public class SignedReferencesSelectionListener implements ListSelectionListener { +       +      List<HashDataInput> signedReferences; +      ActionListener backListener; +      String backCommand; +       +      public SignedReferencesSelectionListener(List<HashDataInput> signedReferences, ActionListener backListener, String backCommand) { +        this.signedReferences = signedReferences; +        this.backListener = backListener; +        this.backCommand = backCommand; +      } +       +      @Override +      public void valueChanged(ListSelectionEvent event) { +         +        if (event.getValueIsAdjusting()) { +          return; +        } +         +        ListSelectionModel lsm = (ListSelectionModel) event.getSource(); +        int selectionIdx = lsm.getMinSelectionIndex(); + +        log.debug("[" + Thread.currentThread().getName() + "] reference " + selectionIdx + " selected"); +         +        if (selectionIdx >= 0) { +          final HashDataInput selection = signedReferences.get(selectionIdx); +          final SignedReferencesListDisplayer backToListListener = new SignedReferencesListDisplayer(signedReferences, backListener, backCommand); +           +          if (SecureViewerDialog.SUPPORTED_MIME_TYPES.contains(selection.getMimeType())) { +            log.debug("[" + Thread.currentThread().getName() + "] scheduling secure viewer dialog"); +            SwingUtilities.invokeLater(new Runnable() { +               +              @Override +              public void run() { +                try { +                  showMessageDialog(TITLE_HASHDATA, MESSAGE_HASHDATA_VIEWER); +                  showSecureViewer(selection, backToListListener, null); +//                  SecureViewerDialog.showSecureViewer(selection, messages, fontProvider, helpMouseListener.getActionListener(), false); +                } catch (FontProviderException ex) { +                  log.error("failed to display secure viewer", ex); +                  showErrorDialog(BKUGUIFacade.ERR_VIEWER, new Object[] {ex.getMessage()}, backToListListener, null); +                } +                 +              } +            }); +          } else { +            log.debug("[" + Thread.currentThread().getName() + "] mime-type not supported by secure viewer, scheduling save dialog"); +            showMessageDialog(BKUGUIFacade.TITLE_HASHDATA, BKUGUIFacade.MESSAGE_UNSUPPORTED_MIMETYPE); +            SecureViewerSaveDialog.showSaveDialog(selection, messages, backToListListener, null); +          } +        } +      } +       +      /** +       * ActionListener that returns to signed references list  +       */ +      private class SignedReferencesListDisplayer implements ActionListener { +        List<HashDataInput> sr; +        ActionListener bl; +        String bc; +         +        public SignedReferencesListDisplayer(List<HashDataInput> signedReferences, ActionListener backListener, String backCommand) { +          sr = signedReferences; +          bl = backListener; +          bc = backCommand; +        } +         +        @Override +        public void actionPerformed(ActionEvent e) { +//          log.debug("[" + Thread.currentThread().getName() + "] displaying signed references list"); +          showSignedReferencesListDialog(sr, bl, bc);  +        } +      } +    } +      ////////////////////////////////////////////////////////////////////////////      // UTILITY METHODS diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SecureViewerDialog.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SecureViewerDialog.java index 878a998b..7bae4673 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SecureViewerDialog.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/SecureViewerDialog.java @@ -17,12 +17,15 @@  package at.gv.egiz.bku.gui;  import at.gv.egiz.bku.gui.viewer.FontProvider; +import at.gv.egiz.bku.gui.viewer.FontProviderException; +import at.gv.egiz.bku.gui.viewer.SecureViewerSaveDialog;  import at.gv.egiz.stal.HashDataInput;  import java.awt.Container;  import java.awt.Cursor;  import java.awt.Dimension;  import java.awt.Font;  import java.awt.Frame; +import java.awt.Window;  import java.awt.event.ActionEvent;  import java.awt.event.ActionListener;  import java.awt.event.FocusAdapter; @@ -41,6 +44,9 @@ import java.io.InputStreamReader;  import java.io.Reader;  import java.nio.charset.Charset;  import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.List; +import java.util.Locale;  import java.util.ResourceBundle;  import javax.swing.GroupLayout;  import javax.swing.ImageIcon; @@ -72,6 +78,12 @@ public class SecureViewerDialog extends JDialog implements ActionListener {     * BKUViewer has compile dependency BKUFonts, transitive in BKUOnline and BKULocal     */    public static final Dimension VIEWER_DIMENSION = new Dimension(600, 400); +   +  public static final List<String> SUPPORTED_MIME_TYPES = new ArrayList<String>(); +  static { +    SUPPORTED_MIME_TYPES.add("text/plain"); +    SUPPORTED_MIME_TYPES.add("application/xhtml+xml"); +  }    protected static final Log log = LogFactory.getLog(SecureViewerDialog.class);  //  private static SecureViewerDialog dialog;    protected ResourceBundle messages; @@ -102,7 +114,7 @@ public class SecureViewerDialog extends JDialog implements ActionListener {  //    dialog.setVisible(true);  //  }    public SecureViewerDialog(Frame owner, ResourceBundle messages, -          //          ActionListener saveListener, String saveCommand, +          ActionListener closeListener, String closeCommand,            FontProvider fontProvider, ActionListener helpListener) {      super(owner, messages.getString(BKUGUIFacade.WINDOWTITLE_VIEWER), true);      this.setIconImages(BKUIcons.icons); @@ -111,7 +123,7 @@ public class SecureViewerDialog extends JDialog implements ActionListener {      initContentPane(VIEWER_DIMENSION,              createViewerPanel(helpListener), -            createButtonPanel()); //saveListener, saveCommand)); +            createButtonPanel(closeListener, closeCommand));      pack();      if (owner != null) { @@ -289,15 +301,22 @@ public class SecureViewerDialog extends JDialog implements ActionListener {      toFront();    } -  private JPanel createButtonPanel() { //ActionListener saveListener, String saveCommand) { +  private JPanel createButtonPanel(ActionListener closeListener, String closeCommand) {      JButton closeButton = new JButton();      closeButton.setText(messages.getString(BKUGUIFacade.BUTTON_CLOSE)); -    closeButton.setActionCommand("close"); -    closeButton.addActionListener(this); +    closeButton.setActionCommand(closeCommand); +    closeButton.addActionListener(closeListener); +    closeButton.addActionListener(new ActionListener() { +      @Override +      public void actionPerformed(ActionEvent e) { +        log.trace("[" + Thread.currentThread().getName() + "] closing secure viewer"); +        setVisible(false); +      } +    });      JButton saveButton = new JButton();      saveButton.setText(messages.getString(BKUGUIFacade.BUTTON_SAVE)); -    saveButton.setActionCommand("save"); +    saveButton.setActionCommand("save"); //TODO ensure unequal to closeCommand       saveButton.addActionListener(this);      int buttonSize = closeButton.getPreferredSize().width; @@ -319,100 +338,37 @@ public class SecureViewerDialog extends JDialog implements ActionListener {    @Override    public void actionPerformed(ActionEvent e) { -    if ("close".equals(e.getActionCommand())) { -      log.trace("[" + Thread.currentThread().getName() + "] closing secure viewer"); -      setVisible(false); -      log.trace("secure viewer closed"); -    } else if ("save".equals(e.getActionCommand())) { +    if ("save".equals(e.getActionCommand())) {        log.trace("[" + Thread.currentThread().getName() + "] display secure viewer save dialog"); -      showSaveDialog(content, null, null); +      SecureViewerSaveDialog.showSaveDialog(content, messages, null, null);        log.trace("done secure viewer save");      } else {        log.warn("unknown action command " + e.getActionCommand());      }    } +   +   +//  //TEST +//  private static SecureViewerDialog secureViewer; +//  public static void showSecureViewerXXX(HashDataInput dataToBeSigned, ResourceBundle messages, FontProvider fontProvider, ActionListener helpListener, boolean alwaysOnTop) throws FontProviderException { +//     +////    ResourceBundle messages = ResourceBundle.getBundle(BKUGUIFacade.MESSAGES_BUNDLE, locale); +//     +//    log.debug("[" + Thread.currentThread().getName() + "] show secure viewer"); +//    if (secureViewer == null) { +//      secureViewer = new SecureViewerDialog(null, messages, +//              fontProvider, helpListener);  +// +//      // workaround for [#439] +//      // avoid AlwaysOnTop at least in applet, otherwise make secureViewer AlwaysOnTop since MOCCA Dialog (JFrame created in LocalSTALFactory) is always on top. +////      Window window = SwingUtilities.getWindowAncestor(contentPane); +////      if (window != null && window.isAlwaysOnTop()) { +////        log.debug("make secureViewer alwaysOnTop"); +//        secureViewer.setAlwaysOnTop(alwaysOnTop); +////      } +//    } +//    secureViewer.setContent(dataToBeSigned); +//    log.trace("show secure viewer returned"); +//  } -  private void showSaveDialog(final HashDataInput hashDataInput, -          final ActionListener okListener, final String okCommand) { - -    log.debug("[" + Thread.currentThread().getName() + "] scheduling save dialog"); - -    SwingUtilities.invokeLater(new Runnable() { - -      @Override -      public void run() { - -        log.debug("[" + Thread.currentThread().getName() + "] show save dialog"); - -        String userHome = System.getProperty("user.home"); - -        JFileChooser fileDialog = new JFileChooser(userHome); -        fileDialog.setMultiSelectionEnabled(false); -        fileDialog.setDialogType(JFileChooser.SAVE_DIALOG); -        fileDialog.setFileHidingEnabled(true); -        fileDialog.setDialogTitle(messages.getString(BKUGUIFacade.WINDOWTITLE_SAVE)); -        fileDialog.setFileSelectionMode(JFileChooser.FILES_ONLY); -        String mimeType = hashDataInput.getMimeType(); -        MimeFilter mimeFilter = new MimeFilter(mimeType, messages); -        fileDialog.setFileFilter(mimeFilter); -        String filename = messages.getString(BKUGUIFacade.SAVE_HASHDATAINPUT_PREFIX) + -                MimeFilter.getExtension(mimeType); -        fileDialog.setSelectedFile(new File(userHome, filename)); - -        //parent contentPane -> placed over applet -        switch (fileDialog.showSaveDialog(fileDialog)) { -          case JFileChooser.APPROVE_OPTION: -            File file = fileDialog.getSelectedFile(); -            String id = hashDataInput.getReferenceId(); -            if (file.exists()) { -              String msgPattern = messages.getString(BKUGUIFacade.MESSAGE_OVERWRITE); -              int overwrite = JOptionPane.showConfirmDialog(fileDialog, -                      MessageFormat.format(msgPattern, file), -                      messages.getString(BKUGUIFacade.WINDOWTITLE_OVERWRITE), -                      JOptionPane.OK_CANCEL_OPTION); -              if (overwrite != JOptionPane.OK_OPTION) { -                return; -              } -            } -            if (log.isDebugEnabled()) { -              log.debug("writing hashdata input " + id + " (" + mimeType + ") to file " + file); -            } -            FileOutputStream fos = null; -            try { -              fos = new FileOutputStream(file); -              BufferedOutputStream bos = new BufferedOutputStream(fos); -              InputStream hdi = hashDataInput.getHashDataInput(); -              int b; -              while ((b = hdi.read()) != -1) { -                bos.write(b); -              } -              bos.flush(); -              bos.close(); -            } catch (IOException ex) { -              log.error("Failed to write " + file + ": " + ex.getMessage()); -              log.debug(ex); -              String errPattern = messages.getString(BKUGUIFacade.ERR_WRITE_HASHDATA); -              JOptionPane.showMessageDialog(fileDialog, -                      MessageFormat.format(errPattern, ex.getMessage()), -                      messages.getString(BKUGUIFacade.WINDOWTITLE_ERROR), -                      JOptionPane.ERROR_MESSAGE); -            } finally { -              try { -                if (fos != null) { -                  fos.close(); -                } -              } catch (IOException ex) { -              } -            } -            break; -          case JFileChooser.CANCEL_OPTION: -            log.debug("cancelled save dialog"); -            break; -        } -        if (okListener != null) { -          okListener.actionPerformed(new ActionEvent(fileDialog, ActionEvent.ACTION_PERFORMED, okCommand)); -        } -      } -    }); -  }  } diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/MimeFilter.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/viewer/MimeFilter.java index 4b48081a..c0385dce 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/MimeFilter.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/viewer/MimeFilter.java @@ -14,7 +14,7 @@  * See the License for the specific language governing permissions and  * limitations under the License.  */ -package at.gv.egiz.bku.gui; +package at.gv.egiz.bku.gui.viewer;  import java.io.File;  import java.util.ResourceBundle; @@ -32,6 +32,7 @@ class MimeFilter extends FileFilter {    private static final String MIMETYPE_DESC_TXT = "mimetype.desc.txt";    private static final String MIMETYPE_DESC_PDF = "mimetype.desc.pdf";    private static final String MIMETYPE_DESC_BIN = "mimetype.desc.bin"; +  private static final String MIMETYPE_DESC_UNKNOWN = "mimetype.desc.unknown";    protected String mimeType;    protected ResourceBundle messages; @@ -87,8 +88,10 @@ class MimeFilter extends FileFilter {        return messages.getString(MIMETYPE_DESC_TXT);      } else if ("application/pdf".equals(mimeType)) {        return messages.getString(MIMETYPE_DESC_PDF); -    } else { +    } else if ("application/octet-stream".equals(mimeType)) {        return messages.getString(MIMETYPE_DESC_BIN); +    } else { +      return messages.getString(MIMETYPE_DESC_UNKNOWN);      }    } @@ -103,8 +106,10 @@ class MimeFilter extends FileFilter {        return ".txt";      } else if ("application/pdf".equals(mimeType)) {        return ".pdf"; -    } else { +    } else if ("application/octet-stream".equals(mimeType)) {        return ".bin"; +    } else { +      return "";      }    }  }
\ No newline at end of file diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/viewer/SecureViewerSaveDialog.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/viewer/SecureViewerSaveDialog.java new file mode 100644 index 00000000..40133f95 --- /dev/null +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/viewer/SecureViewerSaveDialog.java @@ -0,0 +1,120 @@ +package at.gv.egiz.bku.gui.viewer; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.text.MessageFormat; +import java.util.Locale; +import java.util.ResourceBundle; + +import javax.swing.JFileChooser; +import javax.swing.JOptionPane; +import javax.swing.SwingUtilities; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import at.gv.egiz.bku.gui.BKUGUIFacade; +import at.gv.egiz.stal.HashDataInput; + +public class SecureViewerSaveDialog { + +  protected static final Log log = LogFactory.getLog(SecureViewerSaveDialog.class); +     +  public static void showSaveDialog(final HashDataInput hashDataInput, final ResourceBundle messages, +      final ActionListener okListener, final String okCommand) { + +    log.debug("[" + Thread.currentThread().getName() +        + "] scheduling save dialog"); + +    SwingUtilities.invokeLater(new Runnable() { + +      @Override +      public void run() { + +        log +            .debug("[" + Thread.currentThread().getName() +                + "] show save dialog"); + +        String userHome = System.getProperty("user.home"); + +        JFileChooser fileDialog = new JFileChooser(userHome); +        fileDialog.setMultiSelectionEnabled(false); +        fileDialog.setDialogType(JFileChooser.SAVE_DIALOG); +        fileDialog.setFileHidingEnabled(true); +        fileDialog.setDialogTitle(messages +            .getString(BKUGUIFacade.WINDOWTITLE_SAVE)); +        fileDialog.setFileSelectionMode(JFileChooser.FILES_ONLY); +        String mimeType = hashDataInput.getMimeType(); +        MimeFilter mimeFilter = new MimeFilter(mimeType, messages); +        fileDialog.setFileFilter(mimeFilter); +        String filename = messages +            .getString(BKUGUIFacade.SAVE_HASHDATAINPUT_PREFIX) +            + MimeFilter.getExtension(mimeType); +        fileDialog.setSelectedFile(new File(userHome, filename)); + +        // parent contentPane -> placed over applet +        switch (fileDialog.showSaveDialog(fileDialog)) { +        case JFileChooser.APPROVE_OPTION: +          File file = fileDialog.getSelectedFile(); +          String id = hashDataInput.getReferenceId(); +          if (file.exists()) { +            String msgPattern = messages +                .getString(BKUGUIFacade.MESSAGE_OVERWRITE); +            int overwrite = JOptionPane.showConfirmDialog(fileDialog, +                MessageFormat.format(msgPattern, file), messages +                    .getString(BKUGUIFacade.WINDOWTITLE_OVERWRITE), +                JOptionPane.OK_CANCEL_OPTION); +            if (overwrite != JOptionPane.OK_OPTION) { +              break; +            } +          } +          if (log.isDebugEnabled()) { +            log.debug("writing hashdata input " + id + " (" + mimeType +                + ") to file " + file); +          } +          FileOutputStream fos = null; +          try { +            fos = new FileOutputStream(file); +            BufferedOutputStream bos = new BufferedOutputStream(fos); +            InputStream hdi = hashDataInput.getHashDataInput(); +            int b; +            while ((b = hdi.read()) != -1) { +              bos.write(b); +            } +            bos.flush(); +            bos.close(); +          } catch (IOException ex) { +            log.error("Failed to write " + file + ": " + ex.getMessage()); +            log.debug(ex); +            String errPattern = messages +                .getString(BKUGUIFacade.ERR_WRITE_HASHDATA); +            JOptionPane.showMessageDialog(fileDialog, MessageFormat.format( +                errPattern, ex.getMessage()), messages +                .getString(BKUGUIFacade.WINDOWTITLE_ERROR), +                JOptionPane.ERROR_MESSAGE); +          } finally { +            try { +              if (fos != null) { +                fos.close(); +              } +            } catch (IOException ex) { +            } +          } +          break; +        case JFileChooser.CANCEL_OPTION: +          log.debug("cancelled save dialog"); +          break; +        } +        if (okListener != null) { +          okListener.actionPerformed(new ActionEvent(fileDialog, +              ActionEvent.ACTION_PERFORMED, okCommand)); +        } +      } +    }); +  } +} diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties index b458a214..7135b561 100644 --- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages.properties @@ -20,6 +20,7 @@ title.cardnotsupported=<html>Die Karte wird nicht unterst\u00FCtzt</html>  title.cardpin=<html>Karte wird gelesen</html>  title.sign=<html>Signatur erstellen</html>  title.error=<html>Fehler</html> +title.warning=<html>Achtung  title.entry.timeout=<html>Zeit\u00FCberschreitung</html>  title.retry=<html>Falsche PIN</html>  title.wait=<html>Bitte warten</html> @@ -46,6 +47,8 @@ hashdatalink.tiny.focus=<html><a href=\"anzeige\">[Signaturdaten]</a></html>  #message.hashdata=<html>Dies ist eine Voransicht des zu signierenden Inhaltes. F\u00FCr Details siehe Hilfe (i).</html>   #verwenden sie bitte die von ihrem System zur Verf\u00FCgung gestellte {0} Anwendung.   hashdatalist=<html>{0} Signaturdaten:</html> +hashdata.viewer=<html>Signaturdaten werden im Betrachter angezeigt +unsupported.mimetype=<html>Signaturdaten können nicht angezeigt werden  retries.last=<html>Letzter Versuch!</html>  retries=<html>Noch {0} Versuche</html>  retries.pinpad.last=<html>Eingabe wiederholen, letzter Versuch!</html> @@ -68,6 +71,7 @@ mimetype.desc.xhtml=XHTML-Dateien (.xhtml)  mimetype.desc.txt=Textdateien (.txt)  mimetype.desc.pdf=Adobe PDF-Dateien (.pdf)  mimetype.desc.bin=Bin\u00E4rdateien (.bin) +mimetype.desc.unknown=Alle Dateien (.*)  save.hashdatainput.prefix=Signaturdaten  alt.help=Hilfe diff --git a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties index 109b4faa..6e89510e 100644 --- a/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties +++ b/BKUCommonGUI/src/main/resources/at/gv/egiz/bku/gui/Messages_en.properties @@ -54,7 +54,7 @@ retries.pinpad=<html>Re-enter pin, {0} tries left</html>  overwrite=<html>Overwrite {0}?</html>  help=<html>Help topic {0}</html> -warning.xhtml=<html>Remark: This is a preview of the data to-be signed. For standards compliant display see help.</html> +warning.xhtml=<html>Remark: This is a preview of the data to-be signed. For standard-compliant display see help.</html>  label.pin=<html>{0}:</html>  label.pinsize=<html>({0} digits)</html>  button.ok=OK diff --git a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/SecureViewerDialogTest.java b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/SecureViewerDialogTest.java index fc8dcd96..131a344f 100644 --- a/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/SecureViewerDialogTest.java +++ b/BKUCommonGUI/src/test/java/at/gv/egiz/bku/gui/SecureViewerDialogTest.java @@ -7,6 +7,8 @@ package at.gv.egiz.bku.gui;  import at.gv.egiz.stal.impl.ByteArrayHashDataInput;  import java.awt.Font; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener;  import java.io.BufferedInputStream;  import java.io.FileInputStream;  import java.io.FileNotFoundException; @@ -33,7 +35,7 @@ public class SecureViewerDialogTest {    @BeforeClass    public static void setUpClass() throws Exception {      messages = ResourceBundle.getBundle("at/gv/egiz/bku/gui/Messages"); -    secureViewer = new SecureViewerDialog(null, messages, new DummyFontLoader(), null); +    secureViewer = new SecureViewerDialog(null, messages,null, null, new DummyFontLoader(), null);    }    @AfterClass diff --git a/BKUHelp/src/main/webapp/help/de/help.unsupported.mimetype.html b/BKUHelp/src/main/webapp/help/de/help.unsupported.mimetype.html new file mode 100644 index 00000000..09440dc2 --- /dev/null +++ b/BKUHelp/src/main/webapp/help/de/help.unsupported.mimetype.html @@ -0,0 +1,41 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 +<html xmlns="http://www.w3.org/1999/xhtml">
 +<head>
 +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 +<title>Bürgerkarte - Hilfe</title>
 +<link href="../help.css" rel="stylesheet" type="text/css" />
 +<link rel="shortcut icon" href="../chip16.ico" type="image/x-icon"/>
 +<!--[if IE]>
 +<style type="text/css"> 
 +/* place css fixes for all versions of IE in this conditional comment */
 +.twoColElsLtHdr #sidebar1 { padding-top: 30px; }
 +.twoColElsLtHdr #mainContent { zoom: 1; padding-top: 15px; }
 +/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
 +</style>
 +<![endif]-->
 +</head>
 +
 +<body class="twoColElsLtHdr">
 +
 +<div id="container">
 +  <div id="header">
 +    <h1>Online-Hilfe</h1>
 +    <!-- end #header --></div>
 +  <div id="sidebar1">
 +    <p><img src="help.unsupported.mimetype.png" alt="Bildschirmfoto des Applets" height="130" width="150"/></p>
 +    <p><strong>Hinweis:</strong> Das Bildschirmfoto oben kann von der Darstellung in der Webseite abweichen.</p>
 +    <!-- end #sidebar1 --></div>
 +  <div id="mainContent">
 +    <h1>Signaturdaten können nicht dargestellt werden</h1>
 +    <p>Die Signaturdatenanzeige unterstützt reine Textdaten sowie XHTML, andere MIME-Typen können nicht angezeigt werden.
 +    Um die Daten standardkonform darzustellen, müssen diese abgespeichert und mit einem geeigneten externen Betrachter geöffnen werden.</p>
 +     <p><br class="clearfloat" /></p>
 +  </div>
 +  <div id="footer">
 +  	<p>
 +    	<a href="http://www.buergerkarte.at">Österreichische Bürgerkarte</a> | <a href="http://mocca.egovlabs.gv.at">Bürgerkartensoftware MOCCA</a>
 +    </p>
 +  </div>
 +<!-- end #container --></div>
 +</body>
 +</html>
 diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java index 08b4d7de..2ca108e0 100644 --- a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java +++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/STALServiceImpl.java @@ -37,12 +37,16 @@ import at.gv.egiz.stal.service.types.QuitRequestType;  import at.gv.egiz.stal.service.types.RequestType;  import at.gv.egiz.stal.service.types.ResponseType;  import at.gv.egiz.stal.service.types.SignRequestType; +import at.gv.egiz.stal.service.types.GetHashDataInputType.Reference; +//import at.gv.egiz.stal.service.types.GetHashDataInputResponseType.Reference; +  import com.sun.xml.ws.developer.UsesJAXBContext;  import java.io.ByteArrayOutputStream;  import java.io.IOException;  import java.io.InputStream;  import java.nio.charset.Charset;  import java.util.HashMap; +import java.util.Iterator;  import java.util.List;  import java.util.Map;  import javax.annotation.Resource; @@ -204,113 +208,97 @@ public class STALServiceImpl implements STALPortType {        log.debug("Received GetHashDataInputRequest for session " + sessionId + " containing " + request.getReference().size() + " reference(s)");      } +    if (TEST_SESSION_ID.equals(sessionId)) { +      return getTestSessionHashDataInputResponse(request.getReference()); +    } +          GetHashDataInputResponseType response = new GetHashDataInputResponseType();      response.setSessionId(sessionId.toString()); -    if (TEST_SESSION_ID.equals(sessionId)) { -      log.debug("Received GetHashDataInput for session " + TEST_SESSION_ID + ", return DummyHashDataInput"); -      GetHashDataInputResponseType.Reference ref = new GetHashDataInputResponseType.Reference(); -      ref.setID("signed-data-reference-0-1214921968-27971781-24309"); //Reference-" + TEST_SESSION_ID + "-001"); -      ref.setMimeType("text/plain"); - -      Charset charset; -      try { -        charset = Charset.forName("iso-8859-15"); -        ref.setEncoding("iso-8859-15"); -      } catch (Exception ex) { -        log.warn(ex.getMessage()); -        charset = Charset.defaultCharset(); -        ref.setEncoding(charset.toString()); -      } -      ref.setValue("hashdatainput-öäüß@€-00000000001".getBytes(charset)); -      response.getReference().add(ref); -      return response; -    } else { -      STALRequestBroker stal = getStal(sessionId); +    STALRequestBroker stal = getStal(sessionId); -      if (stal != null) { -        List<HashDataInput> hashDataInputs = stal.getHashDataInput(); +    if (stal != null) { +      List<HashDataInput> hashDataInputs = stal.getHashDataInput(); -        if (hashDataInputs != null) { +      if (hashDataInputs != null) { -          Map<String, HashDataInput> hashDataIdMap = new HashMap<String, HashDataInput>(); -          for (HashDataInput hdi : hashDataInputs) { -            if (log.isTraceEnabled()) { -              log.trace("Provided HashDataInput for reference " + hdi.getReferenceId()); -            } -            hashDataIdMap.put(hdi.getReferenceId(), hdi); +        Map<String, HashDataInput> hashDataIdMap = new HashMap<String, HashDataInput>(); +        for (HashDataInput hdi : hashDataInputs) { +          if (log.isTraceEnabled()) { +            log.trace("Provided HashDataInput for reference " + hdi.getReferenceId());            } +          hashDataIdMap.put(hdi.getReferenceId(), hdi); +        } -          List<GetHashDataInputType.Reference> reqRefs = request.getReference(); -          for (GetHashDataInputType.Reference reqRef : reqRefs) { -            String reqRefId = reqRef.getID(); -            HashDataInput reqHdi = hashDataIdMap.get(reqRefId); -            if (reqHdi == null) { -              String msg = "Failed to resolve HashDataInput for reference " + reqRefId; -              log.error(msg); -              GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType(); -              faultInfo.setErrorCode(1); -              faultInfo.setErrorMessage(msg); -              throw new GetHashDataInputFault(msg, faultInfo); -            } +        List<GetHashDataInputType.Reference> reqRefs = request.getReference(); +        for (GetHashDataInputType.Reference reqRef : reqRefs) { +          String reqRefId = reqRef.getID(); +          HashDataInput reqHdi = hashDataIdMap.get(reqRefId); +          if (reqHdi == null) { +            String msg = "Failed to resolve HashDataInput for reference " + reqRefId; +            log.error(msg); +            GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType(); +            faultInfo.setErrorCode(1); +            faultInfo.setErrorMessage(msg); +            throw new GetHashDataInputFault(msg, faultInfo); +          } -            InputStream hashDataIS = reqHdi.getHashDataInput(); -            if (hashDataIS == null) { -              //HashDataInput not cached? -              String msg = "Failed to obtain HashDataInput for reference " + reqRefId + ", reference not cached"; -              log.error(msg); -              GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType(); -              faultInfo.setErrorCode(1); -              faultInfo.setErrorMessage(msg); -              throw new GetHashDataInputFault(msg, faultInfo); +          InputStream hashDataIS = reqHdi.getHashDataInput(); +          if (hashDataIS == null) { +            //HashDataInput not cached? +            String msg = "Failed to obtain HashDataInput for reference " + reqRefId + ", reference not cached"; +            log.error(msg); +            GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType(); +            faultInfo.setErrorCode(1); +            faultInfo.setErrorMessage(msg); +            throw new GetHashDataInputFault(msg, faultInfo); +          } +          ByteArrayOutputStream baos = null; +          try { +            if (log.isDebugEnabled()) { +              log.debug("Resolved HashDataInput " + reqRefId + " (" + reqHdi.getMimeType() + ";charset=" + reqHdi.getEncoding() + ")"); +            } +            baos = new ByteArrayOutputStream(hashDataIS.available()); +            int c; +            while ((c = hashDataIS.read()) != -1) { +              baos.write(c);              } -            ByteArrayOutputStream baos = null; +            GetHashDataInputResponseType.Reference ref = new GetHashDataInputResponseType.Reference(); +            ref.setID(reqRefId); +            ref.setMimeType(reqHdi.getMimeType()); +            ref.setEncoding(reqHdi.getEncoding()); +            ref.setValue(baos.toByteArray()); +            response.getReference().add(ref); +          } catch (IOException ex) { +            String msg = "Failed to get HashDataInput for reference " + reqRefId; +            log.error(msg, ex); +            GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType(); +            faultInfo.setErrorCode(1); +            faultInfo.setErrorMessage(msg); +            throw new GetHashDataInputFault(msg, faultInfo, ex); +          } finally {              try { -              if (log.isDebugEnabled()) { -                log.debug("Resolved HashDataInput " + reqRefId + " (" + reqHdi.getMimeType() + ";charset=" + reqHdi.getEncoding() + ")"); -              } -              baos = new ByteArrayOutputStream(hashDataIS.available()); -              int c; -              while ((c = hashDataIS.read()) != -1) { -                baos.write(c); -              } -              GetHashDataInputResponseType.Reference ref = new GetHashDataInputResponseType.Reference(); -              ref.setID(reqRefId); -              ref.setMimeType(reqHdi.getMimeType()); -              ref.setEncoding(reqHdi.getEncoding()); -              ref.setValue(baos.toByteArray()); -              response.getReference().add(ref); +              baos.close();              } catch (IOException ex) { -              String msg = "Failed to get HashDataInput for reference " + reqRefId; -              log.error(msg, ex); -              GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType(); -              faultInfo.setErrorCode(1); -              faultInfo.setErrorMessage(msg); -              throw new GetHashDataInputFault(msg, faultInfo, ex); -            } finally { -              try { -                baos.close(); -              } catch (IOException ex) { -              }              }            } -          return response; -        } else { -          String msg = "Failed to resolve any HashDataInputs for session " + sessionId; -          log.error(msg); -          GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType(); -          faultInfo.setErrorCode(1); -          faultInfo.setErrorMessage(msg); -          throw new GetHashDataInputFault(msg, faultInfo);          } +        return response;        } else { -        String msg = "Session timeout"; //Failed to get STAL for session " + sessionId; -        log.error(msg + " " + sessionId); +        String msg = "Failed to resolve any HashDataInputs for session " + sessionId; +        log.error(msg);          GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType();          faultInfo.setErrorCode(1);          faultInfo.setErrorMessage(msg);          throw new GetHashDataInputFault(msg, faultInfo);        } +    } else { +      String msg = "Session timeout"; //Failed to get STAL for session " + sessionId; +      log.error(msg + " " + sessionId); +      GetHashDataInputFaultType faultInfo = new GetHashDataInputFaultType(); +      faultInfo.setErrorCode(1); +      faultInfo.setErrorMessage(msg); +      throw new GetHashDataInputFault(msg, faultInfo);      }    } @@ -332,45 +320,83 @@ public class STALServiceImpl implements STALPortType {      List<JAXBElement<? extends RequestType>> reqs = response.getInfoboxReadRequestOrSignRequestOrQuitRequest();      if (responsesIn == null) { -      log.info("[TestSession] received CONNECT, return dummy requests "); -//      addDummyRequests(reqs); -      ScriptType scriptT = ccObjFactory.createScriptType(); -      CommandAPDUType cmd = ccObjFactory.createCommandAPDUType(); -      cmd.setValue("TestSession CardChannelCMD 1234".getBytes()); -      scriptT.getResetOrCommandAPDUOrVerifyAPDU().add(cmd); -      reqs.add(ccObjFactory.createScript(scriptT)); +      log.info("[TestSession] CONNECT"); +//      addTestCardChannelRequest(reqs); +//      addTestInfoboxReadRequest("IdentityLink", reqs); +//      addTestInfoboxReadRequest("SecureSignatureKeypair", reqs); +//      addTestInfoboxReadRequest("CertifiedKeypair", reqs); +      addTestSignatureRequests("SecureSignatureKeypair", reqs);      } else if (responsesIn != null && responsesIn.size() > 0 && responsesIn.get(0).getValue() instanceof ErrorResponseType) {        log.info("[TestSession] received ErrorResponse, return QUIT request");        QuitRequestType quitT = stalObjFactory.createQuitRequestType();        reqs.add(stalObjFactory.createGetNextRequestResponseTypeQuitRequest(quitT));      } else { -      log.info("[TestSession] received " + responsesIn.size() + " response(s), return dummy requests" ); -      addDummyRequests(reqs); +      log.info("[TestSession] received " + responsesIn.size() + " response(s), return QUIT" ); +      QuitRequestType quitT = stalObjFactory.createQuitRequestType(); +      reqs.add(stalObjFactory.createGetNextRequestResponseTypeQuitRequest(quitT)); +    } +    return response; +  } +   +   +  private GetHashDataInputResponseType getTestSessionHashDataInputResponse(List<Reference> references) { +    log.debug("[TestSession] received GET_HASHDATAINPUT"); +     +    GetHashDataInputResponseType response = new GetHashDataInputResponseType(); +    response.setSessionId(TEST_SESSION_ID.toString()); +     +    for (Reference reference : references) { +      String refId = reference.getID(); +      log.debug("[TestSession] adding hashdata input for " + refId); +      GetHashDataInputResponseType.Reference ref = new GetHashDataInputResponseType.Reference(); +      ref.setID(refId); +      ref.setMimeType(TestSignatureData.HASHDATA_MIMETYPES.get(refId)); //todo resolve from TestSignatureData +      ref.setValue(TestSignatureData.HASHDATA_INPUT.get(refId)); +      ref.setEncoding(TestSignatureData.ENCODING); +      response.getReference().add(ref);      } +//    GetHashDataInputResponseType.Reference ref = new GetHashDataInputResponseType.Reference(); +//    ref.setID("signed-data-reference-0-1214921968-27971781-24309"); //Reference-" + TEST_SESSION_ID + "-001"); +//    ref.setMimeType("text/plain"); + +//    Charset charset; +//    try { +//      charset = Charset.forName("iso-8859-15"); +//      ref.setEncoding("iso-8859-15"); +//    } catch (Exception ex) { +//      log.warn(ex.getMessage()); +//      charset = Charset.defaultCharset(); +//      ref.setEncoding(charset.toString()); +//    } +//    ref.setValue("hashdatainput-öäüß@€-00000000001".getBytes(charset)); +     +//    ref.setValue("Ich bin ein einfacher Text. llšŠŸ§Û".getBytes()); +//    response.getReference().add(ref);      return response;    } +   +  private void addTestCardChannelRequest(List<JAXBElement<? extends RequestType>> requestList) { +    log.info("[TestSession] add CARDCHANNEL request"); +    ScriptType scriptT = ccObjFactory.createScriptType(); +    CommandAPDUType cmd = ccObjFactory.createCommandAPDUType(); +    cmd.setValue("TestSession CardChannelCMD 1234".getBytes()); +    scriptT.getResetOrCommandAPDUOrVerifyAPDU().add(cmd); +    requestList.add(ccObjFactory.createScript(scriptT)); +  } -  private void addDummyRequests(List<JAXBElement<? extends RequestType>> reqs) { -//    log.info("[TestSession] add READ request for Infobox IdentityLink"); -//    InfoboxReadRequestType ibrT1 = stalObjFactory.createInfoboxReadRequestType(); -//    ibrT1.setInfoboxIdentifier("IdentityLink"); -//    reqs.add(stalObjFactory.createGetNextRequestResponseTypeInfoboxReadRequest(ibrT1)); - -    log.info("[TestSession] add READ request for Infobox CertifiedKeypair"); -    InfoboxReadRequestType ibrT2 = stalObjFactory.createInfoboxReadRequestType(); -    ibrT2.setInfoboxIdentifier("CertifiedKeypair"); -    reqs.add(stalObjFactory.createGetNextRequestResponseTypeInfoboxReadRequest(ibrT2)); - -    log.info("[TestSession] add READ request for Infobox SecureSignatureKeypair"); -    InfoboxReadRequestType ibrT3 = stalObjFactory.createInfoboxReadRequestType(); -    ibrT3.setInfoboxIdentifier("SecureSignatureKeypair"); -    reqs.add(stalObjFactory.createGetNextRequestResponseTypeInfoboxReadRequest(ibrT3)); - -    log.info("[TestSession] add SIGN request"); -    SignRequestType sigT1 = stalObjFactory.createSignRequestType(); -    sigT1.setKeyIdentifier("SecureSignatureKeypair"); -    sigT1.setSignedInfo("<dsig:SignedInfo  xmlns:dsig=\"http://www.w3.org/2000/09/xmldsig#\" xmlns:xpf=\"http://www.w3.org/2002/06/xmldsig-filter2\"><dsig:CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\" /> <dsig:SignatureMethod Algorithm=\"http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1\" /> <dsig:Reference Id=\"signed-data-reference-0-1214921968-27971781-24309\" URI=\"#signed-data-object-0-1214921968-27971781-13578\"><dsig:Transforms> <dsig:Transform Algorithm=\"http://www.w3.org/2002/06/xmldsig-filter2\"> <xpf:XPath xmlns:xpf=\"http://www.w3.org/2002/06/xmldsig-filter2\" Filter=\"intersect\">id('signed-data-object-0-1214921968-27971781-13578')/node()</xpf:XPath></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /> <dsig:DigestValue>H1IePEEfGQ2SG03H6LTzw1TpCuM=</dsig:DigestValue></dsig:Reference><dsig:Reference Id=\"etsi-data-reference-0-1214921968-27971781-25439\" Type=\"http://uri.etsi.org/01903/v1.1.1#SignedProperties\" URI=\"#xmlns(etsi=http://uri.etsi.org/01903/v1.1.1%23)%20xpointer(id('etsi-data-object-0-1214921968-27971781-3095')/child::etsi:QualifyingProperties/child::etsi:SignedProperties)\"><dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><dsig:DigestValue>yV6Q+I60buqR4mMaxA7fi+CV35A=</dsig:DigestValue></dsig:Reference></dsig:SignedInfo>".getBytes()); -    reqs.add(stalObjFactory.createGetNextRequestResponseTypeSignRequest(sigT1)); +  private void addTestInfoboxReadRequest(String infoboxIdentifier, List<JAXBElement<? extends RequestType>> requestList) { +    log.info("[TestSession] add READ "+ infoboxIdentifier + " request"); +    InfoboxReadRequestType ibrT = stalObjFactory.createInfoboxReadRequestType(); +    ibrT.setInfoboxIdentifier(infoboxIdentifier); +    requestList.add(stalObjFactory.createGetNextRequestResponseTypeInfoboxReadRequest(ibrT)); +  } +   +  private void addTestSignatureRequests(String keyIdentifier, List<JAXBElement<? extends RequestType>> reqs) { +    log.info("[TestSession] add SIGN " + keyIdentifier + " request"); +    SignRequestType sigT = stalObjFactory.createSignRequestType(); +    sigT.setKeyIdentifier(keyIdentifier); +    sigT.setSignedInfo(TestSignatureData.SIGNED_INFO.get(1)); //select!  +    reqs.add(stalObjFactory.createGetNextRequestResponseTypeSignRequest(sigT));    }  } diff --git a/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/TestSignatureData.java b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/TestSignatureData.java new file mode 100644 index 00000000..24771d8f --- /dev/null +++ b/BKUOnline/src/main/java/at/gv/egiz/stal/service/impl/TestSignatureData.java @@ -0,0 +1,47 @@ +package at.gv.egiz.stal.service.impl; + +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +public final class TestSignatureData { +   +  protected final static Log log = LogFactory.getLog(TestSignatureData.class); +   +  public static final String[] ID = new String[] {"signed-data-reference-0-1214921968-27971781-24309", "signed-data-reference-1"}; +  public static final String ENCODING = "UTF-8"; +   +  public static final Map<String, byte[]> HASHDATA_INPUT = new HashMap<String, byte[]>(); +  static { +    try { +      HASHDATA_INPUT.put(ID[0], "Ich bin ein einfacher Text. llšŠŸ§Û".getBytes(ENCODING)); +      HASHDATA_INPUT.put(ID[1], "2te referenz".getBytes(ENCODING)); +    } catch (UnsupportedEncodingException ex) { +      log.error("failed to init signature test data", ex); +    } +  } +  public static final Map<String, String> HASHDATA_MIMETYPES = new HashMap<String, String>(); +  static { +      HASHDATA_MIMETYPES.put(ID[0], "text/plain"); +      HASHDATA_MIMETYPES.put(ID[1], "any/mime-type"); +  } +   +//  private static final byte[] signedInfo = "<dsig:SignedInfo  xmlns:dsig=\"http://www.w3.org/2000/09/xmldsig#\" xmlns:xpf=\"http://www.w3.org/2002/06/xmldsig-filter2\"><dsig:CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\" /> <dsig:SignatureMethod Algorithm=\"http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1\" /> <dsig:Reference Id=\"signed-data-reference-0-1214921968-27971781-24309\" URI=\"#signed-data-object-0-1214921968-27971781-13578\"><dsig:Transforms> <dsig:Transform Algorithm=\"http://www.w3.org/2002/06/xmldsig-filter2\"> <xpf:XPath xmlns:xpf=\"http://www.w3.org/2002/06/xmldsig-filter2\" Filter=\"intersect\">id('signed-data-object-0-1214921968-27971781-13578')/node()</xpf:XPath></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /> <dsig:DigestValue>H1IePEEfGQ2SG03H6LTzw1TpCuM=</dsig:DigestValue></dsig:Reference><dsig:Reference Id=\"etsi-data-reference-0-1214921968-27971781-25439\" Type=\"http://uri.etsi.org/01903/v1.1.1#SignedProperties\" URI=\"#xmlns(etsi=http://uri.etsi.org/01903/v1.1.1%23)%20xpointer(id('etsi-data-object-0-1214921968-27971781-3095')/child::etsi:QualifyingProperties/child::etsi:SignedProperties)\"><dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><dsig:DigestValue>yV6Q+I60buqR4mMaxA7fi+CV35A=</dsig:DigestValue></dsig:Reference></dsig:SignedInfo>".getBytes(); +//  private static final byte[] signedInfo2Ref = "<dsig:SignedInfo  xmlns:dsig=\"http://www.w3.org/2000/09/xmldsig#\" xmlns:xpf=\"http://www.w3.org/2002/06/xmldsig-filter2\"><dsig:CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\" /> <dsig:SignatureMethod Algorithm=\"http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1\" /> <dsig:Reference Id=\"signed-data-reference-0-1214921968-27971781-24309\" URI=\"#signed-data-object-0-1214921968-27971781-13578\"><dsig:Transforms> <dsig:Transform Algorithm=\"http://www.w3.org/2002/06/xmldsig-filter2\"> <xpf:XPath xmlns:xpf=\"http://www.w3.org/2002/06/xmldsig-filter2\" Filter=\"intersect\">id('signed-data-object-0-1214921968-27971781-13578')/node()</xpf:XPath></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /> <dsig:DigestValue>H1IePEEfGQ2SG03H6LTzw1TpCuM=</dsig:DigestValue></dsig:Reference><dsig:Reference Id=\"signed-data-reference-1\" URI=\"#signed-data-object-0-1214921968-27971781-13578\"><dsig:Transforms> <dsig:Transform Algorithm=\"http://www.w3.org/2002/06/xmldsig-filter2\"> <xpf:XPath xmlns:xpf=\"http://www.w3.org/2002/06/xmldsig-filter2\" Filter=\"intersect\">id('signed-data-object-1')/node()</xpf:XPath></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /> <dsig:DigestValue>H1IePEEfGQ2SG03H6LTzw1TpCuM=</dsig:DigestValue></dsig:Reference><dsig:Reference Id=\"etsi-data-reference-0-1214921968-27971781-25439\" Type=\"http://uri.etsi.org/01903/v1.1.1#SignedProperties\" URI=\"#xmlns(etsi=http://uri.etsi.org/01903/v1.1.1%23)%20xpointer(id('etsi-data-object-0-1214921968-27971781-3095')/child::etsi:QualifyingProperties/child::etsi:SignedProperties)\"><dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><dsig:DigestValue>yV6Q+I60buqR4mMaxA7fi+CV35A=</dsig:DigestValue></dsig:Reference></dsig:SignedInfo>".getBytes(); +//  private static final String signedInfo2Ref = "<dsig:Reference Id=\"signed-data-reference-1\" URI=\"#signed-data-object-0-1214921968-27971781-13578\"><dsig:Transforms> <dsig:Transform Algorithm=\"http://www.w3.org/2002/06/xmldsig-filter2\"> <xpf:XPath xmlns:xpf=\"http://www.w3.org/2002/06/xmldsig-filter2\" Filter=\"intersect\">id('signed-data-object-1')/node()</xpf:XPath></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /> <dsig:DigestValue>H1IePEEfGQ2SG03H6LTzw1TpCuM=</dsig:DigestValue></dsig:Reference>"; +  /** +   * SIGNED_INFO[0] contains reference ID[0] +   * SIGNED_INFO[1] contains reference ID[0] and ID[1] +   */ +  public static final List<byte[]> SIGNED_INFO = new ArrayList<byte[]>();  +  static { +    SIGNED_INFO.add("<dsig:SignedInfo  xmlns:dsig=\"http://www.w3.org/2000/09/xmldsig#\" xmlns:xpf=\"http://www.w3.org/2002/06/xmldsig-filter2\"><dsig:CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\" /> <dsig:SignatureMethod Algorithm=\"http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1\" /> <dsig:Reference Id=\"signed-data-reference-0-1214921968-27971781-24309\" URI=\"#signed-data-object-0-1214921968-27971781-13578\"><dsig:Transforms> <dsig:Transform Algorithm=\"http://www.w3.org/2002/06/xmldsig-filter2\"> <xpf:XPath xmlns:xpf=\"http://www.w3.org/2002/06/xmldsig-filter2\" Filter=\"intersect\">id('signed-data-object-0-1214921968-27971781-13578')/node()</xpf:XPath></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /> <dsig:DigestValue>H1IePEEfGQ2SG03H6LTzw1TpCuM=</dsig:DigestValue></dsig:Reference><dsig:Reference Id=\"etsi-data-reference-0-1214921968-27971781-25439\" Type=\"http://uri.etsi.org/01903/v1.1.1#SignedProperties\" URI=\"#xmlns(etsi=http://uri.etsi.org/01903/v1.1.1%23)%20xpointer(id('etsi-data-object-0-1214921968-27971781-3095')/child::etsi:QualifyingProperties/child::etsi:SignedProperties)\"><dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><dsig:DigestValue>yV6Q+I60buqR4mMaxA7fi+CV35A=</dsig:DigestValue></dsig:Reference></dsig:SignedInfo>".getBytes()); +    SIGNED_INFO.add("<dsig:SignedInfo  xmlns:dsig=\"http://www.w3.org/2000/09/xmldsig#\" xmlns:xpf=\"http://www.w3.org/2002/06/xmldsig-filter2\"><dsig:CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\" /> <dsig:SignatureMethod Algorithm=\"http://www.w3.org/2001/04/xmldsig-more#ecdsa-sha1\" /> <dsig:Reference Id=\"signed-data-reference-0-1214921968-27971781-24309\" URI=\"#signed-data-object-0-1214921968-27971781-13578\"><dsig:Transforms> <dsig:Transform Algorithm=\"http://www.w3.org/2002/06/xmldsig-filter2\"> <xpf:XPath xmlns:xpf=\"http://www.w3.org/2002/06/xmldsig-filter2\" Filter=\"intersect\">id('signed-data-object-0-1214921968-27971781-13578')/node()</xpf:XPath></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /> <dsig:DigestValue>H1IePEEfGQ2SG03H6LTzw1TpCuM=</dsig:DigestValue></dsig:Reference><dsig:Reference Id=\"signed-data-reference-1\" URI=\"#signed-data-object-0-1214921968-27971781-13578\"><dsig:Transforms> <dsig:Transform Algorithm=\"http://www.w3.org/2002/06/xmldsig-filter2\"> <xpf:XPath xmlns:xpf=\"http://www.w3.org/2002/06/xmldsig-filter2\" Filter=\"intersect\">id('signed-data-object-1')/node()</xpf:XPath></dsig:Transform></dsig:Transforms><dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /> <dsig:DigestValue>H1IePEEfGQ2SG03H6LTzw1TpCuM=</dsig:DigestValue></dsig:Reference><dsig:Reference Id=\"etsi-data-reference-0-1214921968-27971781-25439\" Type=\"http://uri.etsi.org/01903/v1.1.1#SignedProperties\" URI=\"#xmlns(etsi=http://uri.etsi.org/01903/v1.1.1%23)%20xpointer(id('etsi-data-object-0-1214921968-27971781-3095')/child::etsi:QualifyingProperties/child::etsi:SignedProperties)\"><dsig:DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><dsig:DigestValue>yV6Q+I60buqR4mMaxA7fi+CV35A=</dsig:DigestValue></dsig:Reference></dsig:SignedInfo>".getBytes()); +  } +   +} diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/DataObject.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/DataObject.java index 2088a684..89124d16 100644 --- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/DataObject.java +++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/xsect/DataObject.java @@ -293,8 +293,7 @@ public class DataObject {          }        } else { -        log.info("MIME media type '" + mediaType + "' is not a valid digest input."); -        throw new SLViewerException(5001);  +        log.debug("MIME media type '" + mediaType + "' is not a s/valid/SUPPORTED digest input, omitting validation.");        }      } | 
