fix(schema): machine-enforce the P-521/ES512 key pairing in profile.json#625
Open
vishkaty wants to merge 1 commit into
Open
fix(schema): machine-enforce the P-521/ES512 key pairing in profile.json#625vishkaty wants to merge 1 commit into
vishkaty wants to merge 1 commit into
Conversation
profile.json encodes the curve<->alg binding as schema constraints for P-256, P-384, and Ed25519, but not for P-521. A P-521 key published with a mismatched alg (e.g. ES256) therefore passes profile validation, while the identical mistake on a P-256 key is rejected. This makes the binding machine-checkable and symmetric for the ES512 case, complementing the prose/pseudocode binding proposed in Universal-Commerce-Protocol#618. Conditional well-formedness only: it constrains a P-521 key to alg ES512 when one is published; it does not require any party to support ES512, so it stays consistent with keeping ES512 AP2-scoped. Verified with ucp-schema: a mispaired P-521 key is now rejected; a correct P-521/ES512 key, and an alg-less P-521 key (verifier derives the algorithm), still validate; P-256/P-384/OKP keys are unaffected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
profile.jsonencodes the JWK curve↔algorithm binding as schema constraints — but only for three of the four curves it names. There areif/thenrules for P-256 → ES256, P-384 → ES384, and Ed25519 → EdDSA, and none for P-521.The effect, checked with the
ucp-schemavalidator (same one CI uses):keys[]profile.jsonvalidationcrv: P-521,alg: ES512(correct)crv: P-521,alg: ES256(mismatched)crv: P-256,alg: ES384(mismatched)So a P-521 signing key can be published with an algorithm that contradicts its curve and pass validation, while the identical mistake on a P-256 key is rejected. This is the same class of gap as #571 (a schema-valid artifact depending on a curve/algorithm pairing the schema never defines), at the key-publication layer.
Change
One
allOfrule —P-521 pairs with ES512— mirroring the existing P-256/P-384 rules exactly, plus P-521/ES512 added to thecrv/algexamples and thealg"MUST match" description. +10/−5, no reformatting.It is conditional well-formedness only: it constrains a P-521 key to
ES512when one is published; it does not require any party to support ES512. So it is orthogonal to whether ES512 stays AP2-scoped (#618) or becomes UCP-wide — either way, a P-521 key that is published should be correctly paired.Verification (
ucp-schema)alg-less P-521 key still validates (verifiers derive the algorithm fromcrv); P-256/P-384/OKP keys are unaffected.ucp-schema lint source/(96 files pass),validate_examples.py(276 passed, 0 failed), validator unit tests (43 passed), cspell clean.Relation to #618
This complements #618 rather than overlapping it — different file, no conflict. #618 documents the AP2 algorithm set and the alg↔curve binding in prose and pseudocode (including a P-521/ES512 JWK example); this makes that binding machine-enforced at the schema layer. I verified that #618's own example JWK validates against this rule, so the two land cleanly together. Happy to defer to @ShuoRen-TT and the maintainers on how to sequence or combine them.
Relates to #571.