Author: spouliot
Date: 2005-05-04 12:21:08 -0400 (Wed, 04 May 2005)
New Revision: 44034

Modified:
   trunk/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog
   
trunk/mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoRetrievalMethod.cs
   trunk/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs
   
trunk/mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigXPathTransform.cs
Log:
2005-05-04  Sebastien Pouliot  <[EMAIL PROTECTED]>

        * SignedXml.cs: Return an empty (not null) KeyInfo by default and
        don't throw a CryptographicException in CheckSignature (both NET_2_0).
        * KeyInfoRetrievalMethod.cs: Don't include an empty URI attribute
        in the XML output for NET_2_0.
        * XmlDsigXPathTransform.cs: Throw an XPathException in NET_2_0 if no
        xpath expression has been supplied to the transform.



Modified: 
trunk/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog
===================================================================
--- trunk/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog  
2005-05-04 15:51:23 UTC (rev 44033)
+++ trunk/mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog  
2005-05-04 16:21:08 UTC (rev 44034)
@@ -1,3 +1,12 @@
+2005-05-04  Sebastien Pouliot  <[EMAIL PROTECTED]>
+
+       * SignedXml.cs: Return an empty (not null) KeyInfo by default and
+       don't throw a CryptographicException in CheckSignature (both NET_2_0).
+       * KeyInfoRetrievalMethod.cs: Don't include an empty URI attribute
+       in the XML output for NET_2_0.
+       * XmlDsigXPathTransform.cs: Throw an XPathException in NET_2_0 if no
+       xpath expression has been supplied to the transform.
+
 2005-05-03  Sebastien Pouliot  <[EMAIL PROTECTED]>
 
        * XmlDsigXsltTransform.cs: Fixed 2 test cases (that nows throws 

Modified: 
trunk/mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoRetrievalMethod.cs
===================================================================
--- 
trunk/mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoRetrievalMethod.cs
  2005-05-04 15:51:23 UTC (rev 44033)
+++ 
trunk/mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoRetrievalMethod.cs
  2005-05-04 16:21:08 UTC (rev 44034)
@@ -84,11 +84,14 @@
 
                        XmlDocument document = new XmlDocument ();
                        XmlElement xel = document.CreateElement 
(XmlSignature.ElementNames.RetrievalMethod, XmlSignature.NamespaceURI);
-                       if (URI != null)
+#if NET_2_0
+                       if ((URI != null) && (URI.Length > 0))
                                xel.SetAttribute 
(XmlSignature.AttributeNames.URI, URI);
-#if NET_2_0
                        if (Type != null)
                                xel.SetAttribute 
(XmlSignature.AttributeNames.Type, Type);
+#else
+                       if (URI != null)
+                               xel.SetAttribute 
(XmlSignature.AttributeNames.URI, URI);
 #endif
                        return xel;
                }

Modified: 
trunk/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs
===================================================================
--- 
trunk/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs   
    2005-05-04 15:51:23 UTC (rev 44033)
+++ 
trunk/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs   
    2005-05-04 16:21:08 UTC (rev 44034)
@@ -119,7 +119,13 @@
 #endif
 
                public KeyInfo KeyInfo {
-                       get { return m_signature.KeyInfo; }
+                       get {
+#if NET_2_0
+                               if (m_signature.KeyInfo == null)
+                                       m_signature.KeyInfo = new KeyInfo ();
+#endif
+                               return m_signature.KeyInfo;
+                       }
                        set { m_signature.KeyInfo = value; }
                }
 
@@ -156,10 +162,6 @@
 
                public void AddObject (DataObject dataObject) 
                {
-#if NET_2_0
-                       if (dataObject == null)
-                               throw new ArgumentNullException ("dataObject");
-#endif
                        m_signature.AddObject (dataObject);
                }
 
@@ -480,10 +482,14 @@
                                // check with supplied key
                                if (!CheckSignatureWithKey (key))
                                        return null;
-                       }
-                       else {
+                       } else {
+#if NET_2_0
                                if (Signature.KeyInfo == null)
+                                       return null;
+#else
+                               if (Signature.KeyInfo == null)
                                        throw new CryptographicException ("At 
least one KeyInfo is required.");
+#endif
                                // no supplied key, iterates all KeyInfo
                                while ((key = GetPublicKey ()) != null) {
                                        if (CheckSignatureWithKey (key)) {

Modified: 
trunk/mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigXPathTransform.cs
===================================================================
--- 
trunk/mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigXPathTransform.cs
   2005-05-04 15:51:23 UTC (rev 44033)
+++ 
trunk/mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigXPathTransform.cs
   2005-05-04 16:21:08 UTC (rev 44034)
@@ -8,10 +8,8 @@
 //     Atsushi Enomoto <[EMAIL PROTECTED]>
 //
 // (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// (C) 2004 Novell (http://www.novell.com)
+// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
 //
-
-//
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
 // "Software"), to deal in the Software without restriction, including
@@ -100,9 +98,13 @@
                [MonoTODO ("Evaluation of extension function here() results in 
different from MS.NET (is MS.NET really correct??).")]
                public override object GetOutput () 
                {
+#if NET_2_0
                        if (xpath == null)
+                               throw new XPathException (Locale.GetText ("No 
XPath expression provided."));
+#else
+                       if (xpath == null)
                                return new XmlDsigNodeList (new ArrayList ());
-
+#endif
                        // evaluate every time since input or xpath might have 
changed.
                        string x = null;
                        for (int i = 0; i < xpath.Count; i++) {

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

Reply via email to