Friday, July 10, 2015

Running WSO2 ESB Sample 200: Using WS-Security with policy attachments for proxy services

Hi All,

An enterprise service bus (ESB) is a software architecture construct that enables communication among various applications. WSO2 Enterprise Service Bus is such a middleware.

This post will explain on how to execute the WSO2 ESB 4.8.1 sample number 200. This sample demonstrates how you can use WS-Security signing and encryption with proxy services through WS-Policy. When running this sample you may face the following exception coming through the client.

     [java] org.apache.axis2.AxisFault: Error in encryption
     [java]     at org.apache.rampart.handler.RampartSender.invoke(
     [java]     at org.apache.axis2.engine.Phase.invokeHandler(
     [java]     at org.apache.axis2.engine.Phase.invoke(
     [java]     at org.apache.axis2.engine.AxisEngine.invoke(
     [java]     at org.apache.axis2.engine.AxisEngine.send(
     [java]     at org.apache.axis2.description.OutInAxisOperationClient.send(
     [java]     at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(
     [java]     at org.apache.axis2.client.OperationClient.execute(
     [java]     at org.apache.axis2.client.ServiceClient.sendReceive(
     [java]     at org.apache.axis2.client.ServiceClient.sendReceive(
     [java]     at samples.userguide.StockQuoteClient.executeClient(Unknown Source)
     [java]     at samples.userguide.StockQuoteClient.main(Unknown Source)
     [java] Caused by: org.apache.rampart.RampartException: Error in encryption
     [java]     at org.apache.rampart.builder.AsymmetricBindingBuilder.doSignBeforeEncrypt(
     [java]     at
     [java]     at
     [java]     at org.apache.rampart.handler.RampartSender.invoke(
     [java]     ... 11 more
     [java] Caused by: An unsupported signature or encryption algorithm was used (unsupported key transport encryption algorithm: No such algorithm:; nested exception is: 
     [java] Cannot find any provider supporting RSA/ECB/OAEPPadding
     [java]     at
     [java]     at
     [java]     at
     [java]     at org.apache.rampart.builder.AsymmetricBindingBuilder.doSignBeforeEncrypt(
     [java]     ... 14 more
     [java] Caused by: Cannot find any provider supporting RSA/ECB/OAEPPadding
     [java]     at javax.crypto.Cipher.getInstance(DashoA13*..)
     [java]     at
     [java]     ... 17 more

If so, you can following these steps below to overcome the issue.

Step 1

Copy the "bcprov-jdk15.jar" from <ESB_HOME>/repository/axis2/client/lib/ folder and paste it in <ESB_HOME>/repository/components/plugins folder.

Step 2

Download the Java Cryptography files for the specific java version you have installed from below.

Step 3

Take a backup of the <JRE_HOME>/lib/security folder and keep it somewhere safe as a safety precaution.

Step 4

Copy the files from the downloaded archive and paste them to <JRE_HOME>/lib/security folder.

By doing above steps I was able to run the sample without a hassle.


No comments:

Post a Comment