[xmlsec] selecting strart node from command line

Aleksey Sanin aleksey@aleksey.com
Wed, 24 Sep 2003 14:01:45 -0700


This is a multi-part message in MIME format.
--------------090606030304000502030609
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

No. It is not. You need to do something like this:
<Root xmlns:dsig="http://.....">
       <dsig:Signature>
         . ..
       </dsig:Signature>
</Root>
And after that you can use "dsig:Siganture" in XPath expression.
Please read the XPath spec and play with XPath expressions
using xmllint tool included in LibXML2 package. Or hire someone
who can help you with this.

Aleksey

Jan-Olof Andersson wrote:

>I think I start to understand what you mean ;-))
>
>The dsig shall be declared and the Signature reference like <Signature
>xmlns="&dsig;" >
>
>Is that correct?
>
>-----Original Message-----
>From: xmlsec-admin@aleksey.com [mailto:xmlsec-admin@aleksey.com]On
>Behalf Of Aleksey Sanin
>Sent: den 24 september 2003 15:01
>To: jan-olof.andersson@blcc.biz; xmlsec@aleksey.com
>Subject: [xmlsec] selecting strart node from command line
>
>
>Your XPath expression have to select a single start node. The error
>tells you that
>the xpath expressiong you have used selected multiple or no nodes at
>all. In your case
>I would *guess* that you got no nodes because you did not specify namespaces
>(and /dsig:Signature and /Signature xpath expression select different
>nodes). Also
>please note that for signatures, start node is expected to be
><dsig:Signature/> node.
>
>BTW, there is a good XPath tutorial with a lot of examples:
>        http://www.zvon.org
>You might want to look at it if you need to quickly find an Xpath expression
>for your needs.
>
>Aleksey
>
>
>Jan-Olof Andersson wrote:
>
>  
>
>>Let me explain a little bit more...
>>
>>I want to make the signing to start later in the document with the signing.
>>So I try to use xpath. But it always complains that I give the command in a
>>wrong way...
>>
>>How should I write?
>>
>>Best regards
>>
>>
>>    
>>
>
>D:\Archivos de programa\GnuWin32\xmlsec\libxmlsec-1.1.1.win32\lib>xmlsec
>sign
>--pkcs12 certificado.pfx --output signed_xml.xml --pwd xxxxx --node-xpath
>/EnvioDTE/Signature/SignedInfo resum_caf_invoice_10.xml
>Error: xpath expression evaluation does not return a single node as expected
>Error: failed to load template "resum_caf_invoice_10.xml"
>Error: failed to sign file "resum_caf_invoice_10.xml"
>
>
>_______________________________________________
>xmlsec mailing list
>xmlsec@aleksey.com
>http://www.aleksey.com/mailman/listinfo/xmlsec
>
>  
>

--------------090606030304000502030609
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
  <title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
No. It is not. You need to do something like this:<br>
&lt;Root xmlns:dsig=<a class="moz-txt-link-rfc2396E" href="http://.....">"http://....."</a>&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &lt;dsig:Signature&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; . ..<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; &lt;/dsig:Signature&gt;<br>
&lt;/Root&gt;<br>
And after that you can use "dsig:Siganture" in XPath expression.<br>
Please read the XPath spec and play with XPath expressions<br>
using xmllint tool included in LibXML2 package. Or hire someone<br>
who can help you with this.<br>
<br>
Aleksey<br>
<br>
Jan-Olof Andersson wrote:<br>
<blockquote type="cite"
 cite="midNPENKJNAFAOGCAEDEPEAMECPDCAA.jan-olof.andersson@blcc.biz">
  <pre wrap="">I think I start to understand what you mean ;-))

The dsig shall be declared and the Signature reference like &lt;Signature
xmlns="&amp;dsig;" &gt;

Is that correct?

-----Original Message-----
From: <a class="moz-txt-link-abbreviated" href="mailto:xmlsec-admin@aleksey.com">xmlsec-admin@aleksey.com</a> [<a class="moz-txt-link-freetext" href="mailto:xmlsec-admin@aleksey.com">mailto:xmlsec-admin@aleksey.com</a>]On
Behalf Of Aleksey Sanin
Sent: den 24 september 2003 15:01
To: <a class="moz-txt-link-abbreviated" href="mailto:jan-olof.andersson@blcc.biz">jan-olof.andersson@blcc.biz</a>; <a class="moz-txt-link-abbreviated" href="mailto:xmlsec@aleksey.com">xmlsec@aleksey.com</a>
Subject: [xmlsec] selecting strart node from command line


Your XPath expression have to select a single start node. The error
tells you that
the xpath expressiong you have used selected multiple or no nodes at
all. In your case
I would *guess* that you got no nodes because you did not specify namespaces
(and /dsig:Signature and /Signature xpath expression select different
nodes). Also
please note that for signatures, start node is expected to be
&lt;dsig:Signature/&gt; node.

BTW, there is a good XPath tutorial with a lot of examples:
        <a class="moz-txt-link-freetext" href="http://www.zvon.org">http://www.zvon.org</a>
You might want to look at it if you need to quickly find an Xpath expression
for your needs.

Aleksey


Jan-Olof Andersson wrote:

  </pre>
  <blockquote type="cite">
    <pre wrap="">Let me explain a little bit more...

I want to make the signing to start later in the document with the signing.
So I try to use xpath. But it always complains that I give the command in a
wrong way...

How should I write?

Best regards


    </pre>
  </blockquote>
  <pre wrap=""><!---->
D:\Archivos de programa\GnuWin32\xmlsec\libxmlsec-1.1.1.win32\lib&gt;xmlsec
sign
--pkcs12 certificado.pfx --output signed_xml.xml --pwd xxxxx --node-xpath
/EnvioDTE/Signature/SignedInfo resum_caf_invoice_10.xml
Error: xpath expression evaluation does not return a single node as expected
Error: failed to load template "resum_caf_invoice_10.xml"
Error: failed to sign file "resum_caf_invoice_10.xml"


_______________________________________________
xmlsec mailing list
<a class="moz-txt-link-abbreviated" href="mailto:xmlsec@aleksey.com">xmlsec@aleksey.com</a>
<a class="moz-txt-link-freetext" href="http://www.aleksey.com/mailman/listinfo/xmlsec">http://www.aleksey.com/mailman/listinfo/xmlsec</a>

  </pre>
</blockquote>
</body>
</html>

--------------090606030304000502030609--