3 Replies Latest reply on Feb 13, 2002 12:59 PM by Buzz Andersen

    Help! about JCA&JCE

    txp Newbie

      hello,
      I write a program using cryptix-jce's encryption package. I add this package into JCE by modify JRE's java.security configuration file. It work well with normal java program, but when I change the program into a EJB(using jboss as Container) it raise an error "Algorithm not found"!!!
      Does jboss use it's own cryptography architecture?
      If yes then is it compatible with JCA&JCE?
      How can I add other cryptographic service providers to jboss's cryptographic architecture?
      Thank you very much!

        • 1. Re: Help! about JCA&JCE
          txp Newbie

          ^_^, 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
            Ben Switzer Newbie

            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
              Buzz Andersen Newbie

              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 :-)!