[xmlsec] Signing template

Marion Morgenstern marion.morgenstern at gmx.net
Thu Jan 25 07:31:04 PST 2007


Hello Aleksey,

I'm trying to sign a xml file with the sign1.c example. I have changed the example to fit my demands: I only want to sign one node. The signature should be within the same document and added to the signed node as a sub node. But if I try to sign it with sign1 I get this error messages:

##Part of the error message##############
func=xmlSecXPathDataExecute:file=..\src\xpath.c:line=273:obj=unknown:subj=xmlXPtrEval:error=5:libxml2 library functionfailed:expr=xpointer(id('ProductDescription'))
...
#########################################

It seems that ID ProductDescription is not found. Why? Is this the way signing documents work witj XMLSec?


Regards

Marion Morgenstern



##The XML file###########################
<?xml version="1.0" encoding="UTF-8"?>
<MyDocument>
<Comment>This data should not be signed.</Comment>

<!-- Sign this node. To make the file more readable put the signature beneath this node -->
<ProductDescription id="ProductDescription">
<ProductName>Blue bug</ProductName>
<Price>100</Price>

<!-- Signature -->
<SignatureOfProductDescription>
<Envelope xmlns="urn:envelope">
  <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
    <SignedInfo>
      <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315" />
      <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1" />
      <Reference URI="#ProductDescription">
        <Transforms>
          <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
        </Transforms>
        <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
        <DigestValue></DigestValue>
      </Reference>
    </SignedInfo>
    <SignatureValue/>
    <KeyInfo>
    <KeyName/>
    </KeyInfo>
  </Signature>
</Envelope>
</SignatureOfProductDescription>
<!-- End -->

<Comment>This data should not be signed too.</Comment>
</ProductDescription>
</MyDocument>
##The XML file end#######################
-- 
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail



More information about the xmlsec mailing list