Skip to content

jws: jkuProvider rejects fetched keys marked use=enc - #2060

Merged
lestrrat merged 1 commit into
develop/v3from
fix-v3-jku-keyusage-check
Apr 27, 2026
Merged

lestrrat merged 1 commit into
develop/v3from
fix-v3-jku-keyusage-check

Conversation

@lestrrat

Copy link
Copy Markdown
Collaborator

The keySetProvider already rejects JWKS entries marked use="enc" with a structured error (signer-kid use="enc" not usable for signature verification...). The jkuProvider skipped that check, so a jku-resolved JWKS entry mismarked as a decryption key would fall through to AlgorithmsForKey and surface as a generic "could not be verified with any of the keys".

This mirrors the selectKey check inside jkuProvider.FetchKeys immediately after the kid lookup. Behavior change is limited to what was already a verification failure — operators just get a clearer error.

v4 companion: #2059.

Mirror the keySetProvider use-check inside jkuProvider.FetchKeys so a
JWKS entry advertised for encryption (use="enc") is reported as a
structured error naming the kid and the bad usage, rather than being
passed through to AlgorithmsForKey and then failing as a generic
"could not be verified" further down.
@lestrrat
lestrrat merged commit 6ef3348 into develop/v3 Apr 27, 2026
14 checks passed
@lestrrat
lestrrat deleted the fix-v3-jku-keyusage-check branch April 27, 2026 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant