[Mono-list] SignedXML: Where does the digest come from

Mathias Tausig mtausig at fsmat.at
Thu May 29 05:16:21 EDT 2008


Hy!

I am creating a signed xml document using:

XmlDocument objdoc=new XmlDocument();
objdoc.Load("test.xhtml");
DataObject dObj=new DataObject();
dObj.Id="xmldsig-dataobj";
dObj.Data=objdoc.ChildNodes;
Reference dRef=new Reference("#xmldsig-dataobj");
SignedXml xmlsig=new SignedXml();
xmlsig.AddObject(dObj);
xmlsig.AddReference(dRef);
RSA rsa=new RSASignatureCard(SigCard);
KeyInfo keyinfo=new KeyInfo();
keyinfo.AddClause(new RSAKeyValue(rsa));
xmlsig.KeyInfo=keyinfo;
xmlsig.SigningKey=rsa;
xmlsig.ComputeSignature();

(RSASignatureCard is a self-written class derived from RSA which uses a
smartcard)

This works fine, the signature can be calculated and is also verified
correctly.
But if I look at the data that has actually been signed
via		rsa.EncryptValue(xmlsig.Signature.SignatureValue);
the digest that can be found there is different from the one residing in

sigref=xmlsig.Signature.SignedInfo.References[0] as Reference;
sigref.DigestValue;
									Weird, isn't it?

cheers
Mathias



More information about the Mono-list mailing list