Repository navigation
Replies: 1 comment
|
A working (AI-assisted) reference covering the "Minimal" option (Question 2) and the core-side validation (Question 4): The diff is an SPI contract, aligning the in-tree providers to it (which also fixes a latent NPE on unknown curve names in the default and FIPS providers), a baseline on-curve check in core, and the
Tests (non-NIST curve, brainpoolP256r1): rejected by the default provider; accepted once a provider advertises the curve; an advertised-but-unresolvable curve is rejected cleanly (no opaque error); and a point not on the advertised curve is rejected by core. Existing curve handling (P-256/384/521) is unchanged. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Context
JWKParser.createECPublicKey (core) maps the JWK crv through a fixed switch and rejects anything else:
The key point: the layer directly underneath is already curve-agnostic.
CryptoProvider.createECParams(name)resolves the curve through the active provider's named-curve table, which knows far more than these three (brainpool, thesecp*family, etc.). So a JWK on a non-P-curve fails for one reason only -- this hardcoded switch overrides an already-extensible provider layer, even when the active crypto provider fully supports the curve.This is not a request to add a curve or algorithm to core. No curve is added to core; the supported set comes from whichever
CryptoProvideris active. The ask is to stop core from special-casing what the SPI is already designed to handle.Concretely, this blocks any externally-provided EC key -- client registration, IdP jwks_uri, or inline jwks -- whose curve is not one of the three NIST P-curves, regardless of provider capability.
Motivation
CryptoProvider: a deployment that plugs in its own crypto provider (own curves/parameters) cannot get those keys throughJWKParsertoday, even though the provider could construct them.Proposal
Delegate curve handling to the active
CryptoProviderinstead of hardcoding it in core.JWKParserconsults that set for any crv outside the standard three; a crv no active provider advertises stays rejected. This is an explicit allow-list, not catch-all "try everything" -- the accepted surface is exactly what the active provider declares.Seeking guidance on which option is preferred:
Minimal -- for an advertised crv the standard set doesn't cover, route to createECParams (which already delegates to the provider's curve table). Delivers: standard-encoded EC keys on any provider-known named curve (e.g. brainpool). This is the clean, immediate PQC/ecosystem win.
Full (provider-defined JWK -> key) -- add a CryptoProvider hook to build the PublicKey from a JWK whose crv the provider owns, so the provider controls curve parameters, point/coordinate representation, and key factory. Delivers, in addition to Minimal: provider-defined curves whose JWK -> key construction differs from the standard EC assumption -- which the Minimal form structurally cannot reach.
Scope: this is the parse/inbound side only (createECPublicKey, for externally received keys). The publish side (JWKBuilder / JWKS output) is a separate topic and out of scope here.
Constraints
Questions
Set<String>of supported curve names, a per-provider allow-list, or a supports(crv) query?Related
SignatureProviderFactoryandClientSignatureVerifierProviderFactory#43684All reactions