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 2013/04/11 22:19:38 UTC

svn commit: r1467073 - in /juddi/branches/juddi-3.2.x: ./ juddi-client/src/main/java/org/apache/juddi/v3/client/crypto/ juddi-gui/src/java/org/apache/juddi/webconsole/resources/ juddi-gui/web/ juddi-gui/web/META-INF/ juddi-gui/web/ajax/ uddi-ws/src/mai...

Author: alexoree
Date: Thu Apr 11 20:19:38 2013
New Revision: 1467073

URL: http://svn.apache.org/r1467073
Log:
adding digital signature validation to the ui and juddi-client. 

Modified:
    juddi/branches/juddi-3.2.x/juddi-client/src/main/java/org/apache/juddi/v3/client/crypto/DigSigUtil.java
    juddi/branches/juddi-3.2.x/juddi-gui/src/java/org/apache/juddi/webconsole/resources/web.properties
    juddi/branches/juddi-3.2.x/juddi-gui/src/java/org/apache/juddi/webconsole/resources/web_es.properties
    juddi/branches/juddi-3.2.x/juddi-gui/web/META-INF/config.properties
    juddi/branches/juddi-3.2.x/juddi-gui/web/ajax/toXML.jsp
    juddi/branches/juddi-3.2.x/juddi-gui/web/businessEditor2.jsp
    juddi/branches/juddi-3.2.x/juddi-gui/web/serviceEditor.jsp
    juddi/branches/juddi-3.2.x/juddi-gui/web/signer.jsp
    juddi/branches/juddi-3.2.x/readme.txt
    juddi/branches/juddi-3.2.x/uddi-ws/src/main/java/org/apache/juddi/jaxb/JAXBMarshaller.java

Modified: juddi/branches/juddi-3.2.x/juddi-client/src/main/java/org/apache/juddi/v3/client/crypto/DigSigUtil.java
URL: http://svn.apache.org/viewvc/juddi/branches/juddi-3.2.x/juddi-client/src/main/java/org/apache/juddi/v3/client/crypto/DigSigUtil.java?rev=1467073&r1=1467072&r2=1467073&view=diff
==============================================================================
--- juddi/branches/juddi-3.2.x/juddi-client/src/main/java/org/apache/juddi/v3/client/crypto/DigSigUtil.java (original)
+++ juddi/branches/juddi-3.2.x/juddi-client/src/main/java/org/apache/juddi/v3/client/crypto/DigSigUtil.java Thu Apr 11 20:19:38 2013
@@ -15,6 +15,7 @@
  */
 package org.apache.juddi.v3.client.crypto;
 
+import com.sun.xml.internal.messaging.saaj.util.JAXMStreamSource;
 import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.IOException;
@@ -52,6 +53,7 @@ import java.util.Properties;
 import java.util.concurrent.atomic.AtomicReference;
 import javax.security.auth.x500.X500Principal;
 import javax.xml.bind.JAXB;
+import javax.xml.bind.JAXBException;
 import javax.xml.crypto.dsig.CanonicalizationMethod;
 import javax.xml.crypto.dsig.DigestMethod;
 import javax.xml.crypto.dsig.Reference;
