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

javax.crypto.SealedObject.getObject(Cipher c) does not work

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not an Issue
    • P3
    • None
    • 5.0
    • security-libs

    Description



      Name: ktR10099 Date: 10/17/2003



      Attempt to retrieve original object from the SealedObject using
      getObject(Cipher) method fails. Please find below example, demonstrating
      the problem. It worth mentioning, that getObject(Key) method works OK.
      ---------------------------test126.java---------------------------
      import javax.security.auth.kerberos.*;
      import javax.crypto.*;
      import javax.crypto.spec.*;
      import java.security.*;

      public class test126 {
          public static void main(String[] args) {
              Cipher c = null;
              SealedObject so = 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);
                  Object o = so.getObject(k);
                  System.out.println("Unsealed object : " + o);
              } catch (Exception e) {
                  System.out.println("Unexpected exception : " + e);
              }
              try {
                  Object o = so.getObject(c);
                  System.out.println("Unsealed object : " + o);
              } catch (Exception e) {
                  System.out.println("Unexpected exception : " + e);
              }
              System.out.println("Finished");
          }
      }
      -------------------------test126 output---------------------------
      java full version "1.5.0-beta-b23"
      Unsealed object : Test string
      Unexpected exception : java.io.StreamCorruptedException: invalid stream header
      Finished
      ------------------------------------------------------------------
      ======================================================================

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: