How could I prevent Bouncycastle being added as a JCE provider?
<p>I've spent 2 days chasing a strange SSL problem with Tomcat (bad record mac) and I finally found it was caused by Bouncycastle JCE Provider implementation.</p>

<p>This is maybe the third time I had this kind of weird, strange behavior problems (Others being problems reloading webapps, or reading certificate info).</p>

<p>I believe Bouncycastle is a great library, but the fact that it is commonly added as a global provider for the Java process with <code>Security.addProvider()</code>, and that third party libraries do this internally and without warning, makes it a big problem. <a href="http://grepcode.com/file/repository.springsource.com/org.apache.ws/com.springsource.org.apache.ws.security/1.5.8/org/apache/ws/security/WSSConfig.java#WSSConfig.0addJceProviders" rel="nofollow">Example</a></p>

<p><strong>So, is there a way to prevent BC from being added as a security provider, globally?</strong> 
I've tried to use a Security Manager directly and through Tomcat, but I couldn't make it work, and I don't know how could I disable only that action. (I don't want any other change in my system)</p>

<p>My code uses the library but it never needs to add it as a JCE provider. 
I can't  understand why the JCE API works that way and creates such a big point of instability, but maybe that's another question.</p>