| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../resources/js-test-pre.js"></script> |
| <script src="../resources/common.js"></script> |
| </head> |
| <body> |
| <p id="description"></p> |
| <div id="console"></div> |
| |
| <script> |
| description("Test decrypting using AES-GCM with malformed parameters"); |
| |
| jsTestIsAsync = true; |
| |
| var extractable = false; |
| var smallCipherText = hexStringToUint8Array("f9"); |
| var corruptedCipherText = hexStringToUint8Array("f9ba1161a16c9fcc726a4531c1b520925e4ba35f8b534c62f34e1f3ba0"); |
| var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr"); |
| |
| crypto.subtle.importKey("raw", rawKey, "aes-gcm", extractable, ["decrypt"]).then(function(result) { |
| key = result; |
| |
| // Small cipher text |
| shouldReject('crypto.subtle.decrypt({name: "aes-gcm", iv: asciiToUint8Array("jnOw99oOZFLIEPMrd")}, key, smallCipherText)'); |
| |
| // Corrupted cipher text |
| return shouldReject('crypto.subtle.decrypt({name: "aes-gcm", iv: asciiToUint8Array("jnOw99oOZFLIEPMrd")}, key, corruptedCipherText)'); |
| }).then(finishJSTest); |
| |
| </script> |
| |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |