[jwe] Work with non X25519 ECDH encryption#1442
Merged
lestrrat merged 8 commits intodevelop/v3from Aug 15, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enables JWE (JSON Web Encryption) to work with non-X25519 ECDH encryption by adding support for ECDH keys using P-256, P-384, and P-521 curves. The implementation introduces a conversion mechanism between ECDH and ECDSA key formats to leverage existing ECDSA encryption functions.
- Adds ECDH to ECDSA key conversion functionality
- Modifies JWE encryption logic to handle ECDH keys for non-X25519 curves
- Includes comprehensive test coverage for the new functionality
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| internal/keyconv/keyconv.go | Implements ECDHToECDSA conversion function and curve mapping utilities |
| internal/keyconv/keyconv_test.go | Adds comprehensive tests for ECDH to ECDSA conversion functionality |
| jwe/encrypt.go | Updates encryption logic to handle ECDH keys by converting to ECDSA when needed |
| jwe/jwe_test.go | Adds basic test for ECDH key encryption/decryption |
| jwx_test.go | Adds comprehensive interoperability tests with jose for different ECDH curves |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
https://github.com/lestrrat-go/jwx/actions/runs/16959725199/job/48069344266 This test is not _that_ important.
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.
fixes #1434
This change introduces conversion from ECDH keys to ECDSA keys such that JWE encryption works for both types of raw keys.