diff options
| author | Divy Srivastava <dj.srivastava23@gmail.com> | 2021-09-12 02:19:53 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-11 16:49:53 -0400 |
| commit | 40c63d1255642b8d70d7b5ce5b85a50f6af8a00d (patch) | |
| tree | abdfe6e1df461b3d8106fc3c75a7c879cd9381a2 /ext/crypto/00_crypto.js | |
| parent | d236f432b86de55c6006778b0c68fe60b6419069 (diff) | |
feat(ext/crypto): verify ECDSA signatures (#11739)
Diffstat (limited to 'ext/crypto/00_crypto.js')
| -rw-r--r-- | ext/crypto/00_crypto.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/ext/crypto/00_crypto.js b/ext/crypto/00_crypto.js index a95c0be1b..0e5a511e5 100644 --- a/ext/crypto/00_crypto.js +++ b/ext/crypto/00_crypto.js @@ -92,6 +92,7 @@ "verify": { "RSASSA-PKCS1-v1_5": null, "RSA-PSS": "RsaPssParams", + "ECDSA": "EcdsaParams", "HMAC": null, }, "importKey": { @@ -1185,6 +1186,25 @@ signature, }, data); } + case "ECDSA": { + // 1. + if (key[_type] !== "public") { + throw new DOMException( + "Key type not supported", + "InvalidAccessError", + ); + } + // 2. + const hash = normalizedAlgorithm.hash.name; + // 3-8. + return await core.opAsync("op_crypto_verify_key", { + key: keyData, + algorithm: "ECDSA", + hash, + signature, + namedCurve: key[_algorithm].namedCurve, + }, data); + } } throw new TypeError("unreachable"); |