@@ -71,6 +73,7 @@ import javax.xml.transform.dom.DOMResult
 import javax.xml.transform.dom.DOMSource;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.juddi.jaxb.JAXBMarshaller;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -239,12 +242,12 @@ public final class DigSigUtil {
      * @return an enveloped signed UDDI element, do not modify this object after
      * signing
      */
-    public <T> T signUddiEntity(T jaxbObj) {
-        DOMResult domResult = new DOMResult();
-        JAXB.marshal(jaxbObj, domResult);
-        Document doc = ((Document) domResult.getNode());
-        Element docElement = doc.getDocumentElement();
-
+    public <T> T signUddiEntity(T jaxbObj) throws JAXBException {
+        //DOMResult domResult = new DOMResult();
+        //JAXB.marshal(jaxbObj, domResult);
+        Document doc = null;//((Document) domResult.getNode());//
+        Element docElement = null;//doc.getDocumentElement();
+       docElement= org.apache.juddi.jaxb.JAXBMarshaller.marshallToElement(jaxbObj, JAXBMarshaller.PACKAGE_UDDIAPI,docElement );
         try {
             KeyStore ks = KeyStore.getInstance(map.getProperty(SIGNATURE_KEYSTORE_FILETYPE));
             URL url = Thread.currentThread().getContextClassLoader().getResource(map.getProperty(SIGNATURE_KEYSTORE_FILE));
@@ -283,8 +286,9 @@ public final class DigSigUtil {
             //PublicKey validatingKey = origCert.getPublicKey();
             this.signDOM(docElement, privateKey, origCert);
 
-            DOMSource domSource = new DOMSource(doc);
-            T result = (T) JAXB.unmarshal(domSource, jaxbObj.getClass());
+     //       DOMSource domSource = new DOMSource(doc);
+            T result = (T)  JAXBMarshaller.unmarshallFromElement(docElement, JAXBMarshaller.PACKAGE_UDDIAPI);
+           // T result = (T) JAXB.unmarshal(domSource, jaxbObj.getClass());
             return result;
         } catch (Exception e) {
             throw new RuntimeException("Signature failure due to: " + e.getMessage(), e);
@@ -297,9 +301,8 @@ public final class DigSigUtil {
      * @param obj
      */
     public static void JAXB_ToStdOut(Object obj) {
-        StringWriter sw = new StringWriter();
-        JAXB.marshal(obj, sw);
-        System.out.println(sw.toString());
+       
+        System.out.println( JAXBMarshaller.marshallToString(obj, JAXBMarshaller.PACKAGE_UDDIAPI));
 
     }
 
@@ -408,10 +411,14 @@ public final class DigSigUtil {
         }
         try {
             DOMResult domResult = new DOMResult();
-            JAXB.marshal(obj, domResult);
+           
+            Element e = null;
+            org.apache.juddi.jaxb.JAXBMarshaller.marshallToElement(obj, JAXBMarshaller.PACKAGE_UDDIAPI,e );
+            
+           // JAXB.marshal(obj, domResult);
 
-            Document doc = ((Document) domResult.getNode());
-            Element docElement = doc.getDocumentElement();  //this is our signed node
+          //  Document doc = ((Document) domResult.getNode());
+            Element docElement = e;  //this is our signed node
 
             X509Certificate signingcert = getSigningCertificatePublicKey(obj, docElement);
 
@@ -719,7 +726,7 @@ public final class DigSigUtil {
     }
 
     /**
-     *
+     * searches local keystores for a referenced signing certificate
      * @param childNodes
      * @return null or the public key of a signing certificate
      */

Modified: juddi/branches/juddi-3.2.x/juddi-gui/src/java/org/apache/juddi/webconsole/resources/web.properties
URL: http://svn.apache.org/viewvc/juddi/branches/juddi-3.2.x/juddi-gui/src/java/org/apache/juddi/webconsole/resources/web.properties?rev=1467073&r1=1467072&r2=1467073&view=diff
==============================================================================
--- juddi/branches/juddi-3.2.x/juddi-gui/src/java/org/apache/juddi/webconsole/resources/web.properties (original)
+++ juddi/branches/juddi-3.2.x/juddi-gui/src/java/org/apache/juddi/webconsole/resources/web.properties Thu Apr 11 20:19:38 2013
@@ -236,3 +236,7 @@ items.expires=Expires
 items.actions=Actions
 actions.asxml=View as XML
 items.name.description=UDDI entities can have more than one name, such as abbreviations or in another language.
+items.signatures.invalid=Signature is invalid! Reason: 
+items.signatures.valid=Digital Signature is valid.
+items.unknown=Error, unable to identify which type of object you wanted.
+items.service.add=Add a Service

Modified: juddi/branches/juddi-3.2.x/juddi-gui/src/java/org/apache/juddi/webconsole/resources/web_es.properties
URL: http://svn.apache.org/viewvc/juddi/branches/juddi-3.2.x/juddi-gui/src/java/org/apache/juddi/webconsole/resources/web_es.properties?rev=1467073&r1=1467072&r2=1467073&view=diff
==============================================================================
--- juddi/branches/juddi-3.2.x/juddi-gui/src/java/org/apache/juddi/webconsole/resources/web_es.properties (original)
+++ juddi/branches/juddi-3.2.x/juddi-gui/src/java/org/apache/juddi/webconsole/resources/web_es.properties Thu Apr 11 20:19:38 2013
@@ -237,3 +237,7 @@ items.expires=Expira
 items.actions=Acciones
 actions.asxml=Ver como XML
 items.name.description=Entidades UDDI pueden tener m\u00e1s de un nombre, como abreviaturas o en otro idioma.
+items.signatures.invalid=La firma es v\u00e1lida! Raz\u00f3n:
+items.signatures.valid=La firma digital es v\u00e1lida.
+items.unknown=Error, no puede identificar el tipo de objeto que quer\u00eda.
+items.service.add=Agregar un Servicio

Modified: juddi/branches/juddi-3.2.x/juddi-gui/web/META-INF/config.properties
URL: http://svn.apache.org/viewvc/juddi/branches/juddi-3.2.x/juddi-gui/web/META-INF/config.properties?rev=1467073&r1=1467072&r2=1467073&view=diff
==============================================================================
--- juddi/branches/juddi-3.2.x/juddi-gui/web/META-INF/config.properties (original)
+++ juddi/branches/juddi-3.2.x/juddi-gui/web/META-INF/config.properties Thu Apr 11 20:19:38 2013
@@ -19,4 +19,23 @@ registryType=juddi
 #javax.net.ssl.keyStore
 #javax.net.ssl.keyStorePassword
 #javax.net.ssl.trustStore
-#javax.net.ssl.trustStorePassword
\ No newline at end of file
+#javax.net.ssl.trustStorePassword
+
+
+#
+# The type of file, such as JKS for most Java applications, or WINDOWS-MY
+# to use the Windows certificate store of the current user or KeychainStore
+# for MacOS
+
+TRUSTSTORE_FILE = keyStorePath
+TRUSTSTORE_FILETYPE = keyStoreType
+TRUSTSTORE_FILE_PASSWORD = filePassword
+
+
+# uncomment to override
+#XML_DIGSIG_NS = http://www.w3.org/2000/09/xmldsig#
+
+CHECK_TIMESTAMPS = anyvalue
+CHECK_REVOCATION_STATUS_OCSP = anyvalue
+CHECK_REVOCATION_STATUS_CRL = anyvalue
+CHECK_TRUST_CHAIN = anyvalue

Modified: juddi/branches/juddi-3.2.x/juddi-gui/web/ajax/toXML.jsp
URL: http://svn.apache.org/viewvc/juddi/branches/juddi-3.2.x/juddi-gui/web/ajax/toXML.jsp?rev=1467073&r1=1467072&r2=1467073&view=diff
==============================================================================
--- juddi/branches/juddi-3.2.x/juddi-gui/web/ajax/toXML.jsp (original)
+++ juddi/branches/juddi-3.2.x/juddi-gui/web/ajax/toXML.jsp Thu Apr 11 20:19:38 2013
@@ -2,7 +2,8 @@
     Document   : toXML
     Created on : Mar 14, 2013, 9:17:21 PM
     Author     : Alex O'Ree
---%><%@page import="org.apache.juddi.jaxb.JAXBMarshaller"%><%@page import="org.apache.juddi.jaxb.EntityCreator"%><%@page import="org.apache.juddi.webconsole.hub.UddiHub"%><%@page import="org.apache.juddi.jaxb.PrintUDDI"%><%@page contentType="text/html" pageEncoding="UTF-8"%><%
+--%><%@page import="org.apache.juddi.webconsole.resources.ResourceLoader"%>
+<%@page import="org.apache.juddi.jaxb.JAXBMarshaller"%><%@page import="org.apache.juddi.jaxb.EntityCreator"%><%@page import="org.apache.juddi.webconsole.hub.UddiHub"%><%@page import="org.apache.juddi.jaxb.PrintUDDI"%><%@page contentType="text/html" pageEncoding="UTF-8"%><%
     //org.apache.juddi.jaxb.PrintUDDI p = new PrintUDDI();
     UddiHub x = UddiHub.getInstance(application, session);
 
@@ -23,7 +24,7 @@
             out.write(JAXBMarshaller.marshallToString(j, JAXBMarshaller.PACKAGE_UDDIAPI));
             // out.write(EntityCreator.outputEntityToString(j, "org.apache.juddi.api_v3"));
         } else {
-            out.write("Error, unable to identify which type of object you wanted");
+            out.write(ResourceLoader.GetResource(session, "items.unknown"));
         }
     }
 

Modified: juddi/branches/juddi-3.2.x/juddi-gui/web/businessEditor2.jsp
URL: http://svn.apache.org/viewvc/juddi/branches/juddi-3.2.x/juddi-gui/web/businessEditor2.jsp?rev=1467073&r1=1467072&r2=1467073&view=diff
==============================================================================
--- juddi/branches/juddi-3.2.x/juddi-gui/web/businessEditor2.jsp (original)
+++ juddi/branches/juddi-3.2.x/juddi-gui/web/businessEditor2.jsp Thu Apr 11 20:19:38 2013
@@ -466,8 +466,8 @@
                         %> <%=ResourceLoader.GetResource(session, "pages.businesseditor.businesslist2")%>
                         <%if (!newitem) {
                         %>
-
-                        <a href="serviceEditor.jsp?bizid=<%=URLEncoder.encode(bd.getBusinessKey(), "UTF-8")%>" class="btn btn-primary">+</a>
+                        <br>
+                        <a href="serviceEditor.jsp?bizid=<%=URLEncoder.encode(bd.getBusinessKey(), "UTF-8")%>"><i class="icon-plus-sign"></i> <%=ResourceLoader.GetResource(session, "items.service.add")%> </a>
                         <%
                             }
                         %>
@@ -512,21 +512,30 @@
                             } else {
                                 out.write(ResourceLoader.GetResource(session, "items.signed") + " " + bd.getSignature().size());
                         %>
-                        <table class="table">
-
+                        <table class="table table-hover">
+                            <tr><th>Signed by</th><th></th><th>Signature Status</th></tr>
 
                             <%
-                                    for (int k = 0; k < bd.getSignature().size(); k++) {
-                                        out.write("<tr><td>");
-                                        out.write(x.SignatureToReadable(bd.getSignature().get(k)));
-                                        out.write("</td><td>");
-                                        out.write("<a href=\"ajax/getCert.jsp?type=business&id=" + URLEncoder.encode(bd.getBusinessKey(), "UTF-8") + "&index=" + k + "\">" + ResourceLoader.GetResource(session, "items.signed.viewcert") + "</a>");
-                                        out.write("</td></tr>");
-                                    }
+                                for (int k = 0; k < bd.getSignature().size(); k++) {
+                                    out.write("<tr><td>");
+                                    out.write(x.SignatureToReadable(bd.getSignature().get(k)));
+                                    out.write("</td><td>");
+                                    out.write("<a href=\"ajax/getCert.jsp?type=business&id=" + URLEncoder.encode(bd.getBusinessKey(), "UTF-8") + "&index=" + k + "\">" + ResourceLoader.GetResource(session, "items.signed.viewcert") + "</a>");
+                                    out.write("</td><td><div id=\"digsig" + k + "\"></div>");
+                            %>
+                            <script type="text/javascript">
+                                $.get("ajax/validateSignature.jsp?type=business&id=<%=StringEscapeUtils.escapeJavaScript(bd.getBusinessKey())%>", function(data){
+                                $("#digsig<%=k%>").html(data);
+                            } )
+                            </script>
+                            <%
+                                    out.write("</td></tr>");
                                 }
-
                             %>
                         </table>
+                        <%
+                            }
+                        %>
                     </div>
 
                     <div class="tab-pane" id="opinfo">

Modified: juddi/branches/juddi-3.2.x/juddi-gui/web/serviceEditor.jsp
URL: http://svn.apache.org/viewvc/juddi/branches/juddi-3.2.x/juddi-gui/web/serviceEditor.jsp?rev=1467073&r1=1467072&r2=1467073&view=diff
==============================================================================
--- juddi/branches/juddi-3.2.x/juddi-gui/web/serviceEditor.jsp (original)
+++ juddi/branches/juddi-3.2.x/juddi-gui/web/serviceEditor.jsp Thu Apr 11 20:19:38 2013
@@ -547,7 +547,7 @@
                                     out.write("<tr><td>");
                                     out.write(x.SignatureToReadable(bd.getSignature().get(k)));
                                     out.write("</td><td>");
-                                    out.write("<a href=\"ajax/getCert.jsp?type=business&id=" + URLEncoder.encode(bd.getServiceKey(), "UTF-8") + "&index=" + k + "\">" + ResourceLoader.GetResource(session, "items.signed.viewcert") + "</a>");
+                                    out.write("<a href=\"ajax/getCert.jsp?type=service&id=" + URLEncoder.encode(bd.getServiceKey(), "UTF-8") + "&index=" + k + "\">" + ResourceLoader.GetResource(session, "items.signed.viewcert") + "</a>");
                                     out.write("</td></tr>");
                                 }
                             }
@@ -601,7 +601,7 @@
         <script type="text/javascript">
             function ViewAsXML()
             {
-                $.get("ajax/toXML.jsp?id=<%=URLEncoder.encode(serviceid, "UTF-8")%>&type=business", function(data){
+                $.get("ajax/toXML.jsp?id=<%=URLEncoder.encode(serviceid, "UTF-8")%>&type=service", function(data){
                     window.console && console.log('asXml success');                
                     $("#viewAsXmlContent").html(safe_tags_replace(data));
                     $( "#viewAsXml" ).modal('show');

Modified: juddi/branches/juddi-3.2.x/juddi-gui/web/signer.jsp
URL: http://svn.apache.org/viewvc/juddi/branches/juddi-3.2.x/juddi-gui/web/signer.jsp?rev=1467073&r1=1467072&r2=1467073&view=diff
==============================================================================
--- juddi/branches/juddi-3.2.x/juddi-gui/web/signer.jsp (original)
+++ juddi/branches/juddi-3.2.x/juddi-gui/web/signer.jsp Thu Apr 11 20:19:38 2013
@@ -18,10 +18,7 @@
     <!-- Example row of columns -->
     <div class="row">
         <div class="span12">
-            <%=ResourceLoader.GetResource(session, "items.dsigs.description")%>
-            
-            <applet code="org.apache.juddi.gui.dsig.XmlSignatureApplet" archive="applets/juddi-gui-dsig.jar"></applet> 
-            <script type="text/javascript">
+            <%=ResourceLoader.GetResource(session, "items.dsigs.description")%><br>
                 <%
                     //figure out what we are signing
                     //fetch the xml from ajex/toXml and fill the text area
@@ -29,6 +26,12 @@
                     String itemtype = request.getParameter("type");
 
                 %>
+            
+                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.XmlSignatureApplet" archive="applets/juddi-gui-dsig.jar"></applet> 
+            <script type="text/javascript">
                     $.get("ajax/toXML.jsp?id=<%=id%>&type=<%=itemtype%>", function(data){
                         $("#data").val(data);
                     });
@@ -110,9 +113,10 @@
                         if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux";
                         return OSName;
                     }
+                    //<a class="btn" href="javascript:go();">Go</a>
             </script>
-            <a class="btn" href="javascript:go();">Go</a>
-            <textarea name="data" rows="15" cols="80" id="data">Loading....</textarea>
+            
+            <textarea name="data" rows="15" cols="80" id="data" style="display:none">Loading....</textarea>
         </div>
 
     </div>

Modified: juddi/branches/juddi-3.2.x/readme.txt
URL: http://svn.apache.org/viewvc/juddi/branches/juddi-3.2.x/readme.txt?rev=1467073&r1=1467072&r2=1467073&view=diff
==============================================================================
--- juddi/branches/juddi-3.2.x/readme.txt (original)
+++ juddi/branches/juddi-3.2.x/readme.txt Thu Apr 11 20:19:38 2013
@@ -22,6 +22,7 @@ Install Netbeans and open the project. C
 
 
 To build your changes locally and skip the the tests run:
+mvn install -DskipTests=true
 
 To also build the Pluto/GWT/Portlet interface
 cd juddi-console

Modified: juddi/branches/juddi-3.2.x/uddi-ws/src/main/java/org/apache/juddi/jaxb/JAXBMarshaller.java
URL: http://svn.apache.org/viewvc/juddi/branches/juddi-3.2.x/uddi-ws/src/main/java/org/apache/juddi/jaxb/JAXBMarshaller.java?rev=1467073&r1=1467072&r2=1467073&view=diff
==============================================================================
--- juddi/branches/juddi-3.2.x/uddi-ws/src/main/java/org/apache/juddi/jaxb/JAXBMarshaller.java (original)
+++ juddi/branches/juddi-3.2.x/uddi-ws/src/main/java/org/apache/juddi/jaxb/JAXBMarshaller.java Thu Apr 11 20:19:38 2013
@@ -104,7 +104,7 @@ public class JAXBMarshaller {
 		try {
 			JAXBContext jc = getContext(thePackage);
 			Marshaller marshaller = jc.createMarshaller();
-			marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+			marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.FALSE);
 			marshaller.setProperty(Marshaller.JAXB_FRAGMENT, Boolean.TRUE);
 			marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
 			ByteArrayOutputStream baos = new ByteArrayOutputStream();



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@juddi.apache.org
For additional commands, e-mail: commits-help@juddi.apache.org