summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/node/ops/crypto/mod.rs8
-rw-r--r--tests/unit_node/crypto/crypto_key_test.ts11
2 files changed, 16 insertions, 3 deletions
diff --git a/ext/node/ops/crypto/mod.rs b/ext/node/ops/crypto/mod.rs
index 39d6b8bd5..8db562eef 100644
--- a/ext/node/ops/crypto/mod.rs
+++ b/ext/node/ops/crypto/mod.rs
@@ -707,8 +707,12 @@ fn ec_generate(
use ring::signature::KeyPair;
let curve = match named_curve {
- "P-256" => &ring::signature::ECDSA_P256_SHA256_FIXED_SIGNING,
- "P-384" => &ring::signature::ECDSA_P384_SHA384_FIXED_SIGNING,
+ "P-256" | "prime256v1" | "secp256r1" => {
+ &ring::signature::ECDSA_P256_SHA256_FIXED_SIGNING
+ }
+ "P-384" | "prime384v1" | "secp384r1" => {
+ &ring::signature::ECDSA_P384_SHA384_FIXED_SIGNING
+ }
_ => return Err(type_error("Unsupported named curve")),
};
diff --git a/tests/unit_node/crypto/crypto_key_test.ts b/tests/unit_node/crypto/crypto_key_test.ts
index c8724d284..6dae79336 100644
--- a/tests/unit_node/crypto/crypto_key_test.ts
+++ b/tests/unit_node/crypto/crypto_key_test.ts
@@ -106,7 +106,16 @@ for (const type of ["rsa", "rsa-pss", "dsa"]) {
}
}
-for (const namedCurve of ["P-384", "P-256"]) {
+for (
+ const namedCurve of [
+ "P-384",
+ "prime384v1",
+ "secp384r1",
+ "P-256",
+ "prime256v1",
+ "secp256r1",
+ ]
+) {
Deno.test({
name: `generate ec key ${namedCurve}`,
fn() {