| Index: LayoutTests/crypto/aes-cbc-wrap-rsa-non-extractable.html
|
| diff --git a/LayoutTests/crypto/aes-cbc-wrap-rsa-non-extractable.html b/LayoutTests/crypto/aes-cbc-wrap-rsa-non-extractable.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..55fa4089c521d0a2f6d30fc960b734256cbcf0d5
|
| --- /dev/null
|
| +++ b/LayoutTests/crypto/aes-cbc-wrap-rsa-non-extractable.html
|
| @@ -0,0 +1,52 @@
|
| +<!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("Test wrapping an RSA key with AES-CBC.");
|
| +
|
| +jsTestIsAsync = true;
|
| +
|
| +var extractable = true;
|
| +var nonExtractable = false;
|
| +
|
| +var publicKeyJSON = {
|
| + kty: "RSA",
|
| + alg: "RS256",
|
| + n: "rcCUCv7Oc1HVam1DIhCzqknThWawOp8QLk8Ziy2p10ByjQFCajoFiyuAWl-R1WXZaf4xitLRracT9agpzIzc-MbLSHIGgWQGO21lGiImy5ftZ-D8bHAqRz2y15pzD4c4CEou7XSSLDoRnR0QG5MsDhD6s2gV9mwHkrtkCxtMWdBi-77as8wGmlNRldcOSgZDLK8UnCSgA1OguZ989bFyc8tOOEIb0xUSfPSz3LPSCnyYz68aDjmKVeNH-ig857OScyWbGyEy3Biw64qun3juUlNWsJ3zngkOdteYWytx5Qr4XKNs6R-Myyq72KUp02mJDZiiyiglxML_i3-_CeecCw",
|
| + e: "AQAB",
|
| + ext: false,
|
| + use: "sig"
|
| +};
|
| +
|
| +var jwkKeyAsArrayBuffer = asciiToUint8Array(JSON.stringify(publicKeyJSON));
|
| +var wrappingKeyOctets = hexStringToUint8Array("2a00e0e776e94e4dc89bf947cebdebe1");
|
| +
|
| +debug("Importing a key to wrap...");
|
| +
|
| +var importAlgorithm = {name: 'RSASSA-PKCS1-v1_5', hash: {name: 'sha-256'} };
|
| +crypto.subtle.importKey("jwk", jwkKeyAsArrayBuffer, importAlgorithm, nonExtractable, ["verify"]).then(function(result) {
|
| + key = result;
|
| + shouldBe("key.algorithm.name", "'RSASSA-PKCS1-v1_5'");
|
| + debug("Importing a key encryption key...");
|
| + return crypto.subtle.importKey("raw", wrappingKeyOctets, {name: "AES-CBC"}, nonExtractable, ["wrapKey"]);
|
| +}).then(function(result) {
|
| + wrappingKey = result;
|
| + shouldBe("wrappingKey.algorithm.name", "'AES-CBC'");
|
| + var wrapAlgorithm = {name: "AES-CBC", iv: hexStringToUint8Array("000102030405060708090a0b0c0d0e0f")};
|
| + debug("wrapping the key...");
|
| + return crypto.subtle.wrapKey("jwk", key, wrappingKey, wrapAlgorithm);
|
| +}).then(undefined, function(result) {
|
| + testPassed("Rejected: " + result);
|
| +}).then(finishJSTest, failAndFinishJSTest);
|
| +
|
| +</script>
|
| +
|
| +</body>
|
| +</html>
|
|
|