You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by cxf newbie <ca...@gmail.com> on 2014/03/04 19:12:56 UTC

Re: Unable to verify signature with Apache CXF and WSS4J on Websphere Application Server 8.5

Hi,

I also have similar problem:

http://cxf.547215.n5.nabble.com/WebSphere-8-wss4j-and-cxf-signature-validation-td5739363.html

Did you make any progress ?

I tried some options:

1. Verifying certificate chain.
2. Adding Bouncy Castle as provider to WSSConfig instead of IBMJCE.
3. Avoiding xmlsec at all (unsuccsessfully).
4. Logging and wiresharking request and response.

But no use.

I tried to sign Body and Timestamp tag.
Also noticed that Body attribute "wsu:Id" is placed before "xmlns:wsu"
attribute when response message leaves web service. When the same response
comes to client side their order is swapped.
I am signing body and timestamp.

As you already noticed "PARENT_LAST" and osgi may be problem:
http://veithen.blogspot.com/2013/10/broken-by-design-websphere-stax.html  

Also look at this:
http://blog.lodeblomme.be/2011/09/27/apache-cxf-ws-security-the-signature-or-decryption-was-invalid
They say it may be problem with Linux or even Java 6.

I can not debugg "verify" method because I haven't source for IBMJCE and
debugger behaves very strangely evevn when Bouncy Castle is used.

Cheers



--
View this message in context: http://cxf.547215.n5.nabble.com/Unable-to-verify-signature-with-Apache-CXF-and-WSS4J-on-Websphere-Application-Server-8-5-tp5740358p5740804.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Unable to verify signature with Apache CXF and WSS4J on Websphere Application Server 8.5

Posted by ashish <as...@gmail.com>.
cxf newbie <ca...@...> writes:> 
> 
> Sorry, you were right:
> 
> I put this in client class:
> Map<String, Object> ctx = ((BindingProvider)port).getRequestContext();
> ctx.put(WSHandlerConstants.IS_BSP_COMPLIANT, "false");
> 
> Now it works, but without timestamp reference.
> Interesting, <Body> is correctly signed and validated.
> 
> If I put <sp:IncludeTimestamp> in policy file:
> <wsu:Timestamp wsu:Id="TS-5A28482C0A57755103139419734630013">
>             <wsu:Created>2014-03-07T13:02:26.300Z</wsu:Created>
>             <wsu:Expires>2014-03-07T13:07:26.300Z</wsu:Expires>
> </wsu:Timestamp>
> 
> then I get:
> Digest value: OMNbo25276XKjodI3T60RuR1nh8=
> Calculated digest value: olWImZ1Re/74QV8+56VdoWpwjcs=
> 
> DOMReferencer class:
> validationStatus = Arrays.equals(digestValue, calcDigestValue); 
> This one returns false.
> 
> Thanks.
> 
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Unable-to-
verify-signature-with-Apache-CXF-and-WSS4J-on-Websphere-Application-Server-
8-5-tp5740358p5740957.html
> Sent from the cxf-user mailing list archive at Nabble.com.
> 
> 
Hi,
  I am facing same issue my stand alone program is working fine but when 
deploy in WAS 8.5.5 is failing with "An error occurred when verifying 
security for the message"
The difference I noticed in request is the
ec:InclusiveNamespaces has been added in CanonicalizationMethod and 
Transform tag has different value than stand alone program

StandAlone  (which is good):
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-
c14n#">
<ec:InclusiveNamespaces xmln s:ec="http://www.w3.org/2001/10/xml-exc-c14n#" 
PrefixList="soap"/>
</ds:CanonicalizationMethod>

<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" >
<ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" 
PrefixList="wsse soap"/>
</ds:Transform>

With WAS (which is failing)
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-
c14n#">
<ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" 
PrefixList="soap soapenc xsd xsi"/>
</ds:CanonicalizationMethod>

<ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
<ec:InclusiveNamespaces xmlns:ec="http://www.w3.org/2001/10/xml-exc-c14n#" 
PrefixList=""/>
</ds:Transform>


I tried to remove this by 
Map<String, Object> ctx = ((BindingProvider) port).getRequestContext();
ctx.put(WSHandlerConstants.IS_BSP_COMPLIANT, "false");

but no luck. I am using WAS8.5.5 and CXF 3.1.5. 
If you pass through with this error Please help me.

Thanks





