Hi I am trying to find hash value based on part of a xml documnet.
here is my code:
Dim myDoc As New XmlDocument
Dim fileNAme As String
fileNAme = Server.MapPath("Test.xml")
myDoc.Load(fileNAme)
Dim Forms_Xpath As String = "//Employee"
Dim nav As System.Xml.XPath.XPathNavigator = myDoc.CreateNavigator()
Dim nodeList As XmlNodeList
nodeList = myDoc.SelectNodes(Forms_Xpath)
Dim myC14NT As New XmlDsigExcC14NTransform
myC14NT.LoadInput(nodeList)
Dim MessageStream As Stream
MessageStream = myC14NT.GetOutput(GetType(Stream))
Dim HashValue() As Byte
Dim SHhash As New SHA1Managed
HashValue = SHhash.ComputeHash(MessageStream)
Dim strHASH As String
strHASH = Convert.ToBase64String(HashValue2, 0, HashValue2.Length)
Label1.Text = strHASH
-------------------
it is generating a wrong value. here is my xml file:
<Employees>
<Employee ID="1">
<FirstName>Klaus</FirstName>
<LastName>Salchner</LastName>
<PhoneNumber>410-727-5112</PhoneNumber>
<EmailAddress>klaus_salchner@hotmail.com</EmailAddress>
<WebAddress>http://www.enterprise-minds.com</WebAddress>
<JobTitle>Sr. Enterprise Architect</JobTitle>
</Employee>
<Employee ID="2">
<FirstName>Peter</FirstName>
<LastName>Pan</LastName>
<PhoneNumber>604-111-1111</PhoneNumber>
<EmailAddress>peter.pan@fiction.com</EmailAddress>
<JobTitle>Sr. Developer</JobTitle>
</Employee>
</Employees>
I think it is canonicalizing only <Employee></Employee> node, not the content of the entire employee node.
Any suggestions will be helpful.
thanks-hari

XmlDsigExcC14NTransform