summaryrefslogtreecommitdiff
path: root/ext/crypto/00_crypto.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/crypto/00_crypto.js')
-rw-r--r--ext/crypto/00_crypto.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/ext/crypto/00_crypto.js b/ext/crypto/00_crypto.js
index 7bc62714f..417281068 100644
--- a/ext/crypto/00_crypto.js
+++ b/ext/crypto/00_crypto.js
@@ -827,6 +827,18 @@ class SubtleCrypto {
throw new DOMException("Curve not supported", "NotSupportedError");
}
+ if (
+ (key[_algorithm].namedCurve === "P-256" &&
+ hashAlgorithm !== "SHA-256") ||
+ (key[_algorithm].namedCurve === "P-384" &&
+ hashAlgorithm !== "SHA-384")
+ ) {
+ throw new DOMException(
+ "Not implemented",
+ "NotSupportedError",
+ );
+ }
+
const signature = await core.opAsync("op_crypto_sign_key", {
key: keyData,
algorithm: "ECDSA",
@@ -1331,6 +1343,16 @@ class SubtleCrypto {
// 2.
const hash = normalizedAlgorithm.hash.name;
+ if (
+ (key[_algorithm].namedCurve === "P-256" && hash !== "SHA-256") ||
+ (key[_algorithm].namedCurve === "P-384" && hash !== "SHA-384")
+ ) {
+ throw new DOMException(
+ "Not implemented",
+ "NotSupportedError",
+ );
+ }
+
// 3-8.
return await core.opAsync("op_crypto_verify_key", {
key: keyData,