private static void MarkInclusionStateForNodes( XmlNodeList nodeList, XmlDocument inputRoot, XmlDocument root) { CanonicalXmlNodeList canonicalXmlNodeList1 = new CanonicalXmlNodeList(); CanonicalXmlNodeList canonicalXmlNodeList2 = new CanonicalXmlNodeList(); canonicalXmlNodeList1.Add((object)inputRoot); canonicalXmlNodeList2.Add((object)root); int index1 = 0; do { XmlNode xmlNode1 = canonicalXmlNodeList1[index1]; XmlNode xmlNode2 = canonicalXmlNodeList2[index1]; XmlNodeList childNodes1 = xmlNode1.ChildNodes; XmlNodeList childNodes2 = xmlNode2.ChildNodes; for (int index2 = 0; index2 < childNodes1.Count; ++index2) { canonicalXmlNodeList1.Add((object)childNodes1[index2]); canonicalXmlNodeList2.Add((object)childNodes2[index2]); if (Exml.NodeInList(childNodes1[index2], nodeList)) { ExcCanonicalXml.MarkNodeAsIncluded(childNodes2[index2]); } XmlAttributeCollection attributes = childNodes1[index2].Attributes; if (attributes != null) { for (int index3 = 0; index3 < attributes.Count; ++index3) { if (Exml.NodeInList((XmlNode)attributes[index3], nodeList)) { ExcCanonicalXml.MarkNodeAsIncluded(childNodes2[index2].Attributes.Item(index3)); } } } } ++index1; }while (index1 < canonicalXmlNodeList1.Count); }
/// <summary>When overridden in a derived class, loads the specified input into the current <see cref="T:System.Security.Cryptography.Xml.XmlDsigExcC14NTransform" /> object.</summary> /// <param name="obj">The input to load into the current <see cref="T:System.Security.Cryptography.Xml.XmlDsigExcC14NTransform" /> object.</param> /// <exception cref="T:System.ArgumentException">The <paramref name="obj" /> parameter is not a <see cref="T:System.IO.Stream" /> object.-or-The <paramref name="obj" /> parameter is not an <see cref="T:System.Xml.XmlDocument" /> object.-or-The <paramref name="obj" /> parameter is not an <see cref="T:System.Xml.XmlNodeList" /> object.</exception> public override void LoadInput(object obj) { XmlResolver resolver = this.ResolverSet ? this.m_xmlResolver : (XmlResolver) new XmlSecureResolver((XmlResolver) new XmlUrlResolver(), this.BaseURI); if (obj is Stream) { this._excCanonicalXml = new ExcCanonicalXml((Stream)obj, this._includeComments, this._inclusiveNamespacesPrefixList, resolver, this.BaseURI); } else if (obj is XmlDocument) { this._excCanonicalXml = new ExcCanonicalXml((XmlDocument)obj, this._includeComments, this._inclusiveNamespacesPrefixList, resolver); } else { if (!(obj is XmlNodeList)) { throw new ArgumentException("Cryptography_Xml_IncorrectObjectType", nameof(obj)); } this._excCanonicalXml = new ExcCanonicalXml((XmlNodeList)obj, this._includeComments, this._inclusiveNamespacesPrefixList, resolver); } }
internal ExcCanonicalXml( XmlNodeList nodeList, bool includeComments, string inclusiveNamespacesPrefixList, XmlResolver resolver) { if (nodeList == null) { throw new ArgumentNullException(nameof(nodeList)); } XmlDocument ownerDocument = Exml.GetOwnerDocument(nodeList); if (ownerDocument == null) { throw new ArgumentException(nameof(nodeList)); } this.m_c14nDoc = new CanonicalXmlDocument(false, includeComments); this.m_c14nDoc.XmlResolver = resolver; this.m_c14nDoc.Load((XmlReader) new XmlNodeReader((XmlNode)ownerDocument)); this.m_ancMgr = new ExcAncestralNamespaceContextManager(inclusiveNamespacesPrefixList); ExcCanonicalXml.MarkInclusionStateForNodes(nodeList, ownerDocument, (XmlDocument)this.m_c14nDoc); }