[xmlsec] XPointer reference problem

Asbjørn Oskal asbjorn.oskal@welldiagnostics.com
Fri, 29 Nov 2002 10:22:39 +0100


This is a multi-part message in MIME format.

------=_NextPart_000_000B_01C29791.3E8A2C50
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi!

I'm having some trouble signing using an xpointer reference.

The XML document I'm trying to sign looks like this:

<?xml version=3D"1.0" encoding=3D"UTF-8"?>
<Letter>
    Hello, World!   =20
    <Info Id=3D"SomeData">
    <!-- Commentary -->
    <Data1> Some data </Data1>
    <Data2> More data </Data2>
    </Info>
</Letter>

I do like this in my code. (from signing example 3):

referenceNode =3D xmlSecSignedInfoAddReference(signedInfoNode,
     (const unsigned char *) "my-reference",
     (const unsigned char *) "#xpointer(id('SomeData'))",
                    NULL);


I debugged the signing process and it ends up in =
xmlSecTransformStateParseUri (transforms.c) where

xmlXPtrEval(BAD_CAST (xptr + 1), ctxt);

fails.

The xptr contains #xpointer(id('SomeData')).


Does this mean that the xmlXPtrEval cannot find the element <Info =
Id=3D"SomeData"> ?

Has anyone got a clue to what I am doing wrong here?

:)
------=_NextPart_000_000B_01C29791.3E8A2C50
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1106" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DCourier size=3D2>Hi!</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DCourier size=3D2>I'm having some trouble signing using =
an xpointer=20
reference.</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DCourier size=3D2>The XML document I'm trying to =
sign&nbsp;looks=20
like&nbsp;this:</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DCourier size=3D2>&lt;?xml version=3D"1.0"=20
encoding=3D"UTF-8"?&gt;<BR>&lt;Letter&gt;<BR>&nbsp;&nbsp;&nbsp; Hello,=20
World!&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; &lt;Info=20
Id=3D"SomeData"&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;!-- Commentary=20
--&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;Data1&gt; Some data=20
&lt;/Data1&gt;<BR>&nbsp;&nbsp;&nbsp; &lt;Data2&gt; More data=20
&lt;/Data2&gt;<BR>&nbsp;&nbsp;&nbsp;=20
&lt;/Info&gt;<BR>&lt;/Letter&gt;</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DCourier size=3D2>I do like this in my code. (from =
signing example=20
3):</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DCourier size=3D2>referenceNode =3D=20
xmlSecSignedInfoAddReference(signedInfoNode,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;(const=20
unsigned char *) "my-reference",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(const =

unsigned char *)=20
"#xpointer(id('SomeData'))",<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
=20
NULL);</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DCourier size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DCourier size=3D2>I&nbsp;debugged the&nbsp;signing =
process and it=20
ends up in xmlSecTransformStateParseUri (transforms.c) =
where</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DCourier size=3D2>xmlXPtrEval(BAD_CAST (xptr + 1),=20
ctxt);</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DCourier size=3D2>fails.</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DCourier size=3D2>The xptr contains=20
#xpointer(id('SomeData')).</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DCourier size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DCourier size=3D2>Does this mean that the xmlXPtrEval =
cannot find=20
the element &lt;Info Id=3D"SomeData"&gt; ?</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DCourier size=3D2>Has anyone got a clue to what I am =
doing wrong=20
here?</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DCourier size=3D2>:)</FONT></DIV></BODY></HTML>

------=_NextPart_000_000B_01C29791.3E8A2C50--