| <script src="../../resources/js-test-pre.js"></script> |
| <script src="resources/common.js"></script> |
| description("Test unwrapping an RSA key with AES-CBC."); |
| var nonExtractable = false; |
| var unwrappingKeyOctets = hexStringToUint8Array("2a00e0e776e94e4dc89bf947cebdebe1"); |
| var wrappedKey = hexStringToUint8Array("b490dedb3abc3fd545e146538e6cc3ca"); // An empty encrypted JSON. |
| debug("Importing an unwrapping key..."); |
| crypto.subtle.importKey("raw", unwrappingKeyOctets, "AES-CBC", nonExtractable, ["unwrapKey"]).then(function(result) { |
| shouldBe("unwrappingKey.algorithm.name", "'AES-CBC'"); |
| var unwrapAlgorithm = {name: "AES-CBC", iv: hexStringToUint8Array("000102030405060708090a0b0c0d0e0f")}; |
| debug("Unwrapping a key..."); |
| return crypto.subtle.unwrapKey("jwk", wrappedKey, unwrappingKey, unwrapAlgorithm, null, extractable, ["sign", "verify", "encrypt", "decrypt", "wrap", "unwrap"]); |
| }).then(undefined, function(result) { |
| testPassed("Promise rejected"); |
| <script src="../../resources/js-test-post.js"></script> |