-
Bug
-
Resolution: Fixed
-
P3
-
jce1.2fcs
-
1.2.1ea
-
generic
-
generic
Name: sg39081 Date: 10/27/99
java version "1.2.2"
Classic VM (build JDK-1.2.2-W, green threads, sunwjit)
When I attempt to generate a Diffie-Hellman key pair without specifying the key
size, one of BigInteger.randomBits throws a NullPointerException. If I
explicitly set the keysize to the documented default or any other legal size it
works. I tested with JCE 1.2 and JDK 1.2.2 on both Windows 95 and Solaris 2.6.
Simply compile and run the following program to reproduce the problem.
----------------------------------------------------------------------
import java.security.*;
public class Test {
public static void main(String[] args) throws GeneralSecurityException {
KeyPairGenerator.getInstance("DiffieHellman").genKeyPair();
}
}
----------------------------------------------------------------------
Exception in thread "main" java.lang.NullPointerException
at java.math.BigInteger.randomBits(BigInteger.java, Compiled Code)
at java.math.BigInteger.<init>(BigInteger.java, Compiled Code)
at com.sun.crypto.provider.DHKeyPairGenerator.generateKeyPair(DHKeyPairGenerator.java, Compiled Code)
at java.security.KeyPairGenerator$Delegate.generateKeyPair(KeyPairGenerator.java,Compiled Code)
at java.security.KeyPairGenerator.genKeyPair(KeyPairGenerator.java,Compiled Code)
at Test.main(Test.java, Compiled Code)
(Review ID: 97116)
======================================================================