Skip to content

Fix/es256 idtoken eee-p1363 - #30

Open
grahamallen-1 wants to merge 2 commits into
stateofca:mainfrom
spruceid:fix/es256-idtoken-ieee-p1363-3
Open

Fix/es256 idtoken eee-p1363 #30
grahamallen-1 wants to merge 2 commits into
stateofca:mainfrom
spruceid:fix/es256-idtoken-ieee-p1363-3

Conversation

@grahamallen-1

@grahamallen-1 grahamallen-1 commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix ES256 id_token signatures so they're valid JWS. The signer used Node's default ECDSA output (ASN.1/DER); JWS requires the raw R || S concatenation (IEEE P1363). As a result, ES256 id_tokens are rejected by standards-compliant RPs with a signature-validation error.

Fix

Sign with dsaEncoding: 'ieee-p1363' in common/oidc.js. dsaEncoding is ignored for RSA keys, so the RS256 path is unaffected.

Per RFC 7518 §3.4 (JSON Web Algorithms), the ECDSA JWS Signature is the fixed-length concatenation of R and S — not the DER encoding: https://www.rfc-editor.org/rfc/rfc7518#section-3.4

Tests

Added an id_token signing test in test/unit/60-oidc.test.js: mints a token with an ES256 key, verifies it with jose (a compliant verifier — rejects DER, accepts P1363), and asserts the signature is exactly 64 bytes (P-256 R||S).

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