<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Message</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2800.1476" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=100094821-22102004><FONT face=Arial color=#0000ff size=2>Hello,
I wanted to follow up on this and post my solution. In the end, it turned out to
be pretty easy. The stumbling block I ran into was that by default, libxml adds
3 I/O handlers, the 3rd being a file handler, which is the default match due
to:</FONT></SPAN></DIV>
<DIV><SPAN class=100094821-22102004><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=100094821-22102004><FONT face=Arial color=#0000ff
size=2>int<BR>xmlFileMatch (const char *filename ATTRIBUTE_UNUSED)
{<BR> return(1);<BR>}</FONT></SPAN></DIV>
<DIV><SPAN class=100094821-22102004><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=100094821-22102004><FONT face=Arial color=#0000ff size=2>adding
my custom handler never got hit, because it is added to the callback list AFTER
the defaults, so it never gets hit...</FONT></SPAN></DIV>
<DIV><SPAN class=100094821-22102004><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=100094821-22102004><FONT face=Arial color=#0000ff
size=2>solution was to remove them all and then add them back in the order I
wanted. So the following snippet of code adds in my CID
handler:</FONT></SPAN></DIV>
<DIV><SPAN class=100094821-22102004><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=100094821-22102004><FONT face="Courier New" color=#0000ff
size=2> xmlSecIOCleanupCallbacks();<BR>#ifdef
LIBXML_HTTP_ENABLED<BR> res = xmlSecIORegisterCallbacks(xmlIOHTTPMatch,
xmlIOHTTPOpen,<BR>
xmlIOHTTPRead, xmlIOHTTPClose);<BR>#endif<BR>#ifdef
LIBXML_FTP_ENABLED<BR> res = xmlSecIORegisterCallbacks(xmlIOFTPMatch,
xmlIOFTPOpen,<BR>
xmlIOFTPRead, xmlIOFTPClose);<BR>#endif<BR> res =
xmlSecIORegisterCallbacks(xmlIOCIDMatch,
xmlIOCIDOpen,<BR>
xmlIOCIDRead, xmlIOCIDClose);<BR> res =
xmlSecIORegisterCallbacks(xmlFileMatch,
xmlFileOpen,<BR>
xmlFileRead, xmlFileClose);</FONT></SPAN></DIV>
<DIV><SPAN class=100094821-22102004><FONT face="Courier New" color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=100094821-22102004><FONT face=Arial color=#0000ff size=2>Notice
my CID handler now gets into the callback pointer list prior to the file
handler.</FONT></SPAN></DIV>
<DIV><SPAN class=100094821-22102004><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=100094821-22102004><FONT face=Arial color=#0000ff size=2>The
other way to go would be to simply replace the xmlFileXXXX handler with a custom
one that knows how to resolved cid: to the correct resource.</FONT></SPAN></DIV>
<DIV><SPAN class=100094821-22102004><FONT face=Arial color=#0000ff
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=100094821-22102004><FONT face=Arial color=#0000ff
size=2>~R</FONT></SPAN></DIV>
<DIV><SPAN class=100094821-22102004><FONT face="Courier New" color=#0000ff
size=2></FONT></SPAN> </DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left><FONT
face=Tahoma size=2>-----Original Message-----<BR><B>From:</B> Robert Fox
<BR><B>Sent:</B> Friday, October 22, 2004 9:22 AM<BR><B>To:</B>
'xmlsec@aleksey.com'<BR><B>Subject:</B> Handling CID: moniker to sign
attachments<BR><BR></FONT></DIV>
<DIV><SPAN class=157211516-22102004><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=157211516-22102004><FONT face=Arial size=2>I am new to libxml
and xmlsec, and having a hard time figuring out how to wedge in a protocol
handler to take care of resolving cid references. I looked at the links below,
and just am not sure how this would work for selectively handling cid, but
letting everything else (http, ftp, etc) pass through... I have looked through
the documentation, and traced the source... </FONT></SPAN></DIV>
<DIV><SPAN class=157211516-22102004><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=157211516-22102004><FONT face=Arial size=2>my real question
is this: By now, I assume that many of you have had to implement handling the
signing of attachments, I am just looking for a good starting point of
how you implemented this. I assume I have to somehow tap into the
xmlSecTransformCtxUriExecute function and do my own file reading... but can't
seem to figure out how..</FONT></SPAN></DIV>
<DIV><SPAN class=157211516-22102004><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=157211516-22102004><FONT face=Arial size=2>any
tips/suggestions would be greatly appreciated.</FONT></SPAN></DIV>
<DIV><SPAN class=157211516-22102004><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=157211516-22102004><SPAN class=157211516-22102004><FONT
face=Arial size=2>I saw a thread in the mail list regarding this, the original
answer is posted at the bottom of this email, I have read the links, and still
am unsure how to proceed on this.</FONT></SPAN></SPAN></DIV>
<DIV><SPAN class=157211516-22102004><SPAN class=157211516-22102004><FONT
face=Arial size=2></FONT></SPAN></SPAN> </DIV>
<DIV><SPAN class=157211516-22102004><SPAN class=157211516-22102004><FONT
face=Arial size=2>~Rob</FONT></SPAN></SPAN></DIV>
<DIV><SPAN class=157211516-22102004><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=157211516-22102004>>> Well, probably the best option
for you would be option #2: use special URL protocol<BR>>> in URI
attributes like "cid:<attachment id>" and create custom protocol
handlers<BR>>> for "cid". Take a look at LibXML2 IO
tutorial:<BR>>><BR>>> <A
class=moz-txt-link-freetext
href="http://xmlsoft.org/xmlio.html">http://xmlsoft.org/xmlio.html</A><BR>>><BR>>>and
xmlsec API reference:<BR>>><BR>>> <A
class=moz-txt-link-freetext
href="http://www.aleksey.com/xmlsec/api/xmlsec-io.html">http://www.aleksey.com/xmlsec/api/xmlsec-io.html</A><BR>>><BR>>>And
do not forget to register your protocol handlers in both xmlsec and
libxml2.<BR>>><BR>>>Aleksey</SPAN></DIV></BLOCKQUOTE></BODY></HTML>