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

Unclear description of SecretKeySpec constructor

    XMLWordPrintable

Details

    • b46
    • generic
    • generic

    Description



      Name: bkR10012 Date: 03/04/2004


      The description of the constructor
      javax.crypto.spec.SecretKeySpec.SecretKeySpec(byte[] key,
                           int offset,
                           int len,
                           String algorithm)
      says:
      "Constructs a secret key from the given byte array, using the first len
       bytes of key, starting at offset inclusive.
       
       The bytes that constitute the secret key are those between key[offset]
       and key[offset+len-1] inclusive.
      ...
      Throws:
      IllegalArgumentException - if algorithm is null or key is invalid, i.e. null,
      empty, or too short."

      It is not clear what does "too short" mean.
      The spec. should clearly describe the implementation behavior if
      - 'offset' or (offset+len-1) are out of range;
      - 'len' is less than 1.

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

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: