javajwteclipse-temurin

JWT token verification gives SignatureVerificationException on temurin image


JWT token verification using ECDSA256 algorithm is working fine on openjdk:8-jdk-alpine docker image.

However when I change base image in Dockerfile to eclipse-temurin:8-jdk-alpine and run my application I get error that jwt token verification failed with below error:

com.auth0.jwt.exceptions.SignatureVerificationException: The Token's Signature resulted invalid when verified using the Algorithm: SHA256withECDSA

What can be cause of issue? How to make it working on temurin docker image?


Solution

  • SunEC mostly doesn't work in that alpine image because its native part libsunec.so requires libgcc_s.so and the dockerfile apparently doesn't include it. Running apk update;apk add libgcc before running the java program fixes it for me; you could also create your own local image with this patch if you can handle (or don't need) syncing with the public repo.

    It looks to me like some display (GUI) functionality may similarly fail for lack of the X libraries, but I don't use Java for GUI stuff so I can't easily check that.

    Alternatively, using the ubuntu images 8-{jre,jdk}[-jammy] works as-is because libgcc-s1 is present, apparently for apt.