Skip to content

Expose key material of EC JWKs again - #763

Merged
tsegismont merged 1 commit into
eclipse-vertx:masterfrom
SiteNetSoft:fix-jwk-ec-publickey
Aug 25, 2026
Merged

Expose key material of EC JWKs again#763
tsegismont merged 1 commit into
eclipse-vertx:masterfrom
SiteNetSoft:fix-jwk-ec-publickey

Conversation

@jnbdz

@jnbdz jnbdz commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

See #762

Regression from a9d1ad4: JWK.publicKey()/privateKey() now go through signingAlgorithm.unwrap(), but the anonymous EC wrapper created by JWK.wrapECAlgo(...) did not override unwrap(), so for every EC key (ES256/ES384/ES512/ES256K, from JSON JWK, PEM or keystore) the chain stopped at the wrapper and both accessors returned null. RSA/PS/EdDSA keys were unaffected because they are not wrapped.

Fix: the wrapper delegates unwrap() to the wrapped DigitalSigningAlgorithm (one method). Nothing else about the wrapper changes — signing/verification still convert between JWS R+S and ASN.1 as before.

Tests: JWKTest gains publicECExposesPublicKey, privateECExposesKeyPair, pemECExposesKeys (all failed before the fix) and pemRSAExposesPublicKey as a control. vertx-auth-common, vertx-auth-jwt and vertx-auth-oauth2 suites are green locally.

@tsegismont tsegismont left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks

Since a9d1ad4 JWK.publicKey()/privateKey() resolve the key through
signingAlgorithm.unwrap(). EC keys are wrapped by wrapECAlgo to convert
between JWS and ASN.1 signatures, and that wrapper did not override
unwrap(), so the chain stopped at the wrapper and both accessors returned
null for ES256/ES384/ES512/ES256K keys (JSON JWK, PEM and keystore alike).

The wrapper now delegates unwrap() to the wrapped algorithm. JWKTest gains
EC public/private (JSON and PEM) assertions with RSA as control.

Fixes eclipse-vertx#762
@tsegismont
tsegismont force-pushed the fix-jwk-ec-publickey branch from 0ab7d4b to 5132e4b Compare August 25, 2026 14:31
@tsegismont
tsegismont merged commit d461fd4 into eclipse-vertx:master Aug 25, 2026
6 checks passed
@tsegismont tsegismont added this to the 5.2.0 milestone Aug 25, 2026
tsegismont pushed a commit that referenced this pull request Aug 25, 2026
Since a9d1ad4 JWK.publicKey()/privateKey() resolve the key through
signingAlgorithm.unwrap(). EC keys are wrapped by wrapECAlgo to convert
between JWS and ASN.1 signatures, and that wrapper did not override
unwrap(), so the chain stopped at the wrapper and both accessors returned
null for ES256/ES384/ES512/ES256K keys (JSON JWK, PEM and keystore alike).

The wrapper now delegates unwrap() to the wrapped algorithm. JWKTest gains
EC public/private (JSON and PEM) assertions with RSA as control.

Fixes #762
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.

2 participants