signedxml

Digitally Sign Parts of a XML document

徘徊边缘 提交于 2019-11-30 16:25:56
问题 I have an XML document having structure similar to the following <envelop> <header>blaa</header> <message>blaa blaa</message> <footer></footer> </envelop> I want to digitally sign the header and message elements and add the signature to the footer element. How can I sign the elements and then later verify the signature (using .net c#) ? 回答1: You should be able to add an XPath-Transform to the Signature. It should look something like this: <Transform Algorithm="http://www.w3.org/TR/1999/REC

Digitally Sign Parts of a XML document

倾然丶 夕夏残阳落幕 提交于 2019-11-30 16:08:53
I have an XML document having structure similar to the following <envelop> <header>blaa</header> <message>blaa blaa</message> <footer></footer> </envelop> I want to digitally sign the header and message elements and add the signature to the footer element. How can I sign the elements and then later verify the signature (using .net c#) ? You should be able to add an XPath-Transform to the Signature. It should look something like this: <Transform Algorithm="http://www.w3.org/TR/1999/REC-xpath-19991116"> <XPath xmlns:dsig="&dsig;"> ... </XPath> </Transform> I am not fluent in XPath, but it should

SignedXml.CheckSignature fails in .NET 4 but it works in .NET 3.5, 3 or 2

此生再无相见时 提交于 2019-11-28 01:47:10
I have a response from a 3-rd party web service. I load an XmlDocument with that response. string txt = readStream.ReadToEnd(); response = new XmlDocument(); response.PreserveWhitespace = true; response.LoadXml(txt); return response; Now I would like to verify that the respones is signed using the certificate. I have a VerifyXmlDoc(XmlDocument xmlDoc) method which I have found on msdn . I know that the message is correct. public bool VerifyXmlDoc(XmlDocument xmlDoc) { SignedXml signed = new SignedXml(xmlDoc); XmlNodeList signatureNodeList = xmlDoc.GetElementsByTagName("Signature"); signed

SignedXml.CheckSignature fails in .NET 4 but it works in .NET 3.5, 3 or 2

别等时光非礼了梦想. 提交于 2019-11-26 21:59:52
问题 I have a response from a 3-rd party web service. I load an XmlDocument with that response. string txt = readStream.ReadToEnd(); response = new XmlDocument(); response.PreserveWhitespace = true; response.LoadXml(txt); return response; Now I would like to verify that the respones is signed using the certificate. I have a VerifyXmlDoc(XmlDocument xmlDoc) method which I have found on msdn. I know that the message is correct. public bool VerifyXmlDoc(XmlDocument xmlDoc) { SignedXml signed = new