[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> </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> </DIV>
<DIV><FONT face=3DCourier size=3D2>The XML document I'm trying to =
sign looks=20
like this:</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT> </DIV>
<DIV><FONT face=3DCourier size=3D2><?xml version=3D"1.0"=20
encoding=3D"UTF-8"?><BR><Letter><BR> Hello,=20
World! <BR> <Info=20
Id=3D"SomeData"><BR> <!-- Commentary=20
--><BR> <Data1> Some data=20
</Data1><BR> <Data2> More data=20
</Data2><BR> =20
</Info><BR></Letter></FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT> </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> </DIV>
<DIV><FONT face=3DCourier size=3D2>referenceNode =3D=20
xmlSecSignedInfoAddReference(signedInfoNode,<BR> &=
nbsp;(const=20
unsigned char *) "my-reference",<BR> (const =
unsigned char *)=20
"#xpointer(id('SomeData'))",<BR>  =
; =
=20
NULL);</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT> </DIV>
<DIV><FONT face=3DCourier size=3D2></FONT> </DIV>
<DIV><FONT face=3DCourier size=3D2>I debugged the signing =
process and it=20
ends up in xmlSecTransformStateParseUri (transforms.c) =
where</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT> </DIV>
<DIV><FONT face=3DCourier size=3D2>xmlXPtrEval(BAD_CAST (xptr + 1),=20
ctxt);</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT> </DIV>
<DIV><FONT face=3DCourier size=3D2>fails.</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT> </DIV>
<DIV><FONT face=3DCourier size=3D2>The xptr contains=20
#xpointer(id('SomeData')).</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT> </DIV>
<DIV><FONT face=3DCourier size=3D2></FONT> </DIV>
<DIV><FONT face=3DCourier size=3D2>Does this mean that the xmlXPtrEval =
cannot find=20
the element <Info Id=3D"SomeData"> ?</FONT></DIV>
<DIV><FONT face=3DCourier size=3D2></FONT> </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> </DIV>
<DIV><FONT face=3DCourier size=3D2>:)</FONT></DIV></BODY></HTML>
------=_NextPart_000_000B_01C29791.3E8A2C50--