feat(ext/node): add more named curves in crypto.generateKeyPair[Sync]() (#22882)

Towards fixing #21761
This commit is contained in:
Asher Gomez 2024-03-13 17:44:51 +11:00 committed by GitHub
parent f50678b4f3
commit 6e6c316c9d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 3 deletions

View File

@ -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")),
};

View File

@ -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() {