Tags: bouncycastle, classes, created, database, email, encrypted, java, jce, mysql, oracle, problemi, procedure, provider, sql, stored, writing

JCE, BouncyCastle Provider

On Database » Oracle

2,780 words with 1 Comments; publish: Mon, 11 Feb 2008 19:04:00 GMT; (25078.13, « »)

Hi, here is my problem:

I'm writing stored java procedure which should send signed and encrypted email.

I've created my classes and after adding bcprov.jar to lib/ext, modifying java.security and using Unlimited Strength Jurisdiction Policy Files everything works fine and emails comes to me signed and encrypted.

Now I'm trying to load all my classes to oracle.

I'm loading jars:

activation-1.0.2.jar

junit-3.8.1.jar

mailapi-1.3.2.jar

smtp-1.3.2.jar

bcprov-jdk14-126.jar

bcmail-jdk14-126.jar

javamail-crypto-0.4.jar

javamail-crypto-bouncy.jar

smime-1.0.jar -- my classes

Everything works fine and when I check for invalid java classes there are none.

Now I'm trying to call my procedure from sql.

I got error:

call sendHamster()

*

ERROR at line 1:

ORA-29532: Java call terminated by uncaught Java exception:

java.io.IOException: error constructing MAC:

java.security.NoSuchProviderException: JCE cannot authenticate the provider BC

When I do not load bcprov.jar then I have:

ERROR at line 1:

ORA-29532: Java call terminated by uncaught Java exception:

java.security.NoSuchProviderException: No provider configured for S/MIME /* in real it is ClassNotFoundException */

Standard solution for this problem is to add bcprov.jar to lib/ext, add policy files, add provider to java.security and everything should work.

Problem is that in Oracle there are 3 java vm. This one which is used when i call java function in sql session is $ORACLE_HOME/javavm. I've tried to add all that files there but it does not work. I think that it does not work because bcprov.jar loaded by java is first in classpath before bcprov.jar from $ORACLE_HOME/javavm. Although when i check System.getProperty('java.class.path') I get null. When i tried System.getProperty('java.lib.path') i got $ORACLE_HOME/lib.

I've been also trying to sign bcprov and add certificates to cacerts from lib/security. But there are 3 or 5 cacerts files in $ORACLE_HOME.

Can anyone help me?

Question is: can I add some jar to $ORACLE_HOME/{?} which will be used during compilation/resolving when I call loadjava? Where should it be?

Has anyone added security provider and used it in java stored procedure?

Thanks in advance.

All Comments

Leave a comment...

  • 1 Comments
    • Hi, I have a similar problem calling java stored procedure. I'm Looking for solution for the last 2 days.

      Instead, I want to dynamically add a provider(Bouncy Castle)! I uploaded my classes and signed bcprov-jdk14-126.zip but when I want to use some of the crypto services of BC, I get:

      The provider BC may not be signed by a trusted party

      I hope someone has the right solution!

      #1; Fri, 22 Feb 2008 17:39:00 GMT