JDK-4961054 : Unexpected IAE from RC5ParameterSpec(int,int,int,byte[])
  • Type: Bug
  • Component: security-libs
  • Sub-Component: javax.crypto
  • Affected Version: 5.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_7
  • CPU: sparc
  • Submitted: 2003-11-28
  • Updated: 2017-05-19
  • Resolved: 2003-12-04
Related Reports
Duplicate :  
Description

Name: mtR10145			Date: 11/28/2003

Constructor RC5ParameterSpec(int,int,int,byte[]) throws
unexpected IAE like test code below illustrates. This exception is
unspecified since the spec states only "Throws: IllegalArgumentException - if iv is null."
=================== Test20.java ======================
import javax.crypto.spec.*;

public class Test20 {

    public static void main(String args[]) {

        String testString = new String("testStringToBeConvertedIntoBytes");

        RC5ParameterSpec rs = null;

        try {
            rs = new RC5ParameterSpec(1, 1, 32, testString.substring(0, 6).getBytes());
            System.out.println("No exceptions thrown");
        } catch(IllegalArgumentException ex) {
            System.out.println("IAE: " + ex);
        }
    }
}
============== Test output with J2SE 1.5.0-beta-b29 ====
IAE: java.lang.IllegalArgumentException: IV too short
======================================================================

Name: mtR10145			Date: 12/01/2003

Constructor RC5ParameterSpec(int, int, int, byte[],int)
is affected by this bug too. To reproduce simply use the following string:

    rs = new RC5ParameterSpec(1, 1, 32, testString.substring(0, 6).getBytes(), 0);

in test code below instead of existent one.


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

Comments
EVALUATION ###@###.### 2003-12-04 Marking as duplicate of 4960803. They describe the same underlying problem in that the specification is underspecified for the cases for which IllegalArgumentException is thrown if the iv is invalid.
01-09-2004