ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1468902 - in /webservices/wss4j/trunk: ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/ ws-security-dom/src/main/java/org/apache/wss4j/dom/message/ ws-security-dom/src/test/java/org/apache/wss4j/dom/message/
Date Wed, 17 Apr 2013 13:20:17 GMT
Author: coheigea
Date: Wed Apr 17 13:20:16 2013
New Revision: 1468902

URL: http://svn.apache.org/r1468902
Log:
[WSS-434] - Add ValueType attribute to a Signature/Encryption Reference to a DerivedKeyToken


Conflicts:
	ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDKEncrypt.java
	ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDKSign.java

Modified:
    webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/ConversationConstants.java
    webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDKEncrypt.java
    webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDKSign.java
    webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDerivedKeyBase.java
    webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/DerivedKeyTest.java

Modified: webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/ConversationConstants.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/ConversationConstants.java?rev=1468902&r1=1468901&r2=1468902&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/ConversationConstants.java
(original)
+++ webservices/wss4j/trunk/ws-security-common/src/main/java/org/apache/wss4j/common/derivedKey/ConversationConstants.java
Wed Apr 17 13:20:16 2013
@@ -175,23 +175,19 @@ public final class ConversationConstants
             "http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512/dk/p_sha1";
     }
     
-    public static String getWSCNs(int version) throws ConversationException {
+    public static String getWSCNs(int version) {
         if (VERSION_05_02 == version) {
             return WSC_NS_05_02;
-        } else if (VERSION_05_12 == version) {
-            return WSC_NS_05_12;
         } else {
-            throw new ConversationException("unsupportedSecConvVersion");
+            return WSC_NS_05_12;
         }
     }
     
-    public static int getWSTVersion(String ns) throws ConversationException {
+    public static int getWSTVersion(String ns) {
         if (WSC_NS_05_02.equals(ns)) {
             return VERSION_05_02;
-        } else if (WSC_NS_05_12.equals(ns)) {
-            return VERSION_05_12;
         } else {
-            throw new ConversationException("unsupportedSecConvVersion");
+            return VERSION_05_12;
         }
     }
 }

Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDKEncrypt.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDKEncrypt.java?rev=1468902&r1=1468901&r2=1468902&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDKEncrypt.java
(original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDKEncrypt.java
Wed Apr 17 13:20:16 2013
@@ -23,10 +23,12 @@ import org.apache.wss4j.dom.WSConstants;
 import org.apache.wss4j.dom.WSEncryptionPart;
 import org.apache.wss4j.dom.WSSConfig;
 import org.apache.wss4j.common.ext.WSSecurityException;
+import org.apache.wss4j.common.derivedKey.ConversationConstants;
 import org.apache.wss4j.common.derivedKey.ConversationException;
 import org.apache.wss4j.dom.message.token.Reference;
 import org.apache.wss4j.dom.message.token.SecurityTokenReference;
 import org.apache.wss4j.dom.util.WSSecurityUtil;
+
 import org.apache.xml.security.keys.KeyInfo;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -108,6 +110,7 @@ public class WSSecDKEncrypt extends WSSe
         throws WSSecurityException {
         
         KeyInfo keyInfo = createKeyInfo();
+
         SecretKey key = WSSecurityUtil.prepareSecretKey(symEncAlgo, derivedKeyBytes);
 
         List<String> encDataRefs = 
@@ -125,6 +128,7 @@ public class WSSecDKEncrypt extends WSSe
     
     /**
      * Create a KeyInfo object
+     * @throws ConversationException 
      */
     private KeyInfo createKeyInfo() throws WSSecurityException {
         KeyInfo keyInfo = new KeyInfo(document);
@@ -132,6 +136,10 @@ public class WSSecDKEncrypt extends WSSe
         secToken.addWSSENamespace();
         Reference ref = new Reference(document);
         ref.setURI("#" + dktId);
+        String ns = 
+            ConversationConstants.getWSCNs(getWscVersion()) 
+                + ConversationConstants.TOKEN_TYPE_DERIVED_KEY_TOKEN;
+        ref.setValueType(ns);
         secToken.setReference(ref);
 
         keyInfo.addUnknownElement(secToken.getElement());

Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDKSign.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDKSign.java?rev=1468902&r1=1468901&r2=1468902&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDKSign.java
(original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDKSign.java
Wed Apr 17 13:20:16 2013
@@ -24,6 +24,7 @@ import org.apache.wss4j.dom.WSDocInfo;
 import org.apache.wss4j.dom.WSEncryptionPart;
 import org.apache.wss4j.dom.WSSConfig;
 import org.apache.wss4j.common.ext.WSSecurityException;
+import org.apache.wss4j.common.derivedKey.ConversationConstants;
 import org.apache.wss4j.common.derivedKey.ConversationException;
 import org.apache.wss4j.dom.message.token.Reference;
 import org.apache.wss4j.dom.message.token.SecurityTokenReference;
@@ -165,9 +166,13 @@ public class WSSecDKSign extends WSSecDe
         strUri = getWsConfig().getIdAllocator().createSecureId("STR-", secRef);
         secRef.setID(strUri);
         
-        Reference refUt = new Reference(document);
-        refUt.setURI("#" + dktId);
-        secRef.setReference(refUt);
+        Reference ref = new Reference(document);
+        ref.setURI("#" + dktId);
+        String ns = 
+            ConversationConstants.getWSCNs(getWscVersion()) 
+            + ConversationConstants.TOKEN_TYPE_DERIVED_KEY_TOKEN;
+        ref.setValueType(ns);
+        secRef.setReference(ref);
         
         XMLStructure structure = new DOMStructure(secRef.getElement());
         wsDocInfo.addTokenElement(secRef.getElement(), false);

Modified: webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDerivedKeyBase.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDerivedKeyBase.java?rev=1468902&r1=1468901&r2=1468902&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDerivedKeyBase.java
(original)
+++ webservices/wss4j/trunk/ws-security-dom/src/main/java/org/apache/wss4j/dom/message/WSSecDerivedKeyBase.java
Wed Apr 17 13:20:16 2013
@@ -301,6 +301,10 @@ public abstract class WSSecDerivedKeyBas
         this.wscVersion = wscVersion;
     }
     
+    public int getWscVersion() {
+        return wscVersion;
+    }
+    
     public Element getdktElement() {
         return dkt.getElement();
     }

Modified: webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/DerivedKeyTest.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/DerivedKeyTest.java?rev=1468902&r1=1468901&r2=1468902&view=diff
==============================================================================
--- webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/DerivedKeyTest.java
(original)
+++ webservices/wss4j/trunk/ws-security-dom/src/test/java/org/apache/wss4j/dom/message/DerivedKeyTest.java
Wed Apr 17 13:20:16 2013
@@ -155,7 +155,7 @@ public class DerivedKeyTest extends org.
         encrKeyBuilder.prependBSTElementToHeader(secHeader);
 
         if (LOG.isDebugEnabled()) {
-            LOG.debug("Encrypted message: 3DES  + DerivedKeys");
+            LOG.debug("Signed message: 3DES  + DerivedKeys");
             String outputString = 
                 XMLUtils.PrettyDocumentToString(doc);
             LOG.debug(outputString);



Mime
View raw message