-
Notifications
You must be signed in to change notification settings - Fork 21
Description
} catch (ProviderException ex) {
//ex.printStackTrace();
return;
} catch (Exception ex) {
//ex.printStackTrace();
return;
}
Right now, the test is written is like that it catches every exception and just exits quietly.
Because the try-catch block catches all exceptions and simply returns, the test never fails. It hides real problem.
While Debugging
When we removed the try-catch block, We expected the test to fail for the different AAD scenario. However, doTest() did not throw any exception, and the execution continued normally and reaches to line number 75(
OpenJCEPlus/src/test/java/ibm/jceplus/junit/base/BaseTestAESGCMCICOWithGCMAndAAD.java
Line 75 in 4efeaad
| throw new Exception("Should have thrown an exception"); |
While debugging, I noticed that the recovered variable never becomes null, even when encryption and decryption use different AAD values. So I think checking if (recovered != null && recovered.length != 0) is not a good way to detect failure.
I think, when different AAD values are used, doTest() should throw a specific exception. That would correctly validate this negative test case.