Skip to content

[OID4VCI] Reject mismatched signature algorithms during SD-JWT verification#51133

Open
forkimenjeckayang wants to merge 2 commits into
keycloak:mainfrom
adorsys:issue-50889
Open

[OID4VCI] Reject mismatched signature algorithms during SD-JWT verification#51133
forkimenjeckayang wants to merge 2 commits into
keycloak:mainfrom
adorsys:issue-50889

Conversation

@forkimenjeckayang

Copy link
Copy Markdown
Contributor

Summary

SD-JWT signature verification now requires the algorithm declared in the protected JWS alg header to match the algorithm used by the SignatureVerifierContext.

The check is implemented in the shared JwsToken.verifySignature path, so it applies to both:

  • issuer-signed JWTs
  • key-binding JWTs

Missing algorithms and algorithm mismatches are rejected before the cryptographic verification operation is invoked. This also prevents profile-level algorithm policies from being bypassed: when a profile accepts the JOSE header algorithm, the verifier context is now guaranteed to use that same algorithm.

Closes #51109

Signed-off-by: forkimenjeckayang <forkimenjeckayang@gmail.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds algorithm binding to SD-JWT signature verification, preventing JOSE header policy bypasses described in #51109.

Changes:

  • Rejects missing or mismatched JWS/verifier algorithms.
  • Adds issuer-signed and key-binding JWT mismatch tests.
  • Adds a test signer wrapper for reporting alternate algorithms.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
core/src/main/java/org/keycloak/sdjwt/JwsToken.java Enforces signature algorithm equality.
core/src/test/java/org/keycloak/sdjwt/TestSettings.java Adds mismatch test support.
core/src/test/java/org/keycloak/sdjwt/SdJwtVerificationTest.java Tests issuer JWT mismatches.
core/src/test/java/org/keycloak/sdjwt/sdjwtvp/SdJwtVPVerificationTest.java Tests key-binding JWT mismatches.

Comment thread core/src/main/java/org/keycloak/sdjwt/JwsToken.java Outdated
Signed-off-by: forkimenjeckayang <forkimenjeckayang@gmail.com>
Copilot AI review requested due to automatic review settings July 24, 2026 12:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SD-JWT verification accepts signatures whose algorithm differs from the JWS header

2 participants