Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4285402

DiffieHellman KeyPairGenerator causes NullPointerException in BigInteger.<init>

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.2.1
    • jce1.2fcs
    • security-libs
    • 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)
      ======================================================================

            shihliu Sharon Liu (Inactive)
            sgoodsunw Sheri Good (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: