Skip to content

Commit

Permalink
more assertThrows on doPhase
Browse files Browse the repository at this point in the history
  • Loading branch information
johnshajiang committed Jan 13, 2024
1 parent 8a57346 commit 68a53e8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions test/jdk/sun/security/ec/ECDHKeyAgreementParamValidation.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,10 @@ public void testDoPhaseWithInvalidKey() throws Exception {

KeyAgreement ka = KeyAgreement.getInstance("ECDH");
ka.init(kpP256.getPrivate());
try {
ka.doPhase(kpP384.getPublic(), true);
} catch (InvalidKeyException e) {
// Do nothing
}

Assertions.assertThrows(
InvalidKeyException.class,
() -> ka.doPhase(kpP384.getPublic(), true));

// Should not generate share key with SECP256R1 private key and SECP384R1 public key
Assertions.assertThrows(IllegalStateException.class, ka::generateSecret);
Expand Down

0 comments on commit 68a53e8

Please sign in to comment.