-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
1.4.0
-
sparc
-
solaris_8
KeyFactory.generatePublic(KeySpec ks) can not accept RSAPublicKeySpec as argument. The following program demonstrates this.
import java.security.spec.*;
import java.math.*;
import java.security.*;
public class test{
public static void main(String[] argv) throws Exception{
BigInteger modulus=new BigInteger("77");
BigInteger publicExponent=new BigInteger("7");
RSAPublicKeySpec pubKeySpec= new RSAPublicKeySpec(modulus, publicExponent);
Key pub = null;
KeyFactory kf = KeyFactory.getInstance("RSA");
System.out.println("The Provider is "+kf.getProvider());
pub = kf.generatePublic(pubKeySpec);
}
}
lwang:/home/lw129730/CCC/4478091( 109 )java test
The Provider is SunJSSE version 1.4
Exception in thread "main" java.security.spec.InvalidKeySpecException: Unknown key spec.
at com.sun.net.ssl.internal.ssl.JS_KeyFactory.engineGeneratePublic(DashoA6275)
at java.security.KeyFactory.generatePublic(KeyFactory.java:224)
at test.main(test.java:18)
import java.security.spec.*;
import java.math.*;
import java.security.*;
public class test{
public static void main(String[] argv) throws Exception{
BigInteger modulus=new BigInteger("77");
BigInteger publicExponent=new BigInteger("7");
RSAPublicKeySpec pubKeySpec= new RSAPublicKeySpec(modulus, publicExponent);
Key pub = null;
KeyFactory kf = KeyFactory.getInstance("RSA");
System.out.println("The Provider is "+kf.getProvider());
pub = kf.generatePublic(pubKeySpec);
}
}
lwang:/home/lw129730/CCC/4478091( 109 )java test
The Provider is SunJSSE version 1.4
Exception in thread "main" java.security.spec.InvalidKeySpecException: Unknown key spec.
at com.sun.net.ssl.internal.ssl.JS_KeyFactory.engineGeneratePublic(DashoA6275)
at java.security.KeyFactory.generatePublic(KeyFactory.java:224)
at test.main(test.java:18)
- duplicates
-
JDK-4520601 KeyFactory.generatePrivate() should accept RSAMultiPrimePrivateCrtKeySpec
- Closed