Skip to content

TestAESGCMCICOWithGCMAndAAD catches and ignores all exceptions, preventing proper failure detection. #1214

@Mohit-Rajbhar100698

Description

@Mohit-Rajbhar100698
   } 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(

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions