[XML-SIG] c14n attribute ordering problem?

Aleksey Sanin aleksey at aleksey.com
Tue Sep 30 23:50:14 EDT 2003


Skipped content of type multipart/alternative-------------- next part --------------
Index: c14n.c
===================================================================
RCS file: /cvs/gnome/gnome-xml/c14n.c,v
retrieving revision 1.18
diff -u -r1.18 c14n.c
--- c14n.c	29 Sep 2003 13:20:20 -0000	1.18
+++ c14n.c	1 Oct 2003 03:47:07 -0000
@@ -412,7 +412,13 @@
     if (ns2 == NULL)
         return (1);
 
-    return (xmlStrcmp(ns1->prefix, ns2->prefix));
+    /* C14N spec assignes local name "xmlns" to the default namespace 
+     * node xmlns="..." ("Namespace Nodes" bullet in section "2.3 Processing 
+     * Model" of C14N spec). This is different from XPath where the default 
+     * namespace node has an empty URI and local name 
+     */
+    return (xmlStrcmp((ns1->prefix != NULL) ? ns1->prefix : BAD_CAST "xmlns", 
+		      (ns2->prefix != NULL) ? ns2->prefix : BAD_CAST "xmlns"));
 }
 
 
Index: result/c14n/with-comments/default-ns-sorting
===================================================================
RCS file: result/c14n/with-comments/default-ns-sorting
diff -N result/c14n/with-comments/default-ns-sorting
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ result/c14n/with-comments/default-ns-sorting	1 Oct 2003 03:47:24 -0000
@@ -0,0 +1 @@
+<dsig:SignedInfo xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns="urn:envelope"></dsig:SignedInfo>
\ No newline at end of file
Index: test/c14n/with-comments/default-ns-sorting.xml
===================================================================
RCS file: test/c14n/with-comments/default-ns-sorting.xml
diff -N test/c14n/with-comments/default-ns-sorting.xml
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ test/c14n/with-comments/default-ns-sorting.xml	1 Oct 2003 03:47:24 -0000
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Envelope xmlns="urn:envelope">  
+    <dsig:Signature xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">    
+	<dsig:SignedInfo/>  
+    </dsig:Signature>
+</Envelope>
Index: test/c14n/with-comments/default-ns-sorting.xpath
===================================================================
RCS file: test/c14n/with-comments/default-ns-sorting.xpath
diff -N test/c14n/with-comments/default-ns-sorting.xpath
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ test/c14n/with-comments/default-ns-sorting.xpath	1 Oct 2003 03:47:24 -0000
@@ -0,0 +1,6 @@
+<XPath xmlns:dsig="http://www.w3.org/2000/09/xmldsig#">
+    (//. | //@* | //namespace::*) 
+    [ 
+              ancestor-or-self::dsig:SignedInfo
+    ]
+</XPath>
\ No newline at end of file


More information about the XML-SIG mailing list