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

Document that Safari generates randomized Ed25519 signatures #24462

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

twiss
Copy link

@twiss twiss commented Sep 17, 2024

Summary

Document the fact that for the Ed25519 algorithm in Web Crypto's crypto.subtle.sign function, Safari generates randomized signatures as per draft-irtf-cfrg-det-sigs-with-noise, instead of deterministic signatures as per RFC 8032.

There is a discussion in WICG/webcrypto-secure-curves#28 to make this behavior legal, but as of now it isn't (although in most cases it shouldn't cause interoperability issues). Additionally, even if this becomes legal as per the Web Crypto spec, it may still be noteworthy for developers who (for some reason) require the deterministic behavior of Ed25519 as specified in RFC 8032.

Test results and supporting details

This behavior can be confirmed by running

const { privateKey } = await crypto.subtle.generateKey('Ed25519', false, ['sign']);
console.log(new Uint8Array(await crypto.subtle.sign('Ed25519', privateKey, new ArrayBuffer())));
console.log(new Uint8Array(await crypto.subtle.sign('Ed25519', privateKey, new ArrayBuffer())));

In deterministic implementations, both signatures will be identical. In randomized implementations, they'll be different. I tested desktop and mobile Safari 17 and 18 and all of them implement the randomized variant.

Related issues

Relevant WebKit issue: https://bugs.webkit.org/show_bug.cgi?id=262499.

@github-actions github-actions bot added the data:api 🐇 Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API label Sep 17, 2024
@twiss
Copy link
Author

twiss commented Sep 18, 2024

@hamishwillee perhaps you're the right person to ask for a review for this? ☺️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:api 🐇 Compat data for Web APIs. https://developer.mozilla.org/docs/Web/API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant