You are viewing a plain text version of this content. The canonical link for it is here.
Posted to security-users@xml.apache.org by Matej Kafadar <ma...@setcce.org> on 2004/03/29 14:02:11 UTC

XPath Filter

Hi,

How to set XPath string to sign only node(and sub nodes) of /a/b/c in
document

<a>
 <b>
  <c>123</c> <!-- this node i would like to sign -->
 </b>
 <c>caca</c>
 <d>qwer</d>
 <f>
  <a>
   <b>
    <c>fffff</c>
   </b>
  </a>
 </f>
 <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="issuer">
  <ds:SignedInfo>
   <ds:CanonicalizationMethod
Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
   <ds:SignatureMethod
Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
   <ds:Reference URI="">
    <ds:Transforms>
     <ds:Transform Algorithm="http://www.w3.org/TR/1999/REC-xpath-19991116">
      <ds:XPath>????????</ds:XPath>
     </ds:Transform>
    </ds:Transforms>
    <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
    <ds:DigestValue>...</ds:DigestValue>
   </ds:Reference>
  </ds:SignedInfo>
  <ds:SignatureValue> ...</ds:SignatureValue>
 </ds:Signature>
</a>


If i use "<ds:XPath>/a/b/c</ds:XPath>", I sign whole document. How to sign
only /a/b/c node?

Thanks

    M.