blob: 75b672ed1d05e58da59d5ebc9734f15528a774c3 [file] [log] [blame]
importScripts('../../../../resources/js-test-pre.js');
importScripts("../../../resources/common.js");
description("Test importing a raw AES key using AES-CBC algorithm in workers.");
jsTestIsAsync = true;
var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
var extractable = true;
shouldReject('crypto.subtle.importKey("raw", asciiToUint8Array("jnOw97"), "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])');
debug("Importing a key...");
crypto.subtle.importKey("raw", rawKey, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]).then(function(result) {
key = result;
shouldBe("key.type", "'secret'");
shouldBe("key.extractable", "true");
shouldBe("key.algorithm.name", "'AES-CBC'");
shouldBe("key.algorithm.length", "128");
shouldBe("key.usages", "['decrypt', 'encrypt', 'unwrapKey', 'wrapKey']");
finishJSTest();
});