Re: Xmldsig Countersignature DigestValue
- From: "Valery Pryamikov" <valery@xxxxxxxxx>
- Date: 27 Mar 2007 03:31:03 -0700
On Mar 22, 2:32 pm, "Iguana" <szewcz...@xxxxxxxxxxxxxxx> wrote:
Hi!
How can i calculate DigestValue for Reference to signature ( ...
uri="#signatureId" ...)?
I try this code:
xmlElement - signature from xml file;
SignedXml signature = new SignedXml();
signature.LoadXml((XmlElement)xmlElement);
Transform t = new
System.Security.Cryptography.Xml.XmlDsigC14NTransform();
XmlDocument doc = new XmlDocument();
doc.PreserveWhitespace = true;
doc.LoadXml(signature.GetXml().OuterXml);
System.IO.Stream s = null;
t.LoadInput(doc);
SHA1 sha1 = SHA1.Create();
byte[] digestValue = t.GetDigestedOutput(sha1);
MessageBox.Show(Convert.ToBase64String(digestValue));
Calculated digestValue is not the same, which is in reference
digestValue in countersignature after signing.
Can anyone help me calculate this digestValue?
Iguana
Hi,
are you verifying signature created with .Net or with some other
framework?
the reason I'm asking is that .Net XmlDsigC14NTransform class is not
conformant.
If signature was created with .Net (same version), then you should not
have any problems, however
if this is other thirdparty library that creates signature, then you
may have problems.
According to spec. all whitespaces, significant or not, must be
preserved during serialization.
All open source or Java implementations of XML signatures follows this
rule and preserve all witespaces.
However .Net XmlDsigC14Transform never preservers insignificant
whitespaces, because no Microsoft
XML API reports insignificant whitespaces to the XML processors.
It is easy to check if you are experiencing this problem. Check if
input contains insignificant
whitespaces, and if it does, then it probably it.
-Valery.
.
- Follow-Ups:
- Re: Xmldsig Countersignature DigestValue
- From: Valery Pryamikov
- Re: Xmldsig Countersignature DigestValue
- References:
- Xmldsig Countersignature DigestValue
- From: Iguana
- Xmldsig Countersignature DigestValue
- Prev by Date: Re: Setting the permissions on certificates
- Next by Date: Re: Xmldsig Countersignature DigestValue
- Previous by thread: Xmldsig Countersignature DigestValue
- Next by thread: Re: Xmldsig Countersignature DigestValue
- Index(es):
Relevant Pages
|