-
1. Re: Help! about JCA&JCE
tan,xiaopeng Dec 12, 2001 9:06 PM (in response to tan,xiaopeng)^_^, I've solved this problem.
We can add provider dynamically, so it doesn't matter where is the java.security file. -
2. Re: Help! about JCA&JCE
benjamin Jan 10, 2002 2:54 PM (in response to tan,xiaopeng)How did you do this? I'm having a similar problem. My application uses the JCE and runs fine in the J2EE Ref. Edition server. When running in JBoss, it crashes when I call Crypt.
Any help would be appreciated. -
3. Re: Help! about JCA&JCE
ldandersen Feb 13, 2002 12:59 PM (in response to tan,xiaopeng)Everyone involved with this thread has probably long since moved on, but I had the same problem and just solved it, so, for the benefit of future generations, here is an explanation:
Basically, the problem is that JBoss is not using the "java.security" file contained under [JRE HOME]/lib/security. This file is where JCE providers are registered, and where new providers such as Cryptix are registered. Therefore, JBoss can't find the Cryptix provider, and its various algorithm implementations.
To solve the problem, all you have to do is add something like the following to your program (before you attempt to use any algorithms, obviously):
import java.security.Security;
...
try {
security.addProvider(new cryptix.provider.Cryptix());
}
catch(Exception e) {
System.err.println("Error loading security provider (" + e.getMessage() + ")");
}
If you are trying to use the Cryptix JCE provider instead of the normal Cryptix provider (say, in conjunction with the Cryptix SASL API), you will want something like this in place of the similar line above:
security.addProvider(new cryptix.jce.provider.CryptixCrypto());
If you are using this technique, be aware of the following bug in case you experience weirdness:
http://www.cryptix.org/old/cryptix/FAQ.html#bj_unloading
A few other articles relating to the subject of dynamic provider loading:
http://www.cryptix.org/old/cryptix/FAQ.html#inst_dynamic
http://developer.java.sun.com/developer/qow/archive/93/
There--that's all I know :-)!