From 71f79097c69958ba94e8600430394bbb21fa90f3 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Sat, 14 Aug 2021 02:50:44 +0530 Subject: fix(ext/crypto): importKey() SecurityError on non-extractable keys (#11662) Co-authored-by: Luca Casonato --- ext/crypto/00_crypto.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ext/crypto/00_crypto.js') diff --git a/ext/crypto/00_crypto.js b/ext/crypto/00_crypto.js index b341aabe7..c3107c288 100644 --- a/ext/crypto/00_crypto.js +++ b/ext/crypto/00_crypto.js @@ -491,6 +491,14 @@ throw new DOMException("Invalid key usages", "SyntaxError"); } + // https://github.com/denoland/deno/pull/9614#issuecomment-866049433 + if (!extractable) { + throw new DOMException( + "Non-extractable keys are not supported", + "SecurityError", + ); + } + switch (normalizedAlgorithm.name) { // https://w3c.github.io/webcrypto/#hmac-operations case "HMAC": { -- cgit v1.2.3