示例#1
0
        private byte[] GetXDocumentHash(XDocument xdocument)
        {
            MemoryStream memoryStream = new MemoryStream();
            using (XmlWriter xmlWriter = XmlWriter.Create(memoryStream))
            {
                xdocument.WriteTo(xmlWriter);
            }
            memoryStream.Position = 0;

            var xfrm = new System.Security.Cryptography.Xml.XmlDsigC14NTransform(false);
            xfrm.LoadInput(memoryStream);
            byte[] result = xfrm.GetDigestedOutput(new System.Security.Cryptography.SHA1Managed());
            return result;
        }