GNOME Bugzilla – Bug 319367
extra empty default namespace for exclusive C14N
Last modified: 2005-10-28 03:15:46 UTC
The exclusive C14N API provided by LibXML2 will generate extra default namespace (xmlns="") For example: <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss- wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss- wssecurity-utility-1.0.xsd"> <soap:Header> <Correlation xmlns="urn:liberty:sb:2004-12" messageID="msg:273627d5wd4" refToMessageID="ref:dfhdf73" timestamp="2005-09-23T14:09:15.7722111+08:00" id="cid:tjerthur"/> <Provider xmlns="urn:liberty:sb:2004-12" providerID="pid:ww8e9w" affiliationID="sff:2348ufe" id="dsjd37yerw"/> <wsa:Action>urn:liberty:id-wsf-tma:2005-06:Modify</wsa:Action> <wsa:MessageID>uuid:44f0def9-5589-482e-b74c-e74c4cb5a50e</wsa:MessageID> <wsa:ReplyTo> <wsa:Address>http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anony mous</wsa:Address> </wsa:ReplyTo> <wsa:To>http://172.16.221.14:1234/MID/TMAgent</wsa:To> <wsse:Security soap:mustUnderstand="1"> <wsu:Timestamp wsu:Id="Timestamp-9ccd6975-1526-4f9d-af11- 6289b8b42c1b"> <wsu:Created>2005-09-23T06:09:16Z</wsu:Created> <wsu:Expires>2005-09-23T06:14:16Z</wsu:Expires> </wsu:Timestamp> <wsse:BinarySecurityToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis- 200401-wss-wssecurity-utility-1.0.xsd" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis- 200401-wss-x509-token-profile-1.0#X509v3" EncodingType="http://docs.oasis- open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" wsu:Id="SecurityToken-dd8ff9d1-0a69-451b-8807- f33279623e92">MIIDRjCCAq+gAwIBAgIBBDANBgkqhkiG9w0BAQQFADBuMQswCQYDVQQGEwJDaDELMA kGA1UECBMCU2gxCzAJBgNVBAcTAlNoMQwwCgYDVQQKEwNmZXMxDTALBgNVBAsTBGljZnMxCzAJBgNVBA MTAmNhMRswGQYJKoZIhvcNAQkBFgxjYS5pbnRlbC5jb20wHhcNMDUwNDI1MDY1NzU2WhcNMTUwNDIzMD Y1NzU2WjBrMQswCQYDVQQGEwJDaDELMAkGA1UECBMCU2gxDDAKBgNVBAoTA2ZlczENMAsGA1UECxMEaW NmczEQMA4GA1UEAxMHY2xpZW50NDEgMB4GCSqGSIb3DQEJARYRY2xpZW50NC5pbnRlbC5jb20wgZ8wDQ YJKoZIhvcNAQEBBQADgY0AMIGJAoGBANrdvkCPUuaj3BAVF/8QvjR3Fh6DGrg4epE9Wr8T7AWliqEMsJ BaVcfIYKd3okLWgWcDxeOtcxWYKVVJlXofxcP8DktpZsBqUonnxcuI6YgnIQGkF8MLqxq2lQSOIWq0CF Qzyltkk/ZE1VaRVIMY3HP8VHcNpNF5xrT04qyCf8fZAgMBAAGjgfYwgfMwCQYDVR0TBAIwADAsBglghk gBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFKcH1w38RkdsVB GAo/wNu4rBPfaKMIGYBgNVHSMEgZAwgY2AFKStdC2kEgxum61YIaEu2zqO7awRoXKkcDBuMQswCQYDVQ QGEwJDaDELMAkGA1UECBMCU2gxCzAJBgNVBAcTAlNoMQwwCgYDVQQKEwNmZXMxDTALBgNVBAsTBGljZn MxCzAJBgNVBAMTAmNhMRswGQYJKoZIhvcNAQkBFgxjYS5pbnRlbC5jb22CAQAwDQYJKoZIhvcNAQEEBQ ADgYEAGQMYin9C/xKFtFcY83T99iehtLpz/AGRwioP4lFKcZGJCFIybI8ZqWeBqYcTIcD5B/BLOQeLsG cGUfnhs+O0N+ZU3WQ4sedc6TK4ynjsCDB93N6sC3duEFCo7meDDuQI+bTrQUWTdX/9FSpY3uLHr62p8A ezLPcPb94Y8S6Ax3A= </wsse:BinarySecurityToken> <Signature xmlns="http://www.w3.org/2000/09/xmldsig#"> <SignedInfo> <ds:CanonicalizationMethod xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/> <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/> <Reference URI="#ndid:1234-5678-0987"> <Transforms> <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/> </Transforms> <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/> <DigestValue>sj1VXDB2VMCU5qmva2OtDw3kKOs=</DigestValue> </Reference> </SignedInfo> <SignatureValue>2Ov9rDid1Qw9yKGsPQLMvSOS1QI3dpDu5hMZiVZqJJXpEuuvKTnn1Z1P 3MJHhv/n WJ/1JWZ5Qjjn1MwyUgek+GmbXHcGe/+LrMUvFadpPrblG3oOS6O1M8YqCzO65siL 37Yo/k3hIeS/2IOQfhmqt94i/GU1AF8td0BaAsC0nnA= </SignatureValue> <KeyInfo> <X509Data> <X509Certificate>...</X509Certificate> </X509Data></KeyInfo></Signature></wsse:Security></soap:Header><soap:Body></soap :Body></soap:Envelope> The result of C14N will be like: <SignedInfo xmlns="http://www.w3.org/2000/09/xmldsig#"> <ds:CanonicalizationMethod xmlns="" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></ds:CanonicalizationMethod> <SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa- sha1"></SignatureMethod> <Reference URI="#ndid:1234-5678-0987"> <Transforms> <Transform Algorithm="http://www.w3.org/2001/10/xml-exc- c14n#"></Transform> </Transforms> <DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod> <DigestValue>sj1VXDB2VMCU5qmva2OtDw3kKOs=</DigestValue> </Reference> </SignedInfo> It seems the 'xmlns="" ' should not be there according to exclusive C14N spec: <ds:CanonicalizationMethod xmlns="" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
What I mean is the result of exclusive C14N on the "SignedInfo" will be like that
Bugzilla is not a proper place to *ask questions*. It is a proper place to *report bugs*. Generating xmlns="" in c14n is apparently possible, as a quick google search immediately shows up: http://lists.w3.org/Archives/Public/w3c-ietf-xmldsig/2002AprJun/0225.html I will close this bug as NOTABUG. If you have doubts about this, ask on the mailing-list please first before reopening the bug. thanks, Daniel
The xmlns="" in <ds:CanonicalizationMethod> element is generated to "clear" the default namespace set in its parent <SignedInfo> element. Thus, this is correct c14n.
Okidoc, closed then, thanks ! Daniel
Reopening... in truth, there is a bug. I appologize for not noticing it first time. I am working on a patch (eta 30 minutes).
Fixed (test case added): Checking in c14n.c; /cvs/gnome/gnome-xml/c14n.c,v <-- c14n.c new revision: 1.27; previous revision: 1.26 done Checking in ChangeLog; /cvs/gnome/gnome-xml/ChangeLog,v <-- ChangeLog new revision: 1.2664; previous revision: 1.2663 done RCS file: /cvs/gnome/gnome-xml/result/c14n/exc-without-comments/test-2,v done Checking in result/c14n/exc-without-comments/test-2; /cvs/gnome/gnome-xml/result/c14n/exc-without-comments/test-2,v <-- test-2 initial revision: 1.1 done RCS file: /cvs/gnome/gnome-xml/test/c14n/exc-without-comments/test-2.xml,v done Checking in test/c14n/exc-without-comments/test-2.xml; /cvs/gnome/gnome-xml/test/c14n/exc-without-comments/test-2.xml,v <-- test-2.xml initial revision: 1.1 done RCS file: /cvs/gnome/gnome-xml/test/c14n/exc-without-comments/test-2.xpath,v done Checking in test/c14n/exc-without-comments/test-2.xpath; /cvs/gnome/gnome-xml/test/c14n/exc-without-comments/test-2.xpath,v <-- test-2.xpath initial revision: 1.1 done