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

NullCipher.init(int, Key) throws NPE

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 5.0
    • 5.0
    • security-libs
    • b28
    • sparc
    • solaris_2.6
    • Verified



      Name: ktR10099 Date: 10/15/2003



      Calling method public void init(int, Key) with valid parameters of
      NullCipher object results in NullPointerException. Please find example,
      demonstrating the problem, below:
      ----------------------------test125.java--------------------------
      import javax.crypto.*;
      import javax.crypto.spec.*;
      import java.security.*;

      public class test125 {
          public static void main(String[] args) {
              NullCipher nc = new NullCipher();
              byte[] b = {0, 1, 2, 3, 4, 5, 6, 7};
              Key k = new SecretKeySpec(b, "DES");
              try {
                  nc.init(Cipher.ENCRYPT_MODE, k);
                  System.out.println("Init successful");
              } catch (Exception e) {
                  System.out.println("Unexpected exception " + e);
              }
              System.out.println("Finished");
          }
      }
      -----------------------output of test125--------------------------
      java full version "1.5.0-beta-b23"
      Unexpected exception java.lang.NullPointerException
      Finished
      ------------------------------------------------------------------

      ======================================================================

            valeriep Valerie Peng
            kvtsunw Kvt Kvt (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: