how can i make beanshell recognize changes to java.security file?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

how can i make beanshell recognize changes to java.security file?

beboposaurus
hi,

i have added bouncy castle's jce (java cryptography extension) provider to both [java_home]/jre/lib/security/java.security and C:/Program Files/Java/jre1.5.0_06/lib/security/java.security:

    ...
    security.provider.7=org.bouncycastle.jce.provider.BouncyCastleProvider
    ...

all seems well. i can successfully instantiate, initialize and update bouncy castle jce implementations from my regular java apps that are built and ran in my ide.

my problem is with beanshell. i add the bouncy castle jars to beanshell's classpath (addClassPath(...)). but, beanshell hasn't been updated with the security provider added to the java.security files.

from within a beanshell shell, javax.crypto.Cipher.getInstance("DES/CBC/PKCS5Padding", "BC")  throws:

==========================================
Target exception: java.security.NoSuchProviderException: No such provider: BC

java.security.NoSuchProviderException: No such provider: BC
        at javax.crypto.Cipher.getInstance(DashoA12275)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at bsh.Reflect.invokeMethod(Unknown Source)
        at bsh.Reflect.invokeStaticMethod(Unknown Source)
        at bsh.Name.invokeMethod(Unknown Source)
        at bsh.BSHMethodInvocation.eval(Unknown Source)
        at bsh.BSHPrimaryExpression.eval(Unknown Source)
        at bsh.BSHPrimaryExpression.eval(Unknown Source)
        at bsh.Interpreter.run(Unknown Source)
        at bsh.Interpreter.main(Unknown Source)
==========================================
                               
from within a beanshell shell, Security.getProviders() returns only the factory-loaded providers (ignoring the bouncy castle provided that i added to the java.security file).

==========================================
  SUN version 1.5
  SunRsaSign version 1.5
  SunJSSE version 1.5
  SunJCE version 1.5
  SunJGSS version 1.0
  SunSASL version 1.5
==========================================

please, can anybody fill me on on what i need to do to make beanshell recognize the security provider changes i made to my system's java.security files?

thanks in advance for your replies.