private bool comments;
private object inputObj;
- public XmlDsigEnvelopedSignatureTransform ()
+ public XmlDsigEnvelopedSignatureTransform ()
+ : this (false)
{
- Algorithm = "http://www.w3.org/2000/09/xmldsig#enveloped-signature";
- comments = false;
}
public XmlDsigEnvelopedSignatureTransform (bool includeComments)
{
+ Algorithm = XmlSignature.AlgorithmNamespaces.XmlDsigEnvelopedSignatureTransform;
comments = includeComments;
}
public override Type[] InputTypes {
get {
if (input == null) {
- lock (this) {
- // this way the result is cached if called multiple time
- input = new Type [3];
- input[0] = typeof (System.IO.Stream);
- input[1] = typeof (System.Xml.XmlDocument);
- input[2] = typeof (System.Xml.XmlNodeList);
- }
+ input = new Type [3];
+ input[0] = typeof (System.IO.Stream);
+ input[1] = typeof (System.Xml.XmlDocument);
+ input[2] = typeof (System.Xml.XmlNodeList);
}
return input;
}
public override Type[] OutputTypes {
get {
if (output == null) {
- lock (this) {
- // this way the result is cached if called multiple time
- output = new Type [2];
- output [0] = typeof (System.Xml.XmlDocument);
- output [1] = typeof (System.Xml.XmlNodeList);
- }
+ output = new Type [2];
+ output [0] = typeof (System.Xml.XmlDocument);
+ output [1] = typeof (System.Xml.XmlNodeList);
}
return output;
}
if (inputObj is Stream) {
doc = new XmlDocument ();
doc.PreserveWhitespace = true;
-#if NET_1_1
doc.XmlResolver = GetResolver ();
-#endif
- doc.Load (inputObj as Stream);
+ doc.Load (new XmlSignatureStreamReader (
+ new StreamReader (inputObj as Stream)));
return GetOutputFromNode (doc, GetNamespaceManager (doc), true);
}
else if (inputObj is XmlDocument) {
private XmlNamespaceManager GetNamespaceManager (XmlNode n)
{
- XmlDocument doc = n is XmlDocument ? n as XmlDocument : n.OwnerDocument;
+ XmlDocument doc = ((n is XmlDocument) ? (n as XmlDocument) : n.OwnerDocument);
XmlNamespaceManager nsmgr = new XmlNamespaceManager (doc.NameTable);
nsmgr.AddNamespace ("dsig", XmlSignature.NamespaceURI);
return nsmgr;
{
if (remove) {
XmlNodeList nl = input.SelectNodes ("descendant-or-self::dsig:Signature", nsmgr);
+ ArrayList al = new ArrayList ();
foreach (XmlNode n in nl)
+ al.Add (n);
+ foreach (XmlNode n in al)
n.ParentNode.RemoveChild (n);
}
return input;
public override object GetOutput (Type type)
{
- if (type == Type.GetType ("Stream"))
+ if (type == typeof (Stream))
return GetOutput ();
throw new ArgumentException ("type");
}