XML-signature with XPath

Discussion in 'XML' started by K.Strunk, Nov 6, 2003.

  1. K.Strunk

    K.Strunk Guest

    Hi!

    I have a problem signing a XML-document. I need to sign a subnode of a
    document. So I need to refer to this subnode from within my signature. But
    how can I do that with XPath?

    I tried the following, but I couldn't verify it using an online-verifier
    (http://www.aleksey.com/xmlsec/xmldsig-verifier.html).
    Could anybody please help me with that reference? Thanx a lot!


    And here's my document:

    <?xml version="1.0" encoding="UTF-8"?>

    <Request xmlns="http://...">
    <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
    <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
    xmlns:msg="http://...">/Request[1]/msg:Message[1]</ds:XPath>
    </ds:Transform>
    </ds:Transforms>
    <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"
    />
    <ds:DigestValue>uT3v+Iq3LQUxokKorQq4xrNL5HI=</ds:DigestValue>
    </ds:Reference>
    </ds:SignedInfo>
    <ds:SignatureValue>...</ds:SignatureValue>
    <ds:KeyInfo>
    <ds:KeyValue>
    <ds:RSAKeyValue>
    <ds:Modulus>...</ds:Modulus>
    <ds:Exponent>AQAB</ds:Exponent>
    </ds:RSAKeyValue>
    </ds:KeyValue>
    </ds:KeyInfo>
    </ds:Signature>

    <Message xmlns:msg="...">
    Hello
    </Message>

    </Request>
     
    K.Strunk, Nov 6, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JJBW
    Replies:
    1
    Views:
    10,333
    Joerg Jooss
    Apr 24, 2004
  2. Marvin_123456

    "Memory leak" in javax.xml.xpath.XPath

    Marvin_123456, Jul 29, 2005, in forum: Java
    Replies:
    4
    Views:
    1,993
    jan V
    Jul 29, 2005
  3. Alastair Cameron
    Replies:
    1
    Views:
    7,444
    SQL Server Development Team [MSFT]
    Jul 8, 2003
  4. Geir S Eidissen
    Replies:
    0
    Views:
    1,225
    Geir S Eidissen
    Dec 27, 2004
  5. Gustavo Narea
    Replies:
    14
    Views:
    876
    Gustavo Narea
    Feb 16, 2009
Loading...

Share This Page