You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juddi.apache.org by al...@apache.org on 2014/01/30 02:21:33 UTC
svn commit: r1562664 - in /juddi/trunk:
juddi-gui-dsig/src/main/java/org/apache/juddi/gui/dsig/
juddi-gui/src/main/webapp/
Author: alexoree
Date: Thu Jan 30 01:21:33 2014
New Revision: 1562664
URL: http://svn.apache.org/r1562664
Log:
JUDDI-826 making an adjustment. problem not reproducible with chrome on windows, firefox and ie had the issue. fixed
Modified:
juddi/trunk/juddi-gui-dsig/src/main/java/org/apache/juddi/gui/dsig/XmlSigApplet2.form
juddi/trunk/juddi-gui-dsig/src/main/java/org/apache/juddi/gui/dsig/XmlSigApplet2.java
juddi/trunk/juddi-gui/src/main/webapp/businessEditor2.jsp
juddi/trunk/juddi-gui/src/main/webapp/signer.jsp
Modified: juddi/trunk/juddi-gui-dsig/src/main/java/org/apache/juddi/gui/dsig/XmlSigApplet2.form
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-gui-dsig/src/main/java/org/apache/juddi/gui/dsig/XmlSigApplet2.form?rev=1562664&r1=1562663&r2=1562664&view=diff
==============================================================================
--- juddi/trunk/juddi-gui-dsig/src/main/java/org/apache/juddi/gui/dsig/XmlSigApplet2.form (original)
+++ juddi/trunk/juddi-gui-dsig/src/main/java/org/apache/juddi/gui/dsig/XmlSigApplet2.form Thu Jan 30 01:21:33 2014
@@ -8,6 +8,11 @@
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
</Container>
+ <Component class="javax.swing.JButton" name="jButton3">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="jButton3"/>
+ </Properties>
+ </Component>
</NonVisualComponents>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
@@ -19,14 +24,14 @@
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
- <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,30,0,0,1,-128"/>
+ <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,-122,0,0,1,-127"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JTabbedPane" name="jTabbedPane1">
<AccessibilityProperties>
- <Property name="AccessibleContext.accessibleName" type="java.lang.String" value="Sign"/>
+ <Property name="AccessibleContext.accessibleName" type="java.lang.String" value="Key Store"/>
</AccessibilityProperties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
@@ -48,29 +53,37 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
- <Group type="102" alignment="0" attributes="0">
- <EmptySpace max="-2" attributes="0"/>
- <Component id="jScrollPane1" max="32767" attributes="0"/>
- <EmptySpace max="-2" attributes="0"/>
- </Group>
<Group type="102" alignment="1" attributes="0">
- <EmptySpace pref="69" max="32767" attributes="0"/>
+ <EmptySpace pref="70" max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jButton2" min="-2" pref="228" max="-2" attributes="0"/>
<Component id="jButton1" min="-2" pref="228" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="82" max="-2" attributes="0"/>
</Group>
+ <Group type="102" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="jScrollPane1" alignment="1" max="32767" attributes="0"/>
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="jLabel5" min="-2" max="-2" attributes="0"/>
+ <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
- <Component id="jScrollPane1" pref="142" max="32767" attributes="0"/>
- <EmptySpace type="separate" max="-2" attributes="0"/>
+ <Component id="jLabel5" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jScrollPane1" min="-2" pref="222" max="-2" attributes="0"/>
+ <EmptySpace pref="46" max="32767" attributes="0"/>
<Component id="jButton2" min="-2" max="-2" attributes="0"/>
- <EmptySpace min="-2" pref="30" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
<Component id="jButton1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
@@ -113,6 +126,11 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton2ActionPerformed"/>
</Events>
</Component>
+ <Component class="javax.swing.JLabel" name="jLabel5">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="Available Certificates"/>
+ </Properties>
+ </Component>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="jPanel2">
@@ -144,7 +162,7 @@
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
- <Component id="jTextFieldc14n" alignment="0" pref="359" max="32767" attributes="0"/>
+ <Component id="jTextFieldc14n" alignment="0" pref="360" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
@@ -173,7 +191,7 @@
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jTextFieldc14n" min="-2" max="-2" attributes="0"/>
- <EmptySpace pref="23" max="32767" attributes="0"/>
+ <EmptySpace pref="127" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -253,7 +271,7 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
- <Component id="jScrollPane2" pref="359" max="32767" attributes="0"/>
+ <Component id="jScrollPane2" pref="360" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
@@ -262,7 +280,7 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
- <Component id="jScrollPane2" pref="236" max="32767" attributes="0"/>
+ <Component id="jScrollPane2" pref="340" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
@@ -286,6 +304,78 @@
</Container>
</SubComponents>
</Container>
+ <Container class="javax.swing.JPanel" name="jPanel5">
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout" value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
+ <JTabbedPaneConstraints tabName="Key Store" toolTip="">
+ <Property name="tabTitle" type="java.lang.String" value="Key Store"/>
+ <Property name="tabToolTip" type="java.lang.String" value=""/>
+ </JTabbedPaneConstraints>
+ </Constraint>
+ </Constraints>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jLabel7" pref="0" max="32767" attributes="0"/>
+ </Group>
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace min="-2" pref="34" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="jToggleButton1" max="32767" attributes="0"/>
+ <Group type="102" attributes="0">
+ <Component id="jLabel6" min="-2" max="-2" attributes="0"/>
+ <EmptySpace type="separate" max="-2" attributes="0"/>
+ <Component id="jPasswordField1" pref="182" max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ <EmptySpace min="-2" pref="100" max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jLabel7" min="-2" pref="48" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="jPasswordField1" alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="jLabel6" alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jToggleButton1" min="-2" max="-2" attributes="0"/>
+ <EmptySpace pref="248" max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JToggleButton" name="jToggleButton1">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="OK"/>
+ </Properties>
+ <Events>
+ <EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="jToggleButton1MouseClicked"/>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jToggleButton1ActionPerformed"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JPasswordField" name="jPasswordField1">
+ </Component>
+ <Component class="javax.swing.JLabel" name="jLabel6">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="Password"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel" name="jLabel7">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="<html>For Firefox and certain browser and OS combinations, you may need to specify a password in order to get access to certificates. This is typically used for non-Windows users.</html>"/>
+ </Properties>
+ </Component>
+ </SubComponents>
+ </Container>
</SubComponents>
</Container>
</SubComponents>
Modified: juddi/trunk/juddi-gui-dsig/src/main/java/org/apache/juddi/gui/dsig/XmlSigApplet2.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-gui-dsig/src/main/java/org/apache/juddi/gui/dsig/XmlSigApplet2.java?rev=1562664&r1=1562663&r2=1562664&view=diff
==============================================================================
--- juddi/trunk/juddi-gui-dsig/src/main/java/org/apache/juddi/gui/dsig/XmlSigApplet2.java (original)
+++ juddi/trunk/juddi-gui-dsig/src/main/java/org/apache/juddi/gui/dsig/XmlSigApplet2.java Thu Jan 30 01:21:33 2014
@@ -42,477 +42,595 @@ import org.w3c.dom.ls.LSSerializer;
/**
* This is the current Digital Signature Applet used by juddi-gui. It can easily
* be adapted to sign any xml document
+ *
* @author <a href="mailto:alexoree@apache.org>Alex O'Ree</a>
*/
public class XmlSigApplet2 extends java.applet.Applet {
- private static final long serialVersionUID = 1L;
- /**
- * Initializes the applet XmlSigApplet2
- */
- @Override
- public void init() {
- try {
- java.awt.EventQueue.invokeAndWait(new Runnable() {
- public void run() {
- initComponents();
- }
- });
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- setupCertificates();
-
- }
+ private static final long serialVersionUID = 1L;
-
-
- /**
- * this converts a xml document to a string for writing back to the browser
- *
- * @param doc
- * @return string
- */
- public String getStringFromDoc(org.w3c.dom.Document doc) {
- DOMImplementationLS domImplementation = (DOMImplementationLS) doc.getImplementation();
- LSSerializer lsSerializer = domImplementation.createLSSerializer();
- lsSerializer.getDomConfig().setParameter("xml-declaration", false);
- //lsSerializer.getDomConfig().setParameter("xml-declaration", false);
-
- return lsSerializer.writeToString(doc);
- }
- KeyStore keyStore = null;
- KeyStore firefox = null;
-
- private void setupCertificates() {
-
- this.jList1.clearSelection();
- this.jList1.removeAll();
- Vector<String> certs = new Vector<String>();
-
- String keyStoreError = "";
- //covers all modern browsers in windows
- if (System.getProperty("os.name").startsWith("Windows")) {
- try {
- keyStore = KeyStore.getInstance("Windows-MY");
- keyStore.load(null, null);
- } catch (Exception ex) {
- keyStoreError += "Error loading Windows cert store " + ex.getMessage() + "\n";
+ /**
+ * Initializes the applet XmlSigApplet2
+ */
+ @Override
+ public void init() {
+ try {
+ java.awt.EventQueue.invokeAndWait(new Runnable() {
+ public void run() {
+ initComponents();
+ }
+ });
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ setupCertificates();
+
+ }
+
+ /**
+ * this converts a xml document to a string for writing back to the browser
+ *
+ * @param doc
+ * @return string
+ */
+ public String getStringFromDoc(org.w3c.dom.Document doc) {
+ DOMImplementationLS domImplementation = (DOMImplementationLS) doc.getImplementation();
+ LSSerializer lsSerializer = domImplementation.createLSSerializer();
+ lsSerializer.getDomConfig().setParameter("xml-declaration", false);
+ //lsSerializer.getDomConfig().setParameter("xml-declaration", false);
+
+ return lsSerializer.writeToString(doc);
+ }
+ KeyStore keyStore = null;
+ KeyStore firefox = null;
+
+ private void setupCertificates() {
+
+ this.jList1.clearSelection();
+ this.jList1.removeAll();
+ Vector<String> certs = new Vector<String>();
+
+ String keyStoreError = "";
+ //covers all modern browsers in windows
+ if (System.getProperty("os.name").startsWith("Windows")) {
+ try {
+ keyStore = KeyStore.getInstance("Windows-MY");
+ keyStore.load(null, null);
+ } catch (Exception ex) {
+ keyStoreError += "Error loading Windows cert store " + ex.getMessage() + "\n";
//ex.printStackTrace();
- //JOptionPane.showMessageDialog(this, ex.getMessage());
- }
- }
- //firefox keystore
- if (keyStore == null) {
+ //JOptionPane.showMessageDialog(this, ex.getMessage());
+ }
+ }
+ //firefox keystore
+ if (keyStore == null) {
- try {
+ try {
- String strCfg = System.getProperty("user.home") + File.separator
- + "jdk6-nss-mozilla.cfg";
+ String strCfg = System.getProperty("user.home") + File.separator
+ + "jdk6-nss-mozilla.cfg";
// Provider p1 = new sun.security.pkcs11.SunPKCS11(strCfg);
- // Security.addProvider(p1);
- keyStore = KeyStore.getInstance("PKCS11");
- keyStore.load(null, "password".toCharArray());
- } catch (Exception ex) {
- //JOptionPane.showMessageDialog(this, ex.getMessage());
- keyStoreError += "Error loading Firefox cert store " + ex.getMessage() + "\n";
- //ex.printStackTrace();
- }
- }
- //MacOS with Safari possibly others
- if (keyStore == null) {
- try {
- keyStore = KeyStore.getInstance("KeychainStore");
- keyStore.load(null, null);
+ // Security.addProvider(p1);
+ keyStore = KeyStore.getInstance("PKCS11");
+ keyStore.load(null, "password".toCharArray());
+ } catch (Exception ex) {
+ //JOptionPane.showMessageDialog(this, ex.getMessage());
+ keyStoreError += "Error loading Firefox cert store " + ex.getMessage() + "\n";
+ //ex.printStackTrace();
+ }
+ }
+ //MacOS with Safari possibly others
+ if (keyStore == null) {
+ try {
+ keyStore = KeyStore.getInstance("KeychainStore");
+ keyStore.load(null, null);
- } catch (Exception ex) {
+ } catch (Exception ex) {
//JOptionPane.showMessageDialog(this, ex.getMessage());
- //ex.printStackTrace();
- keyStoreError += "Error loading MACOS Key chain cert store " + ex.getMessage()+ "\n";
- }
- }
-
- if (keyStore == null) {
- System.err.println(keyStoreError);
- } else {
- try {
- Enumeration<String> aliases = keyStore.aliases();
-
- while (aliases.hasMoreElements()) {
- String a = aliases.nextElement();
- X509Certificate certificate = (X509Certificate) keyStore.getCertificate(a);
- //this is needed to test for access
-
- try {
- Key key = keyStore.getKey(a, "MyPasswd".toCharArray());
- certs.add(a);
-
- } catch (Exception x) {
- System.out.println("error loading certificate " + a + " " + x.getMessage());
- }
- }
-
- } catch (Exception e) {
- e.printStackTrace();
- JOptionPane.showMessageDialog(this, e.getMessage());
- }
- }
- jList1.setListData(certs);
- if (!certs.isEmpty()) {
- jList1.setSelectedIndex(0);
- }
- }
-
- /**
- * This method is called from within the init() method to initialize the
- * form. WARNING: Do NOT modify this code. The content of this method is
- * always regenerated by the Form Editor.
- */
- // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
- private void initComponents() {
-
- buttonGroup1 = new javax.swing.ButtonGroup();
- jPanel3 = new javax.swing.JPanel();
- jTabbedPane1 = new javax.swing.JTabbedPane();
- jPanel1 = new javax.swing.JPanel();
- jButton1 = new javax.swing.JButton();
- jScrollPane1 = new javax.swing.JScrollPane();
- jList1 = new javax.swing.JList();
- jButton2 = new javax.swing.JButton();
- jPanel2 = new javax.swing.JPanel();
- jLabel1 = new javax.swing.JLabel();
- isIncludeSubjectName = new javax.swing.JCheckBox();
- isIncludePublicKey = new javax.swing.JCheckBox();
- isIncludeIssuer = new javax.swing.JCheckBox();
- jLabel2 = new javax.swing.JLabel();
- jTextFieldSigMethod = new javax.swing.JTextField();
- jLabel3 = new javax.swing.JLabel();
- jTextFieldDigestMethod = new javax.swing.JTextField();
- jLabel4 = new javax.swing.JLabel();
- jTextFieldc14n = new javax.swing.JTextField();
- jPanel4 = new javax.swing.JPanel();
- jScrollPane2 = new javax.swing.JScrollPane();
- jTextArea1 = new javax.swing.JTextArea();
-
- setLayout(new java.awt.BorderLayout());
-
- jButton1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
- jButton1.setText("Digitally Sign");
- jButton1.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jButton1ActionPerformed(evt);
- }
- });
-
- jScrollPane1.setViewportView(jList1);
-
- jButton2.setText("Show Certificate Details");
- jButton2.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jButton2ActionPerformed(evt);
- }
- });
-
- javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
- jPanel1.setLayout(jPanel1Layout);
- jPanel1Layout.setHorizontalGroup(
- jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(jPanel1Layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(jScrollPane1)
- .addContainerGap())
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
- .addContainerGap(69, Short.MAX_VALUE)
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 228, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 228, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGap(82, 82, 82))
- );
- jPanel1Layout.setVerticalGroup(
- jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(jPanel1Layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 142, Short.MAX_VALUE)
- .addGap(18, 18, 18)
- .addComponent(jButton2)
- .addGap(30, 30, 30)
- .addComponent(jButton1)
- .addContainerGap())
- );
-
- jTabbedPane1.addTab("Sign", jPanel1);
-
- jLabel1.setText("Advanced Settings");
-
- isIncludeSubjectName.setSelected(true);
- isIncludeSubjectName.setText("Include your certificate's subject name");
-
- isIncludePublicKey.setSelected(true);
- isIncludePublicKey.setText("Include your public key in the signature (recommended)");
-
- isIncludeIssuer.setText("Include your certificate's issuer and your certificate's serial");
-
- jLabel2.setText("Signature Method");
-
- jTextFieldSigMethod.setText("http://www.w3.org/2000/09/xmldsig#rsa-sha1");
-
- jLabel3.setText("Digest Method");
-
- jTextFieldDigestMethod.setText("http://www.w3.org/2000/09/xmldsig#sha1");
- jTextFieldDigestMethod.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jTextFieldDigestMethodActionPerformed(evt);
- }
- });
-
- jLabel4.setText("Canonicalization Method");
-
- jTextFieldc14n.setText("http://www.w3.org/2001/10/xml-exc-c14n#");
- jTextFieldc14n.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jTextFieldc14nActionPerformed(evt);
- }
- });
+ //ex.printStackTrace();
+ keyStoreError += "Error loading MACOS Key chain cert store " + ex.getMessage() + "\n";
+ }
+ }
+
+ if (keyStore == null) {
+ System.err.println(keyStoreError);
+ jTextArea1.setText(keyStoreError);
+ jTabbedPane1.setSelectedIndex(2);
+
+ } else {
+ try {
+ Enumeration<String> aliases = keyStore.aliases();
- javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
- jPanel2.setLayout(jPanel2Layout);
- jPanel2Layout.setHorizontalGroup(
- jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(jPanel2Layout.createSequentialGroup()
- .addContainerGap()
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jTextFieldDigestMethod)
- .addComponent(jTextFieldSigMethod)
- .addGroup(jPanel2Layout.createSequentialGroup()
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jLabel1)
- .addComponent(jLabel2)
- .addComponent(isIncludeIssuer)
- .addComponent(isIncludePublicKey)
- .addComponent(isIncludeSubjectName)
- .addComponent(jLabel3)
- .addComponent(jLabel4))
- .addGap(0, 0, Short.MAX_VALUE))
- .addComponent(jTextFieldc14n, javax.swing.GroupLayout.DEFAULT_SIZE, 359, Short.MAX_VALUE))
- .addContainerGap())
- );
- jPanel2Layout.setVerticalGroup(
- jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(jPanel2Layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(jLabel1)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(isIncludePublicKey)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(isIncludeSubjectName)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(isIncludeIssuer)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(jLabel2)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jTextFieldSigMethod, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jLabel3)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jTextFieldDigestMethod, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jLabel4)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jTextFieldc14n, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addContainerGap(23, Short.MAX_VALUE))
- );
-
- jTabbedPane1.addTab("Settings", jPanel2);
-
- jTextArea1.setColumns(20);
- jTextArea1.setRows(5);
- jScrollPane2.setViewportView(jTextArea1);
-
- javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
- jPanel4.setLayout(jPanel4Layout);
- jPanel4Layout.setHorizontalGroup(
- jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(jPanel4Layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 359, Short.MAX_VALUE)
- .addContainerGap())
- );
- jPanel4Layout.setVerticalGroup(
- jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(jPanel4Layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 236, Short.MAX_VALUE)
- .addContainerGap())
- );
-
- jTabbedPane1.addTab("Info", jPanel4);
-
- add(jTabbedPane1, java.awt.BorderLayout.CENTER);
- jTabbedPane1.getAccessibleContext().setAccessibleName("Sign");
- }// </editor-fold>//GEN-END:initComponents
+ while (aliases.hasMoreElements()) {
+ String a = aliases.nextElement();
+ X509Certificate certificate = (X509Certificate) keyStore.getCertificate(a);
+ //this is needed to test for access
+
+ try {
+ char[] cp = jPasswordField1.getPassword();
+ if (cp != null && cp.length <= 0) {
+ cp = null;
+ }
+ if (cp != null) {
+ String s = new String(cp);
+ s = s.trim();
+ if ("".equalsIgnoreCase(s)) {
+ cp = null;
+ }
+ }
+ Key key = keyStore.getKey(a, cp);
+ certs.add(a);
+
+ } catch (Exception x) {
+ System.out.println("error loading certificate " + a + " " + x.getMessage());
+ }
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ JOptionPane.showMessageDialog(this, e.getMessage());
+ }
+ }
+ jList1.setListData(certs);
+ if (!certs.isEmpty()) {
+ jList1.setSelectedIndex(0);
+ }
+ }
+
+ /**
+ * This method is called from within the init() method to initialize the
+ * form. WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ buttonGroup1 = new javax.swing.ButtonGroup();
+ jPanel3 = new javax.swing.JPanel();
+ jButton3 = new javax.swing.JButton();
+ jTabbedPane1 = new javax.swing.JTabbedPane();
+ jPanel1 = new javax.swing.JPanel();
+ jButton1 = new javax.swing.JButton();
+ jScrollPane1 = new javax.swing.JScrollPane();
+ jList1 = new javax.swing.JList();
+ jButton2 = new javax.swing.JButton();
+ jLabel5 = new javax.swing.JLabel();
+ jPanel2 = new javax.swing.JPanel();
+ jLabel1 = new javax.swing.JLabel();
+ isIncludeSubjectName = new javax.swing.JCheckBox();
+ isIncludePublicKey = new javax.swing.JCheckBox();
+ isIncludeIssuer = new javax.swing.JCheckBox();
+ jLabel2 = new javax.swing.JLabel();
+ jTextFieldSigMethod = new javax.swing.JTextField();
+ jLabel3 = new javax.swing.JLabel();
+ jTextFieldDigestMethod = new javax.swing.JTextField();
+ jLabel4 = new javax.swing.JLabel();
+ jTextFieldc14n = new javax.swing.JTextField();
+ jPanel4 = new javax.swing.JPanel();
+ jScrollPane2 = new javax.swing.JScrollPane();
+ jTextArea1 = new javax.swing.JTextArea();
+ jPanel5 = new javax.swing.JPanel();
+ jToggleButton1 = new javax.swing.JToggleButton();
+ jPasswordField1 = new javax.swing.JPasswordField();
+ jLabel6 = new javax.swing.JLabel();
+ jLabel7 = new javax.swing.JLabel();
+
+ jButton3.setText("jButton3");
+
+ setLayout(new java.awt.BorderLayout());
+
+ jButton1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
+ jButton1.setText("Digitally Sign");
+ jButton1.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButton1ActionPerformed(evt);
+ }
+ });
+
+ jScrollPane1.setViewportView(jList1);
+
+ jButton2.setText("Show Certificate Details");
+ jButton2.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButton2ActionPerformed(evt);
+ }
+ });
+
+ jLabel5.setText("Available Certificates");
+
+ javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
+ jPanel1.setLayout(jPanel1Layout);
+ jPanel1Layout.setHorizontalGroup(
+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
+ .addContainerGap(70, Short.MAX_VALUE)
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 228, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 228, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(82, 82, 82))
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addComponent(jLabel5)
+ .addGap(0, 0, Short.MAX_VALUE)))
+ .addContainerGap())
+ );
+ jPanel1Layout.setVerticalGroup(
+ jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jLabel5)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 222, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 46, Short.MAX_VALUE)
+ .addComponent(jButton2)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jButton1)
+ .addContainerGap())
+ );
+
+ jTabbedPane1.addTab("Sign", jPanel1);
+
+ jLabel1.setText("Advanced Settings");
+
+ isIncludeSubjectName.setSelected(true);
+ isIncludeSubjectName.setText("Include your certificate's subject name");
+
+ isIncludePublicKey.setSelected(true);
+ isIncludePublicKey.setText("Include your public key in the signature (recommended)");
+
+ isIncludeIssuer.setText("Include your certificate's issuer and your certificate's serial");
+
+ jLabel2.setText("Signature Method");
+
+ jTextFieldSigMethod.setText("http://www.w3.org/2000/09/xmldsig#rsa-sha1");
+
+ jLabel3.setText("Digest Method");
+
+ jTextFieldDigestMethod.setText("http://www.w3.org/2000/09/xmldsig#sha1");
+ jTextFieldDigestMethod.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jTextFieldDigestMethodActionPerformed(evt);
+ }
+ });
+
+ jLabel4.setText("Canonicalization Method");
+
+ jTextFieldc14n.setText("http://www.w3.org/2001/10/xml-exc-c14n#");
+ jTextFieldc14n.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jTextFieldc14nActionPerformed(evt);
+ }
+ });
+
+ javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
+ jPanel2.setLayout(jPanel2Layout);
+ jPanel2Layout.setHorizontalGroup(
+ jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel2Layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jTextFieldDigestMethod)
+ .addComponent(jTextFieldSigMethod)
+ .addGroup(jPanel2Layout.createSequentialGroup()
+ .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jLabel1)
+ .addComponent(jLabel2)
+ .addComponent(isIncludeIssuer)
+ .addComponent(isIncludePublicKey)
+ .addComponent(isIncludeSubjectName)
+ .addComponent(jLabel3)
+ .addComponent(jLabel4))
+ .addGap(0, 0, Short.MAX_VALUE))
+ .addComponent(jTextFieldc14n, javax.swing.GroupLayout.DEFAULT_SIZE, 360, Short.MAX_VALUE))
+ .addContainerGap())
+ );
+ jPanel2Layout.setVerticalGroup(
+ jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel2Layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jLabel1)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(isIncludePublicKey)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(isIncludeSubjectName)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(isIncludeIssuer)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(jLabel2)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jTextFieldSigMethod, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jLabel3)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jTextFieldDigestMethod, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jLabel4)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jTextFieldc14n, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(127, Short.MAX_VALUE))
+ );
+
+ jTabbedPane1.addTab("Settings", jPanel2);
+
+ jTextArea1.setColumns(20);
+ jTextArea1.setRows(5);
+ jScrollPane2.setViewportView(jTextArea1);
+
+ javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
+ jPanel4.setLayout(jPanel4Layout);
+ jPanel4Layout.setHorizontalGroup(
+ jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel4Layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 360, Short.MAX_VALUE)
+ .addContainerGap())
+ );
+ jPanel4Layout.setVerticalGroup(
+ jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel4Layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 340, Short.MAX_VALUE)
+ .addContainerGap())
+ );
+
+ jTabbedPane1.addTab("Info", jPanel4);
+
+ jToggleButton1.setText("OK");
+ jToggleButton1.addMouseListener(new java.awt.event.MouseAdapter() {
+ public void mouseClicked(java.awt.event.MouseEvent evt) {
+ jToggleButton1MouseClicked(evt);
+ }
+ });
+ jToggleButton1.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jToggleButton1ActionPerformed(evt);
+ }
+ });
+
+ jLabel6.setText("Password");
+
+ jLabel7.setText("<html>For Firefox and certain browser and OS combinations, you may need to specify a password in order to get access to certificates. This is typically used for non-Windows users.</html>");
+
+ javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
+ jPanel5.setLayout(jPanel5Layout);
+ jPanel5Layout.setHorizontalGroup(
+ jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel5Layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
+ .addGroup(jPanel5Layout.createSequentialGroup()
+ .addGap(34, 34, 34)
+ .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jToggleButton1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGroup(jPanel5Layout.createSequentialGroup()
+ .addComponent(jLabel6)
+ .addGap(18, 18, 18)
+ .addComponent(jPasswordField1, javax.swing.GroupLayout.DEFAULT_SIZE, 182, Short.MAX_VALUE)))
+ .addGap(100, 100, 100))
+ );
+ jPanel5Layout.setVerticalGroup(
+ jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel5Layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(jLabel6))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jToggleButton1)
+ .addContainerGap(248, Short.MAX_VALUE))
+ );
+
+ jTabbedPane1.addTab("Key Store", null, jPanel5, "");
+
+ add(jTabbedPane1, java.awt.BorderLayout.CENTER);
+ jTabbedPane1.getAccessibleContext().setAccessibleName("Key Store");
+ }// </editor-fold>//GEN-END:initComponents
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
-
- //JPopupMenu jp = new JPopupMenu("Certificate Info");
- String data = "No certificate selected";
- try {
- Certificate publickey = keyStore.getCertificate((String) jList1.getSelectedValue());
- data = "Issuer: " + ((X509Certificate) publickey).getIssuerDN().getName() + System.getProperty("line.separator");
- data += "Subject: " + ((X509Certificate) publickey).getSubjectDN().getName() + System.getProperty("line.separator");
- data += "Valid From: " + ((X509Certificate) publickey).getNotBefore().toString() + System.getProperty("line.separator");
- data += "Valid Until: " + ((X509Certificate) publickey).getNotAfter().toString() + System.getProperty("line.separator");
- data += "Serial Number: " + ((X509Certificate) publickey).getSerialNumber() + System.getProperty("line.separator");
- } catch (KeyStoreException ex) {
- Logger.getLogger(XmlSigApplet2.class.getName()).log(Level.SEVERE, null, ex);
- }
- jTextArea1.setText(data);
- jPanel4.setVisible(true);
- jTabbedPane1.setSelectedIndex(2);
+
+ //JPopupMenu jp = new JPopupMenu("Certificate Info");
+ String data = "No certificate selected";
+ try {
+ Certificate publickey = keyStore.getCertificate((String) jList1.getSelectedValue());
+ data = "Issuer: " + ((X509Certificate) publickey).getIssuerDN().getName() + System.getProperty("line.separator");
+ data += "Subject: " + ((X509Certificate) publickey).getSubjectDN().getName() + System.getProperty("line.separator");
+ data += "Valid From: " + ((X509Certificate) publickey).getNotBefore().toString() + System.getProperty("line.separator");
+ data += "Valid Until: " + ((X509Certificate) publickey).getNotAfter().toString() + System.getProperty("line.separator");
+ data += "Serial Number: " + ((X509Certificate) publickey).getSerialNumber() + System.getProperty("line.separator");
+ } catch (KeyStoreException ex) {
+ Logger.getLogger(XmlSigApplet2.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ jTextArea1.setText(data);
+ jPanel4.setVisible(true);
+ jTabbedPane1.setSelectedIndex(2);
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
-
- String signedXml = "error!";
- JSObject window = JSObject.getWindow(this);
- try {
- if (keyStore == null || keyStore.size() == 0) {
- signedXml = "Unforunately, it looks as if you don't have any certificates to choose from.";
- window.call("writeXml", new Object[]{signedXml});
- return;
- }
- } catch (Exception ex) {
- signedXml = "Unforunately, it looks as if you don't have any certificates to choose from.";
- window.call("writeXml", new Object[]{signedXml});
- return;
- }
- if (jList1.getSelectedValue() == null) {
- signedXml = "You must pick a certificate first";
- window.call("writeXml", new Object[]{signedXml});
- return;
- }
+
+ boolean error = false;
+ String signedXml = "error!";
+ JSObject window = JSObject.getWindow(this);
+ try {
+ if (keyStore == null || keyStore.size() == 0) {
+ error = true;
+ signedXml = "Unforunately, it looks as if you don't have any certificates to choose from.";
+ jTextArea1.setText(signedXml);
+ jTabbedPane1.setSelectedIndex(2);
+ return;
+ }
+ } catch (Exception ex) {
+ error = true;
+ signedXml = "Unforunately, it looks as if you don't have any certificates to choose from.";
+ jTextArea1.setText(signedXml);
+ jTabbedPane1.setSelectedIndex(2);
+ }
+ if (jList1.getSelectedValue() == null) {
+ error = true;
+ signedXml = "You must pick a certificate first";
+ jTextArea1.setText(signedXml);
+ jTabbedPane1.setSelectedIndex(2);
+ }
//Object object2 = window.call("getBrowserName", null);
- //Object object1 = window.call("getOsName", null);
- Object object3 = window.call("getObjectType", null);
+ //Object object1 = window.call("getOsName", null);
+ Object object3 = window.call("getObjectType", null);
//String browserName = (String) object2;
- //tring osName = (String) object2;
- String objecttype = (String) object3;
+ //tring osName = (String) object2;
+ String objecttype = (String) object3;
- //get the xml
- String xml = (String) window.call("getXml", new Object[]{});
- Object j = null;
-
- if (objecttype.equalsIgnoreCase("business")) {
- try {
- StringReader sr = new StringReader(xml.trim());
- j = (BusinessEntity) JAXB.unmarshal(sr, BusinessEntity.class);
- } catch (Exception ex) {
- }
- }
- if (objecttype.equalsIgnoreCase("service")) {
- try {
- StringReader sr = new StringReader(xml.trim());
- j = (BusinessService) JAXB.unmarshal(sr, BusinessService.class);
- } catch (Exception ex) {
- }
- }
- if (objecttype.equalsIgnoreCase("binding")) {
- try {
- StringReader sr = new StringReader(xml.trim());
- j = (BindingTemplate) JAXB.unmarshal(sr, BindingTemplate.class);
- } catch (Exception ex) {
- }
- }
- if (objecttype.equalsIgnoreCase("tmodel")) {
- try {
- StringReader sr = new StringReader(xml.trim());
- j = (TModel) JAXB.unmarshal(sr, TModel.class);
- } catch (Exception ex) {
- }
- }
-
-
- if (j != null) {
- try {
- //sign it
- org.apache.juddi.v3.client.cryptor.DigSigUtil ds = new DigSigUtil();
- if (isIncludePublicKey.isSelected()) {
- ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_BASE64, "true");
+ //get the xml
+ String xml = (String) window.call("getXml", new Object[]{});
+ Object j = null;
+
+ if (objecttype.equalsIgnoreCase("business")) {
+ try {
+ StringReader sr = new StringReader(xml.trim());
+ j = (BusinessEntity) JAXB.unmarshal(sr, BusinessEntity.class);
+ } catch (Exception ex) {
+ }
+ }
+ if (objecttype.equalsIgnoreCase("service")) {
+ try {
+ StringReader sr = new StringReader(xml.trim());
+ j = (BusinessService) JAXB.unmarshal(sr, BusinessService.class);
+ } catch (Exception ex) {
+ }
+ }
+ if (objecttype.equalsIgnoreCase("binding")) {
+ try {
+ StringReader sr = new StringReader(xml.trim());
+ j = (BindingTemplate) JAXB.unmarshal(sr, BindingTemplate.class);
+ } catch (Exception ex) {
+ }
+ }
+ if (objecttype.equalsIgnoreCase("tmodel")) {
+ try {
+ StringReader sr = new StringReader(xml.trim());
+ j = (TModel) JAXB.unmarshal(sr, TModel.class);
+ } catch (Exception ex) {
+ }
+ }
+
+ if (j != null) {
+ try {
+ //sign it
+ org.apache.juddi.v3.client.cryptor.DigSigUtil ds = new DigSigUtil();
+ if (isIncludePublicKey.isSelected()) {
+ ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_BASE64, "true");
+ }
+ if (isIncludeSubjectName.isSelected()) {
+ ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_SUBJECTDN, "true");
+ }
+ if (isIncludeIssuer.isSelected()) {
+ ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_SERIAL, "true");
+ }
+ ds.put(DigSigUtil.SIGNATURE_METHOD, jTextFieldSigMethod.getText());
+ ds.put(DigSigUtil.SIGNATURE_OPTION_DIGEST_METHOD, jTextFieldDigestMethod.getText());
+ ds.put(DigSigUtil.CANONICALIZATIONMETHOD, jTextFieldc14n.getText());
+
+ char[] cp = jPasswordField1.getPassword();
+ if (cp != null && cp.length <= 0) {
+ cp = null;
+ }
+ if (cp != null) {
+ String s = new String(cp);
+ s = s.trim();
+ if ("".equalsIgnoreCase(s)) {
+ cp = null;
}
- if (isIncludeSubjectName.isSelected()) {
- ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_SUBJECTDN, "true");
- }
- if (isIncludeIssuer.isSelected()) {
- ds.put(DigSigUtil.SIGNATURE_OPTION_CERT_INCLUSION_SERIAL, "true");
- }
- ds.put(DigSigUtil.SIGNATURE_METHOD, jTextFieldSigMethod.getText());
- ds.put(DigSigUtil.SIGNATURE_OPTION_DIGEST_METHOD, jTextFieldDigestMethod.getText());
- ds.put(DigSigUtil.CANONICALIZATIONMETHOD, jTextFieldc14n.getText());
-
- PrivateKey key = (PrivateKey) keyStore.getKey((String) jList1.getSelectedValue(), "MyPasswd".toCharArray());
- Certificate publickey = keyStore.getCertificate((String) jList1.getSelectedValue());
-
- j = ds.signUddiEntity(j, publickey, key);
- ds.clear();
- StringWriter sw = new StringWriter();
- JAXB.marshal(j, sw);
- signedXml = sw.toString();
- } catch (Exception ex) {
- Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, ex);
- signedXml = "Sorry I couldn't sign the data. " + ex.getMessage();
- }
- } else {
- signedXml = "Unable to determine which type of object that we're signing";
- }
+ }
+ PrivateKey key = (PrivateKey) keyStore.getKey((String) jList1.getSelectedValue(), cp);
+ Certificate publickey = keyStore.getCertificate((String) jList1.getSelectedValue());
+
+ j = ds.signUddiEntity(j, publickey, key);
+ ds.clear();
+ StringWriter sw = new StringWriter();
+ JAXB.marshal(j, sw);
+ signedXml = sw.toString();
+ } catch (Exception ex) {
+ error = true;
+ Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, ex);
+ signedXml = "Sorry I couldn't sign the data. " + ex.getMessage();
+ }
+ } else {
+ signedXml = "Unable to determine which type of object that we're signing";
+ }
- /*
- try {
- signedXml = this.sign(xml);
- } catch (Exception ex) {
- signedXml = ex.getMessage();
- Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, ex);
- }*/
+ /*
+ try {
+ signedXml = this.sign(xml);
+ } catch (Exception ex) {
+ signedXml = ex.getMessage();
+ Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, ex);
+ }*/
+ if (error) {
+ jTextArea1.setText(signedXml);
+ jTabbedPane1.setSelectedIndex(2);
+ } else {
+ //write it back to the web page
+ window.call("writeXml", new Object[]{signedXml});
- //write it back to the web page
- window.call("writeXml", new Object[]{signedXml});
+ }
}//GEN-LAST:event_jButton1ActionPerformed
private void jTextFieldDigestMethodActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldDigestMethodActionPerformed
- // TODO add your handling code here:
+ // TODO add your handling code here:
}//GEN-LAST:event_jTextFieldDigestMethodActionPerformed
private void jTextFieldc14nActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldc14nActionPerformed
- // TODO add your handling code here:
+ // TODO add your handling code here:
}//GEN-LAST:event_jTextFieldc14nActionPerformed
- /**
- * XML digital signature namespace
- */
- public final static String XML_DIGSIG_NS = "http://www.w3.org/2000/09/xmldsig#";
-
-
- // Variables declaration - do not modify//GEN-BEGIN:variables
- private javax.swing.ButtonGroup buttonGroup1;
- private javax.swing.JCheckBox isIncludeIssuer;
- private javax.swing.JCheckBox isIncludePublicKey;
- private javax.swing.JCheckBox isIncludeSubjectName;
- private javax.swing.JButton jButton1;
- private javax.swing.JButton jButton2;
- private javax.swing.JLabel jLabel1;
- private javax.swing.JLabel jLabel2;
- private javax.swing.JLabel jLabel3;
- private javax.swing.JLabel jLabel4;
- private javax.swing.JList jList1;
- private javax.swing.JPanel jPanel1;
- private javax.swing.JPanel jPanel2;
- private javax.swing.JPanel jPanel3;
- private javax.swing.JPanel jPanel4;
- private javax.swing.JScrollPane jScrollPane1;
- private javax.swing.JScrollPane jScrollPane2;
- private javax.swing.JTabbedPane jTabbedPane1;
- private javax.swing.JTextArea jTextArea1;
- private javax.swing.JTextField jTextFieldDigestMethod;
- private javax.swing.JTextField jTextFieldSigMethod;
- private javax.swing.JTextField jTextFieldc14n;
- // End of variables declaration//GEN-END:variables
+
+ private void jToggleButton1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jToggleButton1MouseClicked
+ // TODO add your handling code here:
+ }//GEN-LAST:event_jToggleButton1MouseClicked
+
+ private void jToggleButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton1ActionPerformed
+ setupCertificates();
+
+
+ }//GEN-LAST:event_jToggleButton1ActionPerformed
+ /**
+ * XML digital signature namespace
+ */
+ public final static String XML_DIGSIG_NS = "http://www.w3.org/2000/09/xmldsig#";
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.ButtonGroup buttonGroup1;
+ private javax.swing.JCheckBox isIncludeIssuer;
+ private javax.swing.JCheckBox isIncludePublicKey;
+ private javax.swing.JCheckBox isIncludeSubjectName;
+ private javax.swing.JButton jButton1;
+ private javax.swing.JButton jButton2;
+ private javax.swing.JButton jButton3;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel2;
+ private javax.swing.JLabel jLabel3;
+ private javax.swing.JLabel jLabel4;
+ private javax.swing.JLabel jLabel5;
+ private javax.swing.JLabel jLabel6;
+ private javax.swing.JLabel jLabel7;
+ private javax.swing.JList jList1;
+ private javax.swing.JPanel jPanel1;
+ private javax.swing.JPanel jPanel2;
+ private javax.swing.JPanel jPanel3;
+ private javax.swing.JPanel jPanel4;
+ private javax.swing.JPanel jPanel5;
+ private javax.swing.JPasswordField jPasswordField1;
+ private javax.swing.JScrollPane jScrollPane1;
+ private javax.swing.JScrollPane jScrollPane2;
+ private javax.swing.JTabbedPane jTabbedPane1;
+ private javax.swing.JTextArea jTextArea1;
+ private javax.swing.JTextField jTextFieldDigestMethod;
+ private javax.swing.JTextField jTextFieldSigMethod;
+ private javax.swing.JTextField jTextFieldc14n;
+ private javax.swing.JToggleButton jToggleButton1;
+ // End of variables declaration//GEN-END:variables
}
Modified: juddi/trunk/juddi-gui/src/main/webapp/businessEditor2.jsp
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-gui/src/main/webapp/businessEditor2.jsp?rev=1562664&r1=1562663&r2=1562664&view=diff
==============================================================================
--- juddi/trunk/juddi-gui/src/main/webapp/businessEditor2.jsp (original)
+++ juddi/trunk/juddi-gui/src/main/webapp/businessEditor2.jsp Thu Jan 30 01:21:33 2014
@@ -657,6 +657,11 @@
});
}
+
+ function saveAnyway(){
+ saveBusiness();
+ $('#confirmDialog').modal('hide');
+ }
<%
}
%>
@@ -676,8 +681,8 @@
<p><%=ResourceLoader.GetResource(session, "modal.digitalsignaturewarning.body")%></p>
</div>
<div class="modal-footer">
- <a href="#" class="btn"><%=ResourceLoader.GetResource(session, "modal.close")%></a>
- <a href="javascript:saveBusiness();$('#confirmDialog').modal('hide');" class="btn btn-primary">
+ <a href="javascript:closeXmlPop('confirmDialog');" class="btn" ><%=ResourceLoader.GetResource(session, "modal.close")%></a>
+ <a href="javascript:saveAnyway();" class="btn btn-primary">
<%=ResourceLoader.GetResource(session, "modal.savechanges")%></a>
</div>
</div>
Modified: juddi/trunk/juddi-gui/src/main/webapp/signer.jsp
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-gui/src/main/webapp/signer.jsp?rev=1562664&r1=1562663&r2=1562664&view=diff
==============================================================================
--- juddi/trunk/juddi-gui/src/main/webapp/signer.jsp (original)
+++ juddi/trunk/juddi-gui/src/main/webapp/signer.jsp Thu Jan 30 01:21:33 2014
@@ -30,7 +30,7 @@
You're about to digitally sign the <b><%=StringEscapeUtils.escapeHtml(itemtype)%></b> identified by the key <b><%=StringEscapeUtils.escapeHtml(id)%></b>.<br>
By electronically signing this UDDI entry, other users will then be able to verify that this entry hasn't been modified.<br>
- <applet code="org.apache.juddi.gui.dsig.XmlSigApplet2" archive="applets/juddi-gui-dsig-all.jar" MAYSCRIPT height="300px" width="400px"></applet>
+ <applet code="org.apache.juddi.gui.dsig.XmlSigApplet2" archive="applets/juddi-gui-dsig-all.jar" MAYSCRIPT height="350px" width="400px"></applet>
<script type="text/javascript">
$.get("ajax/toXML.jsp?id=<%=id%>&type=<%=itemtype%>", function(data){
$("#data").val(data);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@juddi.apache.org
For additional commands, e-mail: commits-help@juddi.apache.org