예제 #1
0
  public void performTest() throws Exception {
    super.performTest();

    byte[] keyBytes = new byte[16];

    _engine.init(true, new KeyParameter(keyBytes));

    //
    // init tests
    //
    try {
      byte[] dudKey = new byte[6];

      _engine.init(true, new KeyParameter(dudKey));

      fail("failed key length check");
    } catch (IllegalArgumentException e) {
      // expected
    }

    try {
      byte[] iv = new byte[16];

      _engine.init(true, new ParametersWithIV(null, iv));

      fail("failed parameter check");
    } catch (IllegalArgumentException e) {
      // expected
    }

    testNullCBC();
    testNullSIC();
    testNullOFB();
    testNullCFB();
  }