Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable standalone ACCP Ed25519 #438

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

WillChilds-Klein
Copy link
Contributor

@WillChilds-Klein WillChilds-Klein commented Mar 6, 2025

Issue #, if available:

Description of changes:

Notes

PR #394 deliberately coupled ACCP's Ed25519 key generation to SunEC's KeyFactory in the hopes of increasing compatibility. However, this also prevents the use of Ed25519 in standalone ACCP. This PR provides a fallback mechanism to allow Ed25519 keys to be generated by standalone ACCP without relying on SunEC. If SunEC has a relevant KeyFactory registered, the old behavior is retained for backwards compatibility.

Conveniently, this fallback mechanism also allows us to provide Ed25519 support on JDK versions < 15.

Testing

We add a test that de- and re-registers default providers to prove Ed25519 signatures can be performed by standalone ACCP with an empty JCA registry.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@WillChilds-Klein WillChilds-Klein changed the title Remove SunEC de/ser roundtrip from Ed25519 keygen [DRAFT] Remove SunEC de/ser roundtrip from Ed25519 keygen Mar 6, 2025
@WillChilds-Klein WillChilds-Klein changed the title [DRAFT] Remove SunEC de/ser roundtrip from Ed25519 keygen Remove SunEC de/ser roundtrip from Ed25519 keygen Mar 7, 2025
@WillChilds-Klein WillChilds-Klein changed the title Remove SunEC de/ser roundtrip from Ed25519 keygen Enable standalone ACCP Ed25519 Mar 7, 2025
@WillChilds-Klein WillChilds-Klein marked this pull request as ready for review March 7, 2025 20:14
@WillChilds-Klein WillChilds-Klein requested a review from a team as a code owner March 7, 2025 20:14
geedo0
geedo0 previously approved these changes Mar 7, 2025
@@ -87,10 +87,12 @@ public static void setupParameters() throws Exception {

for (String algorithm : ALGORITHMS) {
KeyPairGenerator kpg;
if (algorithm.startsWith("ML-DSA")) {
if (algorithm.startsWith("ML-DSA")
|| (algorithm.startsWith("Ed") && TestUtil.getJavaVersion() < 15)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Bit of code smell here, I'm paranoid that matching on startsWith("Ed") is a bit too general.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is very fair. Since it's a maintainability issue and not a correctness issue, I'll do a follow-up PR to match algorithm more precisely.

Copy link
Contributor

@alexw91 alexw91 left a comment

Choose a reason for hiding this comment

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

Two nits. Otherwise LGTM.

@WillChilds-Klein WillChilds-Klein enabled auto-merge (squash) March 7, 2025 23:24
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.

4 participants