eclipse / microprofile-jwt-auth

Apache License 2.0
106 stars 59 forks source link

TokenUtilsEncryptTest is failing on OpenJDK 19 EA #295

Closed rmartinc closed 2 years ago

rmartinc commented 2 years ago

We do periodic runs of the tck tests with newer versions of the JDK. And TokenUtilsEncryptTest is failing in JDK-19 EA because AES KeyGenerator has changed its default size from 128 to 256 (commit).

The error reported is the following:

Expected exception of type class org.jose4j.jwt.consumer.InvalidJwtException but got org.jose4j.lang.InvalidKeyException: Invalid key for JWE A128KW, expected a 128 bit key but a 256 bit key was provided.
    at org.eclipse.microprofile.jwt.tck.util.TokenUtilsEncryptTest.testFailAlgorithm(TokenUtilsEncryptTest.java:50)

I'm sending a little PR to force the bits in the AES secret key generation inside the KeyUtils class. For current versions of the jdk there is no issue but the fix does no harm at all. This way the code is ready for jdk-19 and if the fix is back-ported to previous versions.

Thanks!