[xmlsec] example 1 always give the same digest value

Aleksey Sanin aleksey at aleksey.com
Tue Sep 24 22:23:19 PDT 2002

You can check xmlsec mailing list for detailed explanation but briefly 
Id attribute
means *nothing* w/o a DTD or schema. In your case, XMLSec always digests an
empty value simply because URI="#msg.194549.signedook" could not be found.
I believe that adding something like
    <!DOCTYPE test [
        <!ATTLIST Data Id ID #IMPLIED>
should solve your problem (see xmlsec/docs/examples/dsig3/tests.tmpl 
file for details).
Of course, the DTD may be external or you may add Id attribute manualy by
calling LibXML2 xmlAddID() function after loading the document.


Derek Lei Liu wrote:

>I am trying to use example1 on Solaris. The test xml
>and the private key are attached in following.  I
>tried to use local reference here, but found the
>digested value never changed even I changed the
>content in <Data>.  I am relatively new to this area
>and the project I am working on is rather urgent on
>this part.  I gdb into the test program and found that
>the first time SHA1_Update was called as for
><SignInfo> (signature stuff).  This function is
>supposed to be called for the digested value, right?
><?xml version="1.0" encoding="UTF-8"?>
><SecondTop id="1">
><Data Id="msg.194549.signedook">
><CourseID>English Literature</CourseID>
><date>20020901 17:20:37</date>
><time>20020902 00:13:24</time>
><Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
>15" />
><Reference URI="#msg.194549.signedook">
>Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
>Do you Yahoo!?
>New DSL Internet Access from SBC & Yahoo!
>xmlsec mailing list
>xmlsec at aleksey.com

More information about the xmlsec mailing list