Skip to content

Commit

Permalink
more check on generateSecret
Browse files Browse the repository at this point in the history
  • Loading branch information
johnshajiang committed Jan 16, 2024
1 parent 9a32611 commit 2eb5fb4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/jdk/sun/security/ec/ECDHKeyAgreementParamValidation.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ private static void testInitWithInvalidKey() throws Exception {
// Cannot doPhase due to no private key.
Asserts.assertThrows(
IllegalStateException.class,
()->ka.doPhase(kp.getPublic(), true));
() -> ka.doPhase(kp.getPublic(), true));

// Cannot generate shared key due to no key
Asserts.assertThrows(IllegalStateException.class, ka::generateSecret);
}

private static void testDoPhaseWithInvalidKey() throws Exception {
Expand All @@ -89,7 +92,7 @@ private static void testDoPhaseWithInvalidKey() throws Exception {
InvalidKeyException.class,
() -> ka.doPhase(kpP384.getPublic(), true));

// Should not generate share key with SECP256R1 private key and SECP384R1 public key
// Should not generate shared key with SECP256R1 private key and SECP384R1 public key
Asserts.assertThrows(IllegalStateException.class, ka::generateSecret);
}

Expand Down

0 comments on commit 2eb5fb4

Please sign in to comment.