Yes we do have to have a proper way to use bouncy castle jars within
carbon. AFAIK there are several incompatible bouncy castle jar versions
used in apache projects such as Rampart, Axis2, Synapse etc. There are
several bouncy castle jars hidden inside carbon osgi bundles and the
problem is Axis2 server does not run on OSGi so it cant see the bouncy
castle jars in carbon.  I guess thats why we need to manually add a
bcprov-xx jar file to the plugins folder so that Axis2 server can read the
jar file.

Jeewantha


On Fri, Dec 20, 2013 at 11:33 AM, Nirmal Fernando <nir...@wso2.com> wrote:

>
>
>
> On Fri, Dec 20, 2013 at 11:12 AM, Aruna Karunarathna <ar...@wso2.com>wrote:
>
>> Hi all,
>>
>> There is a simple other way around which I have found to resolve the
>> error.
>>
>> Simply copy the bcprov-jdk15.jar  from
>> <ESB-HOME>/repository/axis2/client/lib  to 
>> <ESB-HOME>/repository/compnents/plugins
>> folder
>>
>
> We shouldn't recommend this. Please investigate a bit more.
>
>>
>>
>> Regards,
>>
>>
>> On Fri, Dec 20, 2013 at 10:30 AM, Aruna Karunarathna <ar...@wso2.com>wrote:
>>
>>> Hi all,
>>>
>>> When running the $subject sample [1] I have encountered the following
>>> error.
>>>
>>>   [java] 13/12/20 10:02:23 ERROR sandesha2.SandeshaModule: Could not
>>> load module policies. Using default values.
>>>      [java] 13/12/20 10:02:23 INFO mail.MailTransportSender: MAILTO
>>> Sender started
>>>      [java] 13/12/20 10:02:23 INFO jms.JMSSender: JMS Sender started
>>>      [java] 13/12/20 10:02:23 INFO jms.JMSSender: JMS Transport Sender
>>> initialized...
>>>      [java] Using WS-Security
>>>      [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
>>>
>>>
>>> However I tried to fix the issue I found that after,
>>>
>>> 1. copying the bcprov-jdk15.jar jar file to the <JAVA_HOME>/jre/lib/ext
>>> 2. Adding the following to the
>>> <ESB_HOME>/samples/axis2Client/src/samples/userguide/StockQuoteClient.java
>>> file
>>>
>>> import java.security.Security;
>>> import org.bouncycastle.jce.provider.BouncyCastleProvider;
>>>
>>>         // in main method
>>>         if (Security.getProvider(BouncyCastleProvider.PROVIDER_NAME) ==
>>> null) {
>>>             Security.addProvider(new BouncyCastleProvider());
>>>         }
>>>
>>>
>>> I followed the steps mentioned in here [2] overcome the problem.  After
>>> that example worked fine. My JDK version is java version "1.6.0_45".
>>>
>>> Don't we have to mention this in the example documentation also? WDYT?
>>>
>>>
>>> [1].
>>> http://docs.wso2.org/display/ESB480/Sample+200%3A+Using+WS-Security+with+policy+attachments+for+proxy+services
>>> [2]. http://stackoverflow.com/a/17318843
>>> --
>>>
>>> * Aruna Sujith Karunarathna* | Software Engineer
>>> WSO2, Inc | lean. enterprise. middleware.
>>> #20, Palm Grove, Colombo 03, Sri Lanka
>>> Mobile: +94 71 9040362 | Work: +94 112145345
>>> Email: ar...@wso2.com | Web: www.wso2.com
>>>
>>>
>>
>>
>>
>> --
>>
>> * Aruna Sujith Karunarathna* | Software Engineer
>> WSO2, Inc | lean. enterprise. middleware.
>> #20, Palm Grove, Colombo 03, Sri Lanka
>> Mobile: +94 71 9040362 | Work: +94 112145345
>> Email: ar...@wso2.com | Web: www.wso2.com
>>
>>
>> _______________________________________________
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
>
> Thanks & regards,
> Nirmal
>
> Senior Software Engineer- Platform Technologies Team, WSO2 Inc.
> Mobile: +94715779733
> Blog: http://nirmalfdo.blogspot.com/
>
>
> _______________________________________________
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Jeewantha Dharmaparakrama
Software Engineer; WSO2, Inc.; http://wso2.com/
Phone : (+94) 774726790
Skype : prasad.jeewantha
LinkedIn : http://www.linkedin.com/in/jeewanthad
Twitter: https://twitter.com/jeewamp
Blog: http://jeewanthad.blogspot.com/
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to