Author: atsushi
Date: 2006-12-07 06:38:39 -0500 (Thu, 07 Dec 2006)
New Revision: 69173

Modified:
   trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog
   
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/MessageSecurityUtility.cs
Log:
2006-12-07  Atsushi Enomoto  <[EMAIL PROTECTED]>

        * MessageSecurityUtility.cs :
          handle key mapping for each wsse:Security.



Modified: 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog
===================================================================
--- 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog    
    2006-12-07 11:38:27 UTC (rev 69172)
+++ 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog    
    2006-12-07 11:38:39 UTC (rev 69173)
@@ -1,5 +1,10 @@
 2006-12-07  Atsushi Enomoto  <[EMAIL PROTECTED]>
 
+       * MessageSecurityUtility.cs :
+         handle key mapping for each wsse:Security.
+
+2006-12-07  Atsushi Enomoto  <[EMAIL PROTECTED]>
+
        * WSSecurityMessageHeader.cs : use prefix "c" for ws-secureconv.
 
 2006-12-06  Atsushi Enomoto  <[EMAIL PROTECTED]>

Modified: 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/MessageSecurityUtility.cs
===================================================================
--- 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/MessageSecurityUtility.cs
        2006-12-07 11:38:27 UTC (rev 69172)
+++ 
trunk/olive/class/System.ServiceModel/System.ServiceModel.Channels/MessageSecurityUtility.cs
        2006-12-07 11:38:39 UTC (rev 69173)
@@ -467,9 +467,7 @@
                        // create derived keys
                        // FIXME: an alternative approach is to make use of
                        // EncryptedXml.AddKeyNameMapping().
-                       Dictionary<string,byte[]> map = GetUriKeyMappings (doc, 
nsmgr, decryptedKey);
-                       //foreach (EncryptedReference er in 
encryptedKey.ReferenceList)
-                       //      map [StripUri (er.Uri)] = decryptedKey;
+                       Dictionary<string,byte[]> map = GetUriKeyMappings 
(security, nsmgr, decryptedKey);
                        foreach (XmlElement rlist in security.SelectNodes 
("e:ReferenceList", nsmgr))
                                foreach (XmlElement encref in rlist.SelectNodes 
("e:DataReference | e:KeyReference", nsmgr))
                                        map [StripUri (encref.GetAttribute 
("URI"))] = decryptedKey;
@@ -504,8 +502,10 @@
 
                // FIXME: this should consider the referent SecurityToken of
                // each DerivedKeyToken element.
-               static Dictionary<string,byte[]> GetUriKeyMappings (XmlDocument 
doc, XmlNamespaceManager nsmgr, byte [] decryptedKey)
+               static Dictionary<string,byte[]> GetUriKeyMappings (XmlElement 
security, XmlNamespaceManager nsmgr, byte [] decryptedKey)
                {
+                       XmlDocument doc = security.OwnerDocument;
+
                        // create derived keys
                        Dictionary<string,byte[]> keys = new 
Dictionary<string,byte[]> ();
                        // default, unless overriden by the default 
DerivedKeyToken.
@@ -516,7 +516,10 @@
 
                        byte [] currentKey = decryptedKey;
                        bool hasSpecificMap = false;
-                       foreach (XmlElement el in doc.SelectNodes 
("/s:Envelope/s:Header/o:Security/*", nsmgr)) {
+                       foreach (XmlNode n in security.ChildNodes) {
+                               XmlElement el = n as XmlElement;
+                               if (el == null)
+                                       continue;
                                if (el.LocalName == "DerivedKeyToken" &&
                                    el.NamespaceURI == Constants.WsscNamespace) 
{
                                        if (!hasSpecificMap)

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to