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

SunJCE provider does not override engineGetKeySize() for NullCipher

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.2
    • unknown
    • security-libs
    • mantis
    • sparc
    • solaris_7



      Name: krC82822 Date: 02/07/2001


      java version "1.3.0_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0_01)
      Java HotSpot(TM) Client VM (build 1.3.0_01, mixed mode)


      Compile and run:

      import javax.crypto.Cipher;
      import javax.crypto.NullCipher;

      public class tjce {

        public tjce() {
          try {
            Cipher cipher = new NullCipher();
            cipher.init(Cipher.DECRYPT_MODE, (java.security.Key) null);
          } catch (Exception e) {
            e.printStackTrace();
            return;
          }
          System.out.println("NullCipher works");
        }

        public static void main(String args[]) {
          tjce t = new tjce();
        }
      }

      Using SunJCE we get:
      java.lang.UnsupportedOperationException
              at javax.crypto.CipherSpi.engineGetKeySize([DashoPro-V1.2-120198])
              at javax.crypto.Cipher.init([DashoPro-V1.2-120198])
              at tjce.<init>(tjce.java:9)
              at tjce.main(tjce.java:18)

      According to the API docs, the provider needs to override engineGetKeySize.
      (Review ID: 113143)
      ======================================================================

            valeriep Valerie Peng
            kryansunw Kevin Ryan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: