Results 1 to 2 of 2
  1. #1
    jevans is offline Member
    Join Date
    Jul 2008
    Posts
    1
    Rep Power
    0

    Default IBM JCE: Cannot set up certs for trusted CAs at javax.crypto.f

    I've been struggling for a week or two to get anything in the javax.crypto package to work for me.

    Environment:
    J2SE 1.4.2, IBM Rational Application Developer 6.0, IBM WebSphere App Server 6.0.2.15 (although that last one's not really relevant for this example problem)

    Any program I make that utilizes Java Cryptography gives the following exception:

    Exception in thread "main" java.lang.ExceptionInInitializerError
    at javax.crypto.KeyGenerator.getInstance(Unknown Source)
    at DESKeyGenerator.main(DESKeyGenerator.java:18)
    Caused by: java.lang.SecurityException: Cannot set up certs for trusted CAs
    at javax.crypto.f.<clinit>(Unknown Source)
    ... 2 more
    Most recommendations I've come across for solving this involved reordering the crytographic service providers in java.security, so here is my current arrangement:

    security.provider.1=com.ibm.crypto.provider.IBMJCE
    security.provider.2=com.ibm.jsse.IBMJSSEProvider
    security.provider.3=com.ibm.jsse2.IBMJSSEProvider2
    security.provider.4=com.ibm.security.jgss.IBMJGSSP rovider
    security.provider.5=com.ibm.security.cert.IBMCertP ath

    Finally, here's an example program that causes the exception:

    Java Code:
    import java.security.Key;
    import java.security.NoSuchAlgorithmException;
    import java.security.Security;
    import javax.crypto.KeyGenerator;
    import com.ibm.crypto.provider.IBMJCE;
    
    public class DESKeyGenerator {
    
      public static void main(String[] args) {
        //Security.addProvider(new IBMJCE());
    
        try {
          KeyGenerator kg = KeyGenerator.getInstance("DES");
          Key key = kg.generateKey();
          System.out.println("Key format: " + key.getFormat());
          System.out.println("Key algorithm: " + key.getAlgorithm());
        }
    
        catch (NoSuchAlgorithmException e) {
          e.printStackTrace();
        }
      }
    }
    The exception's the same with the Security.addProvider line uncommented.

    Any ideas or guidance would be greatly appreciated. Thanks for your time.

  2. #2
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Default

    I'm not awake yet, and having a bad hair day, but are you sure you want to use DES?

    and
    Java Code:
    javax.crypto.f.<clinit>(Unknown Source)
    what is f?
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

Similar Threads

  1. Replies: 3
    Last Post: 01-14-2010, 08:45 PM
  2. javax.microedition.io/ javax.bluetooth
    By ahtiven in forum New To Java
    Replies: 3
    Last Post: 01-13-2009, 03:54 PM
  3. Replies: 2
    Last Post: 07-13-2008, 06:46 PM
  4. Replies: 4
    Last Post: 08-10-2007, 11:09 PM
  5. map javax.swing.text.Element to javax.swing.text.View
    By elizabeth in forum New To Java
    Replies: 1
    Last Post: 07-30-2007, 08:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •