Re: [xml] XML-Signature


I attached the C14N API I have now. Please let me know if you think I should
change something. Of course, you are abslutelly right about xmlOutputBuffer,
it is the base API. I added two simple envelopes for dumping canonical XML
to memory and save it into a file. I have 7 test cases from W3C documentation and
I wrote a simple script to do automated testing (I had no chance to look at the
libxml test suite yet).
This C14N implementation is only first step and really I want to implement
XML Digital Signature.  Probably it's a good idea to create something like
libxmlsec but I am not sure I have enough time for this. I've not looked at this closely
yet but I guess there are a lot of work to do.



Daniel Veillard wrote:
On Tue, Feb 26, 2002 at 08:10:49AM -0800, Aleksey Sanin wrote:

Thanks for info. I looked at both packages and it does not seem that
Canonical XML based on libxml should take a lot of time. Almost
everything could be done via "copy/paste" from libxml tree.c file.
And it does not look like I will need gdome for this (probably I am
wrong). I am going to implement this in next few days.
Daniel, will you be interested in including XML canonization into
libxml library?

Definitely. that would be useful for checking the output of the test
suite and of course the base of XML DSig if someone want to contribute that
back too.
If the resulting API is really simple then adding it now will be easy,
otherwise it may have to wait a bit after the Gnome-2 freeze is over.
Note that the best it to use an xmlOutputBuffer based API and then
this can be saved/streamed to any kind of I/O, including user defined one.


 * Author: aleksey aleksey com
#ifndef __XML_C14N_H__
#define __XML_C14N_H__    

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */ 

#include <libxml/tree.h>
#include <libxml/xpath.h> 

typedef struct _xmlC14NCtx *xmlC14NCtxPtr;

 * xmlC14NCtxPtr functions
xmlC14NCtxPtr   xmlC14NNewCtx           (xmlDocPtr doc, 
                                         int with_comments,
                                         xmlNodeSetPtr nodes);
xmlC14NCtxPtr   xmlC14NNewCtxFromFile   (const char* filename,              
                                         int with_comments,
                                         const xmlChar *xpathExp);
xmlC14NCtxPtr   xmlC14NNewCtxWithXPath  (xmlDocPtr doc,
                                         int with_comments,
                                         const xmlChar *xpathExp,
                                         xmlXPathContextPtr xpathCtx);                                   
int             xmlC14NDumpMemory       (xmlC14NCtxPtr ctx,
                                         xmlChar **doc_txt_ptr);
int             xmlC14NSaveFile         (xmlC14NCtxPtr ctx,
                                         const char *filename,
                                         int compression);
int             xmlC14NSaveBuffer       (xmlC14NCtxPtr ctx,
                                        xmlOutputBufferPtr buf);
void            xmlC14NFreeCtx          (xmlC14NCtxPtr ctx);
#ifdef __cplusplus
#endif /* __cplusplus */

#endif /* __XML_C14N_H__ */

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]