Skip to content

Commit fa17dbf

Browse files
committed
Ensured correct message assertion on all JDKs (value was different on JDK 15 and later)
1 parent b1fdf31 commit fa17dbf

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

impl/src/test/groovy/io/jsonwebtoken/JwtsTest.groovy

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1523,7 +1523,8 @@ class JwtsTest {
15231523
encrypt(pubKey, alg, enc)
15241524
fail()
15251525
} catch (UnsupportedKeyException expected) {
1526-
String msg = pubKey.getAlgorithm() + " keys may not be used with ECDH-ES key " +
1526+
String id = EdwardsCurve.forKey(pubKey).getId()
1527+
String msg = id + " keys may not be used with ECDH-ES key " +
15271528
"agreement algorithms per https://www.rfc-editor.org/rfc/rfc8037#section-3.1"
15281529
assertEquals msg, expected.getMessage()
15291530
}
@@ -1557,7 +1558,8 @@ class JwtsTest {
15571558
decrypt(jwe, key) // invalid signing key
15581559
fail()
15591560
} catch (UnsupportedKeyException expected) {
1560-
String msg = key.getAlgorithm() + " keys may not be used with ECDH-ES key " +
1561+
String id = EdwardsCurve.forKey(key).getId()
1562+
String msg = id + " keys may not be used with ECDH-ES key " +
15611563
"agreement algorithms per https://www.rfc-editor.org/rfc/rfc8037#section-3.1"
15621564
assertEquals msg, expected.getMessage()
15631565
}

0 commit comments

Comments
 (0)