2003-01-17 Sebastien Pouliot <spouliot@videotron.ca>
authorSebastien Pouliot <sebastien@ximian.com>
Sat, 18 Jan 2003 00:56:18 +0000 (00:56 -0000)
committerSebastien Pouliot <sebastien@ximian.com>
Sat, 18 Jan 2003 00:56:18 +0000 (00:56 -0000)
* KeyInfo.cs: Changed some protected declaration to private.
* KeyInfoName.cs: Changed some protected declaration to private.
* KeyInfoNode.cs: Changed some protected declaration to private.
* KeyInfoRetrievalMethod.cs: Changed some protected declaration to private.
* KeyInfoX509Data.cs: Changed some protected declaration to private.
* Transform.cs: Changed some protected declaration to private.
* XmlDsigBase64Transform.cs: Changed some protected declaration to private.
* XmlDsigC14NTransform.cs: Changed some protected declaration to private.
* XmlDsigC14NWithCommentsTransform.cs: Changed some protected declaration to private.
* XmlDsigEnvelopedSignatureTransform.cs: Changed some protected declaration to private.
* XmlDsigXPathTransform.cs: Changed some protected declaration to private.
* XmlDsigXsltTransform.cs: Changed some protected declaration to private.

svn path=/trunk/mcs/; revision=10636

12 files changed:
mcs/class/System.Security/System.Security.Cryptography.Xml/ChangeLog
mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfo.cs
mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoName.cs
mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoNode.cs
mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoRetrievalMethod.cs
mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoX509Data.cs
mcs/class/System.Security/System.Security.Cryptography.Xml/Transform.cs
mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigBase64Transform.cs
mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigC14NTransform.cs
mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigEnvelopedSignatureTransform.cs
mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigXPathTransform.cs
mcs/class/System.Security/System.Security.Cryptography.Xml/XmlDsigXsltTransform.cs

index 6093ea390b2ea435af147fe63c082d408f3bfda3..8b7882eea4d5de0fb3f249c840ea2cb5ad88b5c3 100644 (file)
@@ -1,3 +1,18 @@
+2003-01-17  Sebastien Pouliot  <spouliot@videotron.ca>
+
+       * KeyInfo.cs: Changed some protected declaration to private.
+       * KeyInfoName.cs: Changed some protected declaration to private.
+       * KeyInfoNode.cs: Changed some protected declaration to private.
+       * KeyInfoRetrievalMethod.cs: Changed some protected declaration to private.
+       * KeyInfoX509Data.cs: Changed some protected declaration to private.
+       * Transform.cs: Changed some protected declaration to private.
+       * XmlDsigBase64Transform.cs: Changed some protected declaration to private.
+       * XmlDsigC14NTransform.cs: Changed some protected declaration to private.
+       * XmlDsigC14NWithCommentsTransform.cs: Changed some protected declaration to private.
+       * XmlDsigEnvelopedSignatureTransform.cs: Changed some protected declaration to private.
+       * XmlDsigXPathTransform.cs: Changed some protected declaration to private.
+       * XmlDsigXsltTransform.cs: Changed some protected declaration to private.
+
 2002-11-28  Sebastien Pouliot  <spouliot@videotron.ca>
 
        * TODOAttribute.cs: New. Still much to do ;-)
