cannot find javax.crypto.KeyGeneratorSpi
The following code compiles but
I get a runtime error as follows.
NoClassDefFoundError for javax.crypto.KeyGeneratorSpi
I did a jar tf on the sunjce_provider.jar file and
this class is not contained?
It is in the jce1_2_1.jar file and is abstract.
When at runtime the factory tries to create an instance
of the keyGeneratorSpi I think it tries to get a concrete
implementation of the class from the SunJCE implementation and cant find it?
Is this correct.
Obviously the classpath is set correct as I am able to
import all of the SunJCE classes.
Heres the code.
import java.io.*;
import java.util.*;
import javax.crypto.*;
import javax.crypto.spec.*;
import com.sun.crypto.provider.*;
import java.security.*;
public class CryptoTest {
public static void main(String[] args)
{
KeyGenerator keygen= null;
SecretKeydesKey= null;
CipherdesCipher = null;
Security.addProvider( new com.sun.crypto.provider.SunJCE() );
byte[] ciphertext;
try
{
keygen = KeyGenerator.getInstance("DES","SunJCE");
}
catch(Exception e){
System.out.println("Exception getting keygenerator");
e.printStackTrace();
}
}
}

