jwtk/jjwt · error · SignatureException

Unsupported signature algorithm '${value}'

Error message

Unsupported signature algorithm '${value}'

What it means

Lookup-failure guard in SignatureAlgorithm.forName(String): the method scans the enum's values using a case-insensitive name comparison, and if the supplied string does not equal any algorithm name (HS256, HS384, HS512, RS256, RS384, RS512, PS256, PS384, PS512, ES256, ES384, ES512, NONE), a SignatureException is thrown. The input at fault is the unrecognized alg header value — often a typo or an algorithm the application does not support.

Source

Thrown at api/src/main/java/io/jsonwebtoken/SignatureAlgorithm.java:670

    /**
     * Looks up and returns the corresponding {@code SignatureAlgorithm} enum instance based on a
     * case-<em>insensitive</em> name comparison.
     *
     * @param value The case-insensitive name of the {@code SignatureAlgorithm} instance to return
     * @return the corresponding {@code SignatureAlgorithm} enum instance based on a
     * case-<em>insensitive</em> name comparison.
     * @throws SignatureException if the specified value does not match any {@code SignatureAlgorithm}
     *                            name.
     */
    public static SignatureAlgorithm forName(String value) throws SignatureException {
        for (SignatureAlgorithm alg : values()) {
            if (alg.getValue().equalsIgnoreCase(value)) {
                return alg;
            }
        }

        throw new SignatureException("Unsupported signature algorithm '" + value + "'");
    }
}

View on GitHub (pinned to fb71496164)

Solutions

  1. Pass a valid algorithm name: HS256/HS384/HS512, RS256/RS384/RS512, PS256/PS384/PS512, ES256/ES384/ES512, or NONE (case-insensitive).
  2. Trim/normalize the incoming string and check for typos before calling forName.
  3. Catch SignatureException and reject the token/record with a clear 'unsupported algorithm' error at the application boundary.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at api/src/main/java/io/jsonwebtoken/SignatureAlgorithm.java:670 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of jwtk/jjwt@fb71496164 (2026-09-09). Data as JSON: /api/errors/ac8e157eb2a6626c. Report an issue: GitHub.