-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
1.4.0
-
sparc
-
solaris_8
According to API, KeyFactory.generatePrivate should accept the RSAMultiPrimePrivateCrtKeySpec since RSAMultiPrimePrivateCrtKeySpec implements Keyspec. The following program demonstrates this.
import java.security.spec.*;
import java.security.interfaces.*;
import java.math.*;
import java.security.*;
public class test{
public static void main(String[] argv) throws Exception{
BigInteger modulus=new BigInteger("385");
BigInteger publicExponent=new BigInteger("7");
BigInteger privateExponent=new BigInteger("43");
BigInteger primeP=new BigInteger("5");
BigInteger primeQ=new BigInteger("7");
BigInteger primeExponentP=new BigInteger("3");
BigInteger primeExponentQ=new BigInteger("1");
BigInteger crtCoefficient=new BigInteger("3");
//r3=11, d3=3, t3=6
BigInteger r3=new BigInteger("11");
BigInteger d3=new BigInteger("3");
BigInteger t3=new BigInteger("6");
RSAOtherPrimeInfo otherInfo=new RSAOtherPrimeInfo(r3, d3, t3);
RSAOtherPrimeInfo[] otherPrimeInfo=new RSAOtherPrimeInfo[1];
otherPrimeInfo[0]=otherInfo;
RSAMultiPrimePrivateCrtKeySpec crtKeySpec =new RSAMultiPrimePrivateCrtKeySpec(modulus,
publicExponent, privateExponent,primeP,primeQ,primeExponentP,primeExponentQ,
crtCoefficient,otherPrimeInfo);
Key priv = null;
KeyFactory kf = KeyFactory.getInstance("RSA");
System.out.println("The Provider is "+kf.getProvider());
priv = kf.generatePrivate( crtKeySpec);
}
}
lwang:/home/lw129730/CCC/4478091( 114 )%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.engineGeneratePrivate(DashoA6275)
at java.security.KeyFactory.generatePrivate(KeyFactory.java:240)
at test.main(test.java:38)
import java.security.spec.*;
import java.security.interfaces.*;
import java.math.*;
import java.security.*;
public class test{
public static void main(String[] argv) throws Exception{
BigInteger modulus=new BigInteger("385");
BigInteger publicExponent=new BigInteger("7");
BigInteger privateExponent=new BigInteger("43");
BigInteger primeP=new BigInteger("5");
BigInteger primeQ=new BigInteger("7");
BigInteger primeExponentP=new BigInteger("3");
BigInteger primeExponentQ=new BigInteger("1");
BigInteger crtCoefficient=new BigInteger("3");
//r3=11, d3=3, t3=6
BigInteger r3=new BigInteger("11");
BigInteger d3=new BigInteger("3");
BigInteger t3=new BigInteger("6");
RSAOtherPrimeInfo otherInfo=new RSAOtherPrimeInfo(r3, d3, t3);
RSAOtherPrimeInfo[] otherPrimeInfo=new RSAOtherPrimeInfo[1];
otherPrimeInfo[0]=otherInfo;
RSAMultiPrimePrivateCrtKeySpec crtKeySpec =new RSAMultiPrimePrivateCrtKeySpec(modulus,
publicExponent, privateExponent,primeP,primeQ,primeExponentP,primeExponentQ,
crtCoefficient,otherPrimeInfo);
Key priv = null;
KeyFactory kf = KeyFactory.getInstance("RSA");
System.out.println("The Provider is "+kf.getProvider());
priv = kf.generatePrivate( crtKeySpec);
}
}
lwang:/home/lw129730/CCC/4478091( 114 )%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.engineGeneratePrivate(DashoA6275)
at java.security.KeyFactory.generatePrivate(KeyFactory.java:240)
at test.main(test.java:38)
- duplicates
-
JDK-4520571 KeyFactory.generatePublic() should accept RSAPublicKeySpec
- Closed
- relates to
-
JDK-4478091 Enhance JCE to support additional features of PKCS 1, 5, 8 for JSR074
- Closed