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

1.0.3 Loading PKCS12 causes NullPointer exception

XMLWordPrintable

    • 01
    • x86
    • windows_2000



      Name: nt126004 Date: 07/31/2002


      FULL PRODUCT VERSION :
      java version "1.4.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
      Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)

      FULL OPERATING SYSTEM VERSION :
      Microsoft Windows 2000 [Version 5.00.2195]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      The version of JSSE is 1.0.3, not 1.0.2

      A DESCRIPTION OF THE PROBLEM :
      Attempting to load a valid PKCS12 file causes a
      nullpointerexception under JDK 1.3.1+JSSE 1.0.3, but not
      under JDK 1.4.

      This problem makes it impossible to load an RSA private key
      into the JSSE, and thus impossible to use it with existing
      keys not in a JKS.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Download the PKCS12 file from
      www.claytronics.org/downloads/pkcs12
      2. Run the test program under JDK1.3.1 with JSSE 1.0.3


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      It should load the file. It does so under JDK1.4. It throws
      an exception under jdk1.3.1 and jsse 1.0.3

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      E:\test\ssl>e:\jdk1.3.1\bin\java -cp .;e:\share\jsse.jar PKCS12Test
      java.lang.NullPointerException
              at com.sun.net.ssl.internal.ssl.PKCS12KeyStore.a(DashoA6275)
              at com.sun.net.ssl.internal.ssl.PKCS12KeyStore.engineLoad(DashoA6275)
              at java.security.KeyStore.load(KeyStore.java:613)
              at PKCS12Test.main(PKCS12Test.java:16)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.io.*;
      import java.net.*;
      import java.security.KeyStore;
      import java.security.KeyFactory;
      import java.security.PrivateKey;
      import java.util.*;
      import javax.net.ssl.*;

      public class PKCS12Test {
         static public void main(String args[]) {
            try {
              java.security.Security.addProvider(new
      com.sun.net.ssl.internal.ssl.Provider());
              char[] passphrase = "password".toCharArray();
              KeyStore ks = KeyStore.getInstance("PKCS12");
              FileInputStream keystorefis = new FileInputStream("pkcs12");
              ks.load(keystorefis,passphrase);
            } catch (Exception e) {
              e.printStackTrace();
            }
         }
      }
      ---------- END SOURCE ----------

      CUSTOMER WORKAROUND :
      Sadly, none. We need 1.3.1 on the server.
      (Review ID: 159912)
      ======================================================================

            xjiangsunw Xuyang Jiang (Inactive)
            nthompsosunw Nathanael Thompson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: