Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(signature): move ES256K from the experimental package to the library (RFC 8812) - #736

Merged
Spomky merged 1 commit into
4.3.xfrom
feat/es256k-standard
Sep 13, 2026
Merged

feat(signature): move ES256K from the experimental package to the library (RFC 8812)#736
Spomky merged 1 commit into
4.3.xfrom
feat/es256k-standard

Conversation

@Spomky

@Spomky Spomky commented Sep 13, 2026

Copy link
Copy Markdown
Member

Closes #727 — the 4.3 half (preparation, no break). The 5.0.0 half — deleting Jose\Experimental\Signature\ES256K and its service — goes to #717.

What

ES256K (ECDSA over secp256k1 with SHA-256) has been registered by RFC 8812 since 2020 but was shipped in the experimental package.

  • Jose\Component\Signature\Algorithm\ES256K extends ECDSA, next to ES256. Not final — the deprecated experimental class extends it until 5.0.0, the same reason Jose\Unsecured\Signature\None is not final.
  • Jose\Experimental\Signature\ES256K becomes an empty @deprecated subclass with trigger_deprecation in the constructor (the None/RSA15 pattern). It is still an ECDSA and a SignatureAlgorithm, and now also an instance of the library class.
  • KoblitzCurve::secp256k1() (@internal): the SEC 2 parameters — no Curve object described secp256k1 so far, only OpenSSL knew it through its OID. Generator-on-curve and the RFC test key are asserted.
  • ES256KKeyAnalyzer on ESKeyAnalyzer, wired in the bundle.
  • Bundle: signature_ecdsa.php registers the library class under the ES256K alias; in signature_experimental.php the old FQCN's service is kept, untagged and ->deprecate()d, so that Jose\Experimental\Signature\ES256K $x still autowires. A DI alias to the new service would have produced a TypeError (the library class is not an instance of the subclass). The algorithm is instantiated once by the manager; the deprecation only fires for whoever injects the old class.

Acceptance criteria

  • RFC 8812 §3 sign/verify with the new FQCN through JWSBuilder/JWSVerifier, compact/flattened/general ✔; the two existing ES256K vectors pass unchanged after the namespace swap ✔ (tests/SignatureAlgorithm/ECDSA/ES256KSignatureTest.php, moved from Experimental/).
  • A service referencing the old FQCN still compiles and yields the same algorithm, with a deprecation at instantiation ✔ — DeprecatedES256KConsumer in the test bundle autowires the old class.
  • The ES256K alias of the algorithm manager is served by the library class ✔.

Backward compatibility

Reflection dump vs 4.3.x: additions only; the experimental class keeps its parents and interfaces. No behaviour change, one new deprecation.

QA

PHPUnit, ECS, Rector, Deptrac, PHPStan green; baseline +1 entry (constant access on the deprecated class in the config file, same pattern as None/RSA15/EdDSA).

Out of scope

The WebCrypto-only algorithms stay experimental; the secp256k1 PEM round-trip is documented, not fixed.

Documentation: web-token/jwt-doc.

…rary (RFC 8812)

ES256K - ECDSA over secp256k1 with SHA-256 - is registered by RFC 8812
since 2020, yet the library shipped it in the experimental package next
to the WebCrypto-only identifiers that have no RFC. The "Experimental"
label tells users the algorithm may change or go away; the RFC says the
opposite.

Jose\Component\Signature\Algorithm\ES256K now lives next to ES256, and
the bundle registers it under the same "ES256K" alias. The experimental
class survives until 5.0.0 as a deprecated subclass of the new one, its
constructor raising the deprecation, so that instantiating it or
type-hinting it keeps working; the library class is therefore not final,
as Jose\Unsecured\Signature\None is not for the same reason. In the
bundle the experimental service is kept, untagged and deprecated, for
the applications that inject the old class: an alias to the new service
would have handed them an object that is not an instance of the class
they ask for.

KoblitzCurve carries the secp256k1 parameters, which no Curve object
described so far - only OpenSSL knew the curve, through its OID - so
that ES256KKeyAnalyzer can check the keys the way the ES256 analyzer
does. The 5.0.0 step, recorded in #717, is the deletion of the
experimental class and its service.

Closes #727
@Spomky
Spomky force-pushed the feat/es256k-standard branch from 22b90d7 to e4ab903 Compare September 13, 2026 12:41
@Spomky Spomky self-assigned this Sep 13, 2026
@Spomky Spomky added this to the 4.3.0 milestone Sep 13, 2026
Spomky added a commit to web-token/jwt-doc that referenced this pull request Sep 13, 2026
…FC 8812) (#54)

web-token/jwt-framework#736 moves the algorithm to the library. The
algorithm and curve tables gain the standard entry, the signature
algorithms page a section with the "use" change and the secp256k1 PEM
limitation, the experimental table loses the row, and the 4.2 → 4.3
guide carries the entry and the deprecation line; two older mentions
of the experimental namespace are corrected.
@Spomky
Spomky merged commit e989bb9 into 4.3.x Sep 13, 2026
18 checks passed
@Spomky
Spomky deleted the feat/es256k-standard branch September 13, 2026 12:45
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.

refactor(signature): move ES256K out of the experimental package (RFC 8812)

1 participant