You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@santuario.apache.org by "Jozef Aerts - Comp.Chem.Cons. - XML4Pharma" <co...@hotmail.com> on 2003/02/15 11:26:06 UTC

retrieving the digest value from an enveloped signature

Hi all,

I now learned how to create an XML-Signature of an XML document (enveloped) 
and how to validate the signature of such a signed document.

What I also want to do is to retrive the digest value from the signature, 
and to compare it with a recalculated value of the document.
So, the first question is: how do I retrieve the digest value from an XML 
signature ? I did not get further than:

sigElement = (Element) XPathAPI.selectSingleNode(signeddoc, 
"//ds:Signature[1]", nscontext);
XMLSignature signature = new XMLSignature(sigElement, "");
SignedInfo si = signature.getSignedInfo();

How do I dig deeper and get the digestvalue ?

My second question is:
Given a signed (enveloped) XML document, how do I (re)calculate the digest 
value ? Do I have to remove the signature first ? Or is there a direct 
method ?

Many thanks in advance.

Jozef Aerts
Computer Chemistry Consultancy
CompChemCons@hotmail.com








_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*. 
http://join.msn.com/?page=features/featuredemail


Re: retrieving the digest value from an enveloped signature

Posted by Christian Geuer-Pollmann <ge...@nue.et-inf.uni-siegen.de>.
Hi Jozef,

I must admin that I don't understand why you want to do this by hand? When 
you call XMLSignature.checkSignatureValue, all References are validated by 
the package.


Christian

--On Samstag, 15. Februar 2003 10:26 +0000 "Jozef Aerts - Comp.Chem.Cons. - 
XML4Pharma" <co...@hotmail.com> wrote:

>
> Hi all,
>
> I now learned how to create an XML-Signature of an XML document
> (enveloped) and how to validate the signature of such a signed document.
>
> What I also want to do is to retrive the digest value from the signature,
> and to compare it with a recalculated value of the document. So, the
> first question is: how do I retrieve the digest value from an XML
> signature ? I did not get further than:
>
> sigElement = (Element) XPathAPI.selectSingleNode(signeddoc,
> "//ds:Signature[1]", nscontext); XMLSignature signature = new
> XMLSignature(sigElement, "");
> SignedInfo si = signature.getSignedInfo();
>
> How do I dig deeper and get the digestvalue ?
>
> My second question is:
> Given a signed (enveloped) XML document, how do I (re)calculate the
> digest value ? Do I have to remove the signature first ? Or is there a
> direct method ?
>
> Many thanks in advance.
>
> Jozef Aerts
> Computer Chemistry Consultancy
> CompChemCons@hotmail.com