blob: 0ee607122bfbee2362d9a8a058bf0f34fe019a81 [file] [log] [blame]
jiewen_tan@apple.comcc566de2017-03-03 04:24:14 +00001<!DOCTYPE html>
2<html>
3<head>
4<script src="../../resources/js-test-pre.js"></script>
5<script src="../resources/common.js"></script>
6</head>
7<body>
8<p id="description"></p>
9<div id="console"></div>
10
11<script>
12description("Test decrypting using AES-GCM with malformed parameters");
13
14jsTestIsAsync = true;
15
16var extractable = false;
17var smallCipherText = hexStringToUint8Array("f9");
18var corruptedCipherText = hexStringToUint8Array("f9ba1161a16c9fcc726a4531c1b520925e4ba35f8b534c62f34e1f3ba0");
19var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
20
21crypto.subtle.importKey("raw", rawKey, "aes-gcm", extractable, ["decrypt"]).then(function(result) {
22 key = result;
23
24 // Small cipher text
25 shouldReject('crypto.subtle.decrypt({name: "aes-gcm", iv: asciiToUint8Array("jnOw99oOZFLIEPMrd")}, key, smallCipherText)');
26
27 // Corrupted cipher text
28 return shouldReject('crypto.subtle.decrypt({name: "aes-gcm", iv: asciiToUint8Array("jnOw99oOZFLIEPMrd")}, key, corruptedCipherText)');
29}).then(finishJSTest);
30
31</script>
32
33<script src="../../resources/js-test-post.js"></script>
34</body>
35</html>