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(RampartSender.java:76)
[java] at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
[java] at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
[java] at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:261)
[java] at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:426)
[java] at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:430)
[java] at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:225)
[java] at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
[java] at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:554)
[java] at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:530)
[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(AsymmetricBindingBuilder.java:612)
[java] at org.apache.rampart.builder.AsymmetricBindingBuilder.build(AsymmetricBindingBuilder.java:97)
[java] at org.apache.rampart.MessageBuilder.build(MessageBuilder.java:147)
[java] at org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:65)
[java] ... 11 more
[java] Caused by: org.apache.ws.security.WSSecurityException: An unsupported signature or encryption algorithm was used (unsupported key transport encryption algorithm: No such algorithm: http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p); nested exception is:
[java] java.security.NoSuchAlgorithmException: Cannot find any provider supporting RSA/ECB/OAEPPadding
[java] at org.apache.ws.security.util.WSSecurityUtil.getCipherInstance(WSSecurityUtil.java:785)
[java] at org.apache.ws.security.message.WSSecEncryptedKey.prepareInternal(WSSecEncryptedKey.java:205)
[java] at org.apache.ws.security.message.WSSecEncrypt.prepare(WSSecEncrypt.java:259)
[java] at org.apache.rampart.builder.AsymmetricBindingBuilder.doSignBeforeEncrypt(AsymmetricBindingBuilder.java:578)
[java] ... 14 more
[java] Caused by: java.security.NoSuchAlgorithmException: Cannot find any provider supporting RSA/ECB/OAEPPadding
[java] at javax.crypto.Cipher.getInstance(DashoA13*..)
[java] at org.apache.ws.security.util.WSSecurityUtil.getCipherInstance(WSSecurityUtil.java:777)
[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.
- Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files for Java 6
- Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files for Java 7
- Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files for Java 8
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.
References...
- https://docs.wso2.com/display/ESB481/Sample+200%3A+Using+WS-Security+with+policy+attachments+for+proxy+services
- http://stackoverflow.com/questions/6481627/java-security-illegal-key-size-or-default-parameters
- http://wso2-oxygen-tank.10903.n7.nabble.com/Dev-Error-Running-wso2esb-4-8-0-Sample-200-Using-WS-Security-with-policy-attachments-for-proxy-servis-td90015.html
No comments:
Post a Comment