Re: Unable to verify signature with Apache CXF and WSS4J on Websphere Application Server 8.5

Posted by cxf newbie <ca...@gmail.com>.

Sorry, you were right:

I put this in client class:
Map<String, Object> ctx = ((BindingProvider)port).getRequestContext();
ctx.put(WSHandlerConstants.IS_BSP_COMPLIANT, "false");

Now it works, but without timestamp reference.
Interesting, <Body> is correctly signed and validated.

If I put <sp:IncludeTimestamp> in policy file:
<wsu:Timestamp wsu:Id="TS-5A28482C0A57755103139419734630013">
            <wsu:Created>2014-03-07T13:02:26.300Z</wsu:Created>
            <wsu:Expires>2014-03-07T13:07:26.300Z</wsu:Expires>
</wsu:Timestamp>

then I get:
Digest value: OMNbo25276XKjodI3T60RuR1nh8=
Calculated digest value: olWImZ1Re/74QV8+56VdoWpwjcs=

DOMReferencer class:
validationStatus = Arrays.equals(digestValue, calcDigestValue); 
This one returns false.

Thanks.




--
View this message in context: http://cxf.547215.n5.nabble.com/Unable-to-verify-signature-with-Apache-CXF-and-WSS4J-on-Websphere-Application-Server-8-5-tp5740358p5740957.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Unable to verify signature with Apache CXF and WSS4J on Websphere Application Server 8.5

Posted by cxf newbie <ca...@gmail.com>.
Hi Giriraj,


Thanks for your reply.
I added 
<jaxws:properties>
    ...
   <entry key="ws-security.is-bsp-compliant" value="false"/>
</jaxws:properties>

on the client and ws side.
Also upgraded from cxf 2.7.5 to cxf 2.7.10 (xmlsec-1.5.6), but did not help.


I am not quite sure about this, but after extensive debugging I noticed
additional attributes in <ds:Signature> tag and child tags, which were not
in original message.

Maybe I look in the wrong direction but <Signature> tag in  
DOMXMLSignature.DOMSignatureValue.sigValueElem has different namespaces than
DOMXMLSignature.ownerDoc <Signature> tag.

Thanks.



--
View this message in context: http://cxf.547215.n5.nabble.com/Unable-to-verify-signature-with-Apache-CXF-and-WSS4J-on-Websphere-Application-Server-8-5-tp5740358p5740953.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Unable to verify signature with Apache CXF and WSS4J on Websphere Application Server 8.5

Posted by Giriraj Bhojak <gi...@gmail.com>.
BSP compliance is enabled by default.
I debugged a lot and identified BSP specific attributes/namespaces being
added to KeyInfo element. So the signature was actually invalid.
Disabling BSP compliance did the trick for me, for now. I may have to find
another alternative in future.
Hope this helps your case.

Thanks,
Giriraj.


On Tue, Mar 4, 2014 at 1:12 PM, cxf newbie <ca...@gmail.com> wrote:

> Hi,
>
> I also have similar problem:
>
>
> http://cxf.547215.n5.nabble.com/WebSphere-8-wss4j-and-cxf-signature-validation-td5739363.html
>
> Did you make any progress ?
>
> I tried some options:
>
> 1. Verifying certificate chain.
> 2. Adding Bouncy Castle as provider to WSSConfig instead of IBMJCE.
> 3. Avoiding xmlsec at all (unsuccsessfully).
> 4. Logging and wiresharking request and response.
>
> But no use.
>
> I tried to sign Body and Timestamp tag.
> Also noticed that Body attribute "wsu:Id" is placed before "xmlns:wsu"
> attribute when response message leaves web service. When the same response
> comes to client side their order is swapped.
> I am signing body and timestamp.
>
> As you already noticed "PARENT_LAST" and osgi may be problem:
> http://veithen.blogspot.com/2013/10/broken-by-design-websphere-stax.html
>
> Also look at this:
>
> http://blog.lodeblomme.be/2011/09/27/apache-cxf-ws-security-the-signature-or-decryption-was-invalid
> They say it may be problem with Linux or even Java 6.
>
> I can not debugg "verify" method because I haven't source for IBMJCE and
> debugger behaves very strangely evevn when Bouncy Castle is used.
>
> Cheers
>
>
>
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/Unable-to-verify-signature-with-Apache-CXF-and-WSS4J-on-Websphere-Application-Server-8-5-tp5740358p5740804.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>