4 <script src=
"../../../resources/js-test.js"></script>
5 <script src=
"../resources/common.js"></script>
8 <p id=
"description"></p>
9 <div id=
"console"></div>
12 description("Test unwrapping an RSA key with AES-CBC.");
16 var extractable
= true;
17 var nonExtractable
= false;
19 var unwrappingKeyOctets
= hexStringToUint8Array("2a00e0e776e94e4dc89bf947cebdebe1");
20 var wrappedKey
= hexStringToUint8Array("b490dedb3abc3fd545e146538e6cc3ca"); // An empty encrypted JSON.
22 debug("Importing an unwrapping key...");
23 crypto
.subtle
.importKey("raw", unwrappingKeyOctets
, {name
: "AES-CBC"}, nonExtractable
, ["unwrapKey"]).then(function(result
) {
24 unwrappingKey
= result
;
25 shouldBe("unwrappingKey.algorithm.name", "'AES-CBC'");
26 var unwrapAlgorithm
= {name
: "AES-CBC", iv
: hexStringToUint8Array("000102030405060708090a0b0c0d0e0f")};
27 debug("Unwrapping a key...");
28 var importAlgorithm
= {name
: 'RSASSA-PKCS1-v1_5', hash
: {name
: 'sha-1'} };
29 return crypto
.subtle
.unwrapKey("jwk", wrappedKey
, unwrappingKey
, unwrapAlgorithm
, importAlgorithm
, extractable
, ["sign"]);
30 }).then(undefined, function(result
) {
33 }).then(finishJSTest
, failAndFinishJSTest
);