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

SecretKeySpec does not throw the ArrayIndexOutOfBoundsException (and throws IAE instead)

XMLWordPrintable

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

      java spec defines following behavior of the javax.crypto.spec.SecretKeySpec constructor:

      --- SecretKeySpec(byte[] key,int offset,int,len,String algorithm)
      "...
      Throws:
      IllegalArgumentException - if algorithm is null or key is null, empty, or too short, i.e. key.length-offset.
      ArrayIndexOutOfBoundsException - is thrown if offset or len index bytes outside the key."

      However the runtime throws "java.lang.IllegalArgumentException: Invalid offset/length combination" when len/offset are invalid.

            wetmore Bradford Wetmore
            alyamov Andrew Lyamov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: