Index: LayoutTests/crypto/aes-cbc-importKey-badUsage.html |
diff --git a/LayoutTests/crypto/aes-cbc-importKey-badUsage.html b/LayoutTests/crypto/aes-cbc-importKey-badUsage.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..51c4d1a1f3d2388bad9cf5a7c67f48bdae9fe530 |
--- /dev/null |
+++ b/LayoutTests/crypto/aes-cbc-importKey-badUsage.html |
@@ -0,0 +1,36 @@ |
+<!DOCTYPE html> |
+<html> |
+<head> |
+<script src="../resources/js-test.js"></script> |
+<script src="resources/common.js"></script> |
+</head> |
+<body> |
+<p id="description"></p> |
+<div id="console"></div> |
+ |
+<script> |
+description("Importing an AES-CBC key with 'sign' usage is not allowed."); |
+ |
+jsTestIsAsync = true; |
+ |
+function importTestKey(usage) |
+{ |
+ var algorithm = {name: 'aes-cbc'}; |
+ var extractable = false; |
+ var keyData = new Uint8Array(16); |
+ |
+ // 'sign' is not applicable to AES-CBC and should be an error. |
+ var usages = ["encrypt", "decrypt", "sign"]; |
+ |
+ return crypto.subtle.importKey('raw', keyData, algorithm, extractable, usages).then(failAndFinishJSTest, function(result) { |
+ debug("Failed importing AES-CBC key with usages: " + usages.join(",") + " because: "); |
+ logError(result); |
+ }); |
+} |
+ |
+importTestKey().then(finishJSTest, failAndFinishJSTest); |
+ |
+</script> |
+ |
+</body> |
+</html> |