| <script src="../../resources/js-test-pre.js"></script> |
| <script src="../resources/common.js"></script> |
| description("Test unwrapping a raw key with AES-CTR using an imported key"); |
| var expectedRawKey = "jnOw99oOZFLIEPMr"; |
| var rawKey = asciiToUint8Array(expectedRawKey); |
| counter: asciiToUint8Array("jnOw99oOZFLIEPMr"), |
| var wrappedKey = hexStringToUint8Array("87f263f262139ba5ae4738cb37cce383"); |
| crypto.subtle.importKey("raw", rawKey, "aes-ctr", extractable, ["unwrapKey"]).then(function(unwrappingKey) { |
| return crypto.subtle.unwrapKey("raw", wrappedKey, unwrappingKey, aesCtrParams, {name: "aes-cbc"}, extractable, ["encrypt"]); |
| }).then(function(cryptoKey) { |
| return crypto.subtle.exportKey("raw", cryptoKey); |
| }).then(function(result) { |
| shouldBe("bytesToASCIIString(unwrappedKey)", "expectedRawKey"); |
| <script src="../../resources/js-test-post.js"></script> |