index e251cb24d8d2815fec92327479b2ae4493178940..9ce4bc4162f21e49759bcf5188f50c1f9b5beb34 100644 (file)
@@ -17,8 +17,8 @@ public class KeyInfo : IEnumerable {
 
        static private string xmldsig = "http://www.w3.org/2000/09/xmldsig#";
 
-       protected ArrayList Info;
-       protected string id;
+       private ArrayList Info;
+       private string id;
 
        public KeyInfo() 
        {
index 18da67ba578327c4ebdd5dbf4784b3c9e1a8dd15..4537e3dc631986faadad2182811134156976af18 100644 (file)
@@ -14,7 +14,7 @@ namespace System.Security.Cryptography.Xml {
 
 public class KeyInfoName : KeyInfoClause {
 
-       protected string Name;
+       private string Name;
 
        public KeyInfoName() {}
 
index 2c1519615b94fbb954b61859638db41279affccb..4e0eef0199f9c6e68fa213c241dacb2835f36153 100644 (file)
@@ -14,7 +14,7 @@ namespace System.Security.Cryptography.Xml {
 
 public class KeyInfoNode : KeyInfoClause {
 
-       protected XmlElement Node;
+       private XmlElement Node;
 
        public KeyInfoNode () {}
 
index 61014ab7aa4d70e491d7bb314ab09c74df818b16..ae7c2aa268c925d19c2a2c003475443b7d1df0cf 100644 (file)
@@ -14,7 +14,7 @@ namespace System.Security.Cryptography.Xml {
 
 public class KeyInfoRetrievalMethod : KeyInfoClause {
 
-       protected string URI;
+       private string URI;
 
        public KeyInfoRetrievalMethod () {}
 
index eec3f161b8495b911e8ab5008731d1093f0883bd..09a742fe7395db58dce12a05aa83de7f54549d60 100644 (file)
@@ -28,11 +28,11 @@ internal class IssuerSerial {
 
 public class KeyInfoX509Data : KeyInfoClause {
 
-       protected byte[] x509crl;
-       protected ArrayList IssuerSerialList;
-       protected ArrayList SubjectKeyIdList;
-       protected ArrayList SubjectNameList;
-       protected ArrayList X509CertificateList;
+       private byte[] x509crl;
+       private ArrayList IssuerSerialList;
+       private ArrayList SubjectKeyIdList;
+       private ArrayList SubjectNameList;
+       private ArrayList X509CertificateList;
 
        public KeyInfoX509Data () 
        {
@@ -153,10 +153,10 @@ public class KeyInfoX509Data : KeyInfoClause {
                return doc.DocumentElement;
        }
 
-       public override void LoadXml (XmlElement value
+       public override void LoadXml (XmlElement element
        {
-               if (value == null)
-                       throw new ArgumentNullException ();
+               if (element == null)
+                       throw new ArgumentNullException ("element");
 
                IssuerSerialList.Clear ();
                SubjectKeyIdList.Clear ();
@@ -165,10 +165,10 @@ public class KeyInfoX509Data : KeyInfoClause {
                x509crl = null;
 
                string ns = "http://www.w3.org/2000/09/xmldsig#";
-               if ((value.LocalName == "X509Data") && (value.NamespaceURI == ns)) {
+               if ((element.LocalName == "X509Data") && (element.NamespaceURI == ns)) {
                        XmlNodeList xnl = null;
                        // <X509IssuerSerial>
-                       xnl = value.GetElementsByTagName ("X509IssuerSerial", ns);
+                       xnl = element.GetElementsByTagName ("X509IssuerSerial", ns);
                        if (xnl != null) {
                                for (int i=0; i < xnl.Count; i++) {
                                        XmlElement xel = (XmlElement) xnl[i];
@@ -178,7 +178,7 @@ public class KeyInfoX509Data : KeyInfoClause {
                                }
                        }
                        // <X509SKI>
-                       xnl = value.GetElementsByTagName ("X509SKI", ns);
+                       xnl = element.GetElementsByTagName ("X509SKI", ns);
                        if (xnl != null) {
                                for (int i=0; i < xnl.Count; i++) {
                                        byte[] skid = Convert.FromBase64String (xnl[i].InnerXml);
@@ -186,14 +186,14 @@ public class KeyInfoX509Data : KeyInfoClause {
                                }
                        }
                        // <X509SubjectName>
-                       xnl = value.GetElementsByTagName ("X509SubjectName", ns);
+                       xnl = element.GetElementsByTagName ("X509SubjectName", ns);
                        if (xnl != null) {
                                for (int i=0; i < xnl.Count; i++) {
                                        AddSubjectName (xnl[i].InnerXml);
                                }
                        }
                        // <X509Certificate>
-                       xnl = value.GetElementsByTagName ("X509Certificate", ns);
+                       xnl = element.GetElementsByTagName ("X509Certificate", ns);
                        if (xnl != null) {
                                for (int i=0; i < xnl.Count; i++) {
                                        byte[] cert = Convert.FromBase64String (xnl[i].InnerXml);
@@ -201,13 +201,13 @@ public class KeyInfoX509Data : KeyInfoClause {
                                }
                        }
                        // only one <X509CRL> 
-                       xnl = value.GetElementsByTagName ("X509CRL", ns);
+                       xnl = element.GetElementsByTagName ("X509CRL", ns);
                        if ((xnl != null) && (xnl.Count > 0)) {
                                x509crl = Convert.FromBase64String (xnl[0].InnerXml);
                        }
                }
                else
-                       throw new CryptographicException ("value");
+                       throw new CryptographicException ("element");
        }
 }
 
index 0d98b32b92827013193ba123a3b3d20aef9b443d..32375dd6716dc729a7580b74dd1e47d788322cac 100644 (file)
@@ -14,9 +14,7 @@ namespace System.Security.Cryptography.Xml {
 
 public abstract class Transform {
 
-       protected string algo;
-       protected Type[] input;
-       protected Type[] output;
+       private string algo;
 
        public Transform () {}
 
index 6173039d108480f0e3bf5ab5d435af6f223b6925..22fde9fd873173d3aa74a7a7fbe028209e2507a0 100644 (file)
@@ -17,11 +17,13 @@ namespace System.Security.Cryptography.Xml {
 // http://www.w3.org/2000/09/xmldsig#base64
 public class XmlDsigBase64Transform : Transform {
 
+       private Type[] input;
+       private Type[] output;
        private CryptoStream cs;
 
        public XmlDsigBase64Transform () 
        {
-               algo = "http://www.w3.org/2000/09/xmldsig#base64";
+               Algorithm = "http://www.w3.org/2000/09/xmldsig#base64";
        }
 
        public override Type[] InputTypes {
index d6e8416c1bd8d4b188eb430e372a3dc4db9d50a5..a689f0f118b4d1d68f0b32b4c7428c2cf41179f5 100644 (file)
@@ -9,16 +9,21 @@
 //
 
 using System.IO;
+using System.Text;
 using System.Xml;
 
 namespace System.Security.Cryptography.Xml { 
 
 public class XmlDsigC14NTransform : Transform {
 
-       protected bool comments;
+       private Type[] input;
+       private Type[] output;
+       private bool comments;
+       private Stream s;
 
        public XmlDsigC14NTransform () 
        {
+               Algorithm = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315";
                comments = false;
        }
 
@@ -62,8 +67,7 @@ public class XmlDsigC14NTransform : Transform {
 
        public override object GetOutput () 
        {
-//             return (object) new Stream ();
-               return null;
+               return (object) s;
        }
 
        public override object GetOutput (Type type) 
@@ -75,12 +79,31 @@ public class XmlDsigC14NTransform : Transform {
 
        public override void LoadInnerXml (XmlNodeList nodeList) 
        {
-               // NO CHANGE
+               // documented as not changing the state of the transform
        }
 
        public override void LoadInput (object obj) 
        {
-       //      if (type.Equals (Stream.GetType ())
+               XmlNodeList xnl = null;
+
+               if (obj is Stream) 
+                       s = (obj as Stream);
+               else if (obj is XmlDocument)
+                       xnl = (obj as XmlDocument).ChildNodes;
+               else if (obj is XmlNodeList)
+                       xnl = (XmlNodeList) obj;
+
+               if (xnl != null) {
+                       StringBuilder sb = new StringBuilder ();
+                       foreach (XmlNode xn in xnl)
+                               sb.Append (xn.InnerText);
+
+                       UTF8Encoding utf8 = new UTF8Encoding ();
+                       byte[] data = utf8.GetBytes (sb.ToString ());
+                       s = new MemoryStream (data);
+               }
+
+               // note: there is no default are other types won't throw an exception
        }
 }
 
index 9349baa1d0562f5dc3853f5a54319e765365ceb8..f67a8579d79cf3322a2c368963d836060944c50b 100644 (file)
@@ -15,7 +15,9 @@ namespace System.Security.Cryptography.Xml {
 
 public class XmlDsigEnvelopedSignatureTransform : Transform {
 
-       protected bool comments;
+       private Type[] input;
+       private Type[] output;
+       private bool comments;
 
        public XmlDsigEnvelopedSignatureTransform () 
        {
index 4c9c8be2ba048112ab77975273bdd12fa7059d73..5c5fd963b8b474398a2180921e3daf238baa380a 100644 (file)
@@ -20,6 +20,8 @@ namespace System.Security.Cryptography.Xml {
 // see Section 6.6.3 of the XMLDSIG specification
 public class XmlDsigXPathTransform : Transform {
 
+       private Type[] input;
+       private Type[] output;
        private XmlNodeList xnl;
        private XmlNodeList xpathNodes;
 
index b8e81475dfbdefb75637ce08620536126c603e53..524541ea67cadf7c848dc439fea9379e406e9668 100644 (file)
@@ -18,6 +18,8 @@ namespace System.Security.Cryptography.Xml {
 
 public class XmlDsigXsltTransform : Transform {
 
+       private Type[] input;
+       private Type[] output;
        private bool comments;
        private XmlNodeList xnl;
        private CryptoStream cs;
@@ -27,7 +29,7 @@ public class XmlDsigXsltTransform : Transform {
        public XmlDsigXsltTransform (bool includeComments) 
        {
                comments = includeComments;
-               algo = "http://www.w3.org/TR/1999/REC-xslt-19991116";
+               Algorithm = "http://www.w3.org/TR/1999/REC-xslt-19991116";
        }
 
        public override Type[] InputTypes {