Files
mono/mcs/class/System.Security/System.Security.Cryptography.Xml/Transform.cs
T
Atsushi Eno 461b2e57a5 2004-05-05 Atsushi Enomoto <[email protected]>
* SignedXml.cs,
	  Transform.cs : code cleanup. #if !NET_1_0 -> #if NET_1_1.
	* XmlDsigBase64Transform.cs : Should not output the content of the
	  selected element nodes. Put text content only those text nodes are
	  in the node list.
	* XmlDsigEnvelopedSignatureTransform.cs : removed MonoTODO.
	* XmlDsigXsltTransform.cs : Use XmlResolver to load document and
	  to transform. Throw null reference exception explicitly when
	  the input was not loaded.

svn path=/trunk/mcs/; revision=26731
2004-05-05 03:45:49 +00:00

85 lines
1.8 KiB
C#

//
// Transform.cs - Transform implementation for XML Signature
//
// Author:
// Sebastien Pouliot <[email protected]>
// Atsushi Enomoto <[email protected]>
//
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
// (C) 2004 Novell (http://www.novell.com)
//
using System.Runtime.InteropServices;
using System.Security.Policy;
using System.Xml;
namespace System.Security.Cryptography.Xml {
public abstract class Transform {
private string algo;
private XmlResolver xmlResolver;
public Transform ()
{
// FIXME: enable it after CAS implementation
#if false // NET_1_1
xmlResolver = new XmlSecureResolver (new XmlUrlResolver (), (Evidence) new Evidence ());
#else
xmlResolver = new XmlUrlResolver ();
#endif
}
public string Algorithm {
get { return algo; }
set { algo = value; }
}
public abstract Type[] InputTypes {
get;
}
public abstract Type[] OutputTypes {
get;
}
protected abstract XmlNodeList GetInnerXml ();
public abstract object GetOutput ();
public abstract object GetOutput (Type type);
public XmlElement GetXml ()
{
XmlDocument document = new XmlDocument ();
document.XmlResolver = GetResolver ();
XmlElement xel = document.CreateElement (XmlSignature.ElementNames.Transform, XmlSignature.NamespaceURI);
xel.SetAttribute (XmlSignature.AttributeNames.Algorithm, algo);
XmlNodeList xnl = this.GetInnerXml ();
if (xnl != null) {
foreach (XmlNode xn in xnl) {
XmlNode importedNode = document.ImportNode (xn, true);
xel.AppendChild (importedNode);
}
}
return xel;
}
public abstract void LoadInnerXml (XmlNodeList nodeList);
public abstract void LoadInput (object obj);
internal XmlResolver GetResolver ()
{
return xmlResolver;
}
#if NET_1_1
[ComVisible(false)]
public XmlResolver Resolver {
set { xmlResolver = value; }
}
#endif
}
}