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

wrong exception in javax.crypto.SealedObject.getObject(Key k, String provider)

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 5.0
    • Fix Version/s: 5.0
    • Component/s: security-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b28
    • CPU:
      sparc
    • OS:
      solaris_2.6
    • Verification:
      Verified

      Description



      Name: ktR10099 Date: 10/17/2003



      While calling getObject(Key k, String provider) with valid key and null
      string method throws IllegalArgumentException. This behavior contadicts to
      the spec, besides, in such situation NullPointerException seems to be more
      appropriate. Please find below test example, demonstrating the bug.
      ----------------------------test127.java--------------------------
      import javax.security.auth.kerberos.*;
      import javax.crypto.*;
      import java.security.*;

      public class test127 {
          public static void main(String[] args) {
              Cipher c = null;
              SealedObject so = null;
              String provider = null;
              char[] passwd = new String("password").toCharArray();
              KerberosPrincipal kp = new KerberosPrincipal("###@###.###");
              Key k = new KerberosKey(kp, passwd, "DES");

              try {
                  c = Cipher.getInstance("DES");
                  c.init(Cipher.ENCRYPT_MODE, k);
                  so = new SealedObject("Test string", c);
              } catch (Exception e) {
                  System.out.println("1. Unexpected exception : " + e);
              }
              try {
                  Object o = so.getObject(k, null);
                  System.out.println("Unsealed object : " + o);
              } catch (Exception e) {
                  System.out.println("2. Unexpected exception : " + e);
              }
              System.out.println("Finished");
          }
      }
      ------------------------------output of test127----------------------
      java full version "1.5.0-beta-b23"
      2. Unexpected exception : java.lang.IllegalArgumentException: missing provider
      Finished
      ---------------------------------------------------------------------
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: