(DISTFILES): Comment out a few missing files.
[mono-project.git] / mcs / class / System.Security / System.Security.Cryptography.Xml / XmlDsigExcC14NTransform.cs
blobff4e5414b8c7ff9f5b9f949b1dec5456778189c2
1 //
2 // XmlDsigExcC14NTransform.cs - XmlDsigExcC14NTransform implementation for XML Encryption
3 //
4 // Author:
5 // Tim Coleman (tim@timcoleman.com)
6 //
7 // Copyright (C) Tim Coleman, 2004
9 //
10 // Permission is hereby granted, free of charge, to any person obtaining
11 // a copy of this software and associated documentation files (the
12 // "Software"), to deal in the Software without restriction, including
13 // without limitation the rights to use, copy, modify, merge, publish,
14 // distribute, sublicense, and/or sell copies of the Software, and to
15 // permit persons to whom the Software is furnished to do so, subject to
16 // the following conditions:
17 //
18 // The above copyright notice and this permission notice shall be
19 // included in all copies or substantial portions of the Software.
20 //
21 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
25 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
26 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
30 #if NET_2_0
32 using Mono.Xml;
33 using System.IO;
34 using System.Xml;
36 namespace System.Security.Cryptography.Xml {
37 public class XmlDsigExcC14NTransform : Transform {
39 #region Fields
41 XmlCanonicalizer canonicalizer;
42 object inputObj;
43 string inclusiveNamespacesPrefixList;
44 bool includeComments;
46 #endregion // Fields
48 #region Constructors
50 public XmlDsigExcC14NTransform ()
52 Algorithm = XmlSignature.AlgorithmNamespaces.XmlDsigExcC14NTransform;
53 canonicalizer = new XmlCanonicalizer (true, false);
56 public XmlDsigExcC14NTransform (bool includeComments)
58 this.includeComments = includeComments;
59 canonicalizer = new XmlCanonicalizer (true, includeComments);
62 [MonoTODO ("What does inclusiveNamespacesPrefixList mean?")]
63 public XmlDsigExcC14NTransform (string inclusiveNamespacesPrefixList)
65 this.inclusiveNamespacesPrefixList = inclusiveNamespacesPrefixList;
68 [MonoTODO ("What does inclusiveNamespacesPrefixList mean?")]
69 public XmlDsigExcC14NTransform (bool includeComments, string inclusiveNamespacesPrefixList)
71 this.inclusiveNamespacesPrefixList = inclusiveNamespacesPrefixList;
72 this.includeComments = includeComments;
75 #endregion // Constructors
77 #region Properties
79 public string InclusiveNamespacesPrefixList {
80 get { return inclusiveNamespacesPrefixList; }
81 set { inclusiveNamespacesPrefixList = value; }
84 public override Type[] InputTypes {
85 get { return new Type [3] {typeof (System.IO.Stream), typeof (System.Xml.XmlDocument), typeof (System.Xml.XmlNodeList)}; }
88 public override Type[] OutputTypes {
89 get { return new Type [1] {typeof (System.IO.Stream)}; }
92 #endregion // Properties
94 #region Methods
96 public override byte[] GetDigestedOutput (HashAlgorithm hash)
98 return hash.ComputeHash ((Stream) GetOutput());
101 protected override XmlNodeList GetInnerXml ()
103 return null;
106 public override object GetOutput ()
108 Stream s = null;
110 if (inputObj is Stream) {
111 XmlDocument doc = new XmlDocument ();
112 doc.PreserveWhitespace = true; // REALLY IMPORTANT
113 doc.Load (inputObj as Stream);
114 s = canonicalizer.Canonicalize (doc);
116 else if (inputObj is XmlDocument)
117 s = canonicalizer.Canonicalize (inputObj as XmlDocument);
118 else if (inputObj is XmlNodeList)
119 s = canonicalizer.Canonicalize (inputObj as XmlNodeList);
121 // note: there is no default are other types won't throw an exception
123 return (object) s;
126 public override object GetOutput (Type type)
128 if (type == Type.GetType ("Stream"))
129 return GetOutput ();
130 throw new ArgumentException ("type");
133 public override void LoadInnerXml (XmlNodeList nodeList)
137 public override void LoadInput (object obj)
139 inputObj = obj;
142 #endregion // Methods
146 #endif