You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by "Atle Tokle (JIRA)" <ji...@apache.org> on 2015/01/21 08:59:35 UTC

[jira] [Comment Edited] (SANTUARIO-412) Signature verification fail because of unutilzed default namespace not removed

    [ https://issues.apache.org/jira/browse/SANTUARIO-412?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14284421#comment-14284421 ] 

Atle Tokle edited comment on SANTUARIO-412 at 1/21/15 7:59 AM:
---------------------------------------------------------------

[~sean.mullan@oracle.com] Where can I see the DocumentBuilderFactory in use. Did not find a reference to it down the stack in debugger. When I searched for implemtations of it, I only found com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl in java 7 rt.jar

But might be that you are right that choice of xml-implementation is problem. Namespaces with prefix was represented by com.sun.org.apache.xerces.internal.dom.AttrNSImpl, while the namespace without prefix was respresented by com.sun.org.apache.xerces.internal.dom.AttrImpl.

The last one use NodeImpl.getNamespaceURI() which always return null, and it ends up un the code documented with:
                    // Not a namespace definition.
                    // The Element is output element, add the prefix (if used) to 
                    // visiblyUtilized



was (Author: atokle):
[~sean.mullan@oracle.com] Where can I see the DocumentBuilderFactory in use. Did not find a reference to it down the stack in debugger. When I searched for implemtations of it, I only found com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl in java 7 rt.jar

But might be that you are right that choice of xml-implementation is problem. Namespaces with prefix was represented by com.sun.org.apache.xerces.internal.dom.AttrNSImpl, while the namespace without namespace was respresented by com.sun.org.apache.xerces.internal.dom.AttrImpl.

The last one use NodeImpl.getNamespaceURI() which always return null, and it ends up un the code documented with:
                    // Not a namespace definition.
                    // The Element is output element, add the prefix (if used) to 
                    // visiblyUtilized


> Signature verification fail because of unutilzed default namespace not removed
> ------------------------------------------------------------------------------
>
>                 Key: SANTUARIO-412
>                 URL: https://issues.apache.org/jira/browse/SANTUARIO-412
>             Project: Santuario
>          Issue Type: Bug
>      Security Level: Public(Public issues, viewable by everyone) 
>          Components: Java
>    Affects Versions: Java 2.0.1, Java 2.0.3
>         Environment: Webservice created with cxf 3.0.1, and running on java 7.
>            Reporter: Atle Tokle
>            Assignee: Colm O hEigeartaigh
>            Priority: Blocker
>
> In a soap-message where body is encrypted and signed, we get a signature verification fault because of differently calculated digest.
> The decrypted body is (anonyminized) like this: <urn:GetDataRequest xmlns="" xmlns:cont="http://www.company1.no/jade/xsd/v1.3/contexttypes" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:no:company2:area:domain:melding:DataMessage-1.0" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">123456789</urn:GetDataRequest>
> When it's canonicalized using Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" it is like this:
> <soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="Body-767cf61e-3cc1-45dc-b677-04720471d3b0">
>       <urn:GetDataRequest xmlns:urn="urn:no:company2:area:domain:melding:DataMessage-1.0" xmlns="">123456789</urn:GetDataRequest>
>    </soapenv:Body>
> This give a different signature from what we got from sender. If we remove the namespace deifinition xmlns="", and create a digest, it is equal  with what we get from sender.
> From my understanding of http://www.w3.org/TR/xml-exc-c14n/  it is the sender that is correct.
> I have tested a local patch where I did two changes on 2.0.3 source for org.apache.xml.security.c14n.implementations.Canonicalizer20010315Excl.java
> line 184:
>                 String NName = attribute.getLocalName();
> changed to
>                 String NName = attribute.getLocalName() == null ? "" : attribute.getLocalName();
> line 187:
>                 if (!XMLNS_URI.equals(attribute.getNamespaceURI())) {
> changed to:
>                 if (!XMLNS_URI.equals(attribute.getNamespaceURI()) &&
>                         !(XMLNS.equals(attribute.getName()) && "".equals(NName) &&  "".equals(NNodeValue))) {
> This fixed the problem for me, but don't know which regressions I might have introduced, or if really this new behaviour is the correct.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)