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

crypto: remove webcrypto EdDSA key checks and properties #1093

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions src/workerd/api/crypto-impl-asymmetric.c++
Original file line number Diff line number Diff line change
Expand Up @@ -1740,15 +1740,6 @@ kj::Own<EVP_PKEY> ellipticJwkReader(int curveId, SubtleCrypto::JsonWebKey&& keyD
"Missing field \"crv\" for ", curveName, " key.");
JSG_REQUIRE(crv == curveName, DOMNotSupportedError,
"Only ", curveName, " is supported but \"", crv, "\" was requested.");
KJ_IF_MAYBE(alg, keyDataJwk.alg) {
// If this JWK specifies an algorithm, make sure it jives with the hash we were passed via
// importKey().
if (curveId == NID_ED25519) {
JSG_REQUIRE(*alg == "EdDSA", DOMDataError,
"JSON Web Key Algorithm parameter \"alg\" (\"", *alg, "\") does not match requested "
"Ed25519 curve.");
}
}

auto x = UNWRAP_JWK_BIGNUM(kj::mv(keyDataJwk.x), DOMDataError,
"Invalid ", crv, " key in JSON WebKey; missing or invalid public key component (\"x\").");
Expand Down Expand Up @@ -2126,9 +2117,6 @@ private:
jwk.kty = kj::str("OKP");
jwk.crv = kj::str(getAlgorithmName() == "X25519"_kj ? "X25519"_kj : "Ed25519"_kj);
jwk.x = kj::encodeBase64Url(kj::arrayPtr(rawPublicKey, publicKeyLen));
if (getAlgorithmName() == "Ed25519"_kj) {
jwk.alg = kj::str("EdDSA");
}
Copy link
Member

Choose a reason for hiding this comment

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

There's a chance this could end up being a breaking change. Will need to determine if a compatibility flag is necessary on this particular bit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool, by all means please take this effort over, my hope here was merely to bring this to your attention ;)


if (getType() == "private"_kj) {
// Deliberately use ED25519_PUBLIC_KEY_LEN here.
Expand Down
Loading