58 lines
1.9 KiB
HTML
58 lines
1.9 KiB
HTML
<!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 exporting an AES key with malformed parameters");
|
|
|
|
jsTestIsAsync = true;
|
|
|
|
var extractable = true;
|
|
|
|
crypto.subtle.generateKey({name: "aes-cbc", length: 128}, extractable, ["decrypt", "encrypt", "unwrapKey", "wrapKey"]).then(function(result) {
|
|
key = result;
|
|
|
|
// Not support format.
|
|
return shouldReject('crypto.subtle.exportKey("spki", key)');
|
|
}).then(function() {
|
|
return shouldReject('crypto.subtle.exportKey("pkcs8", key)');
|
|
}).then(function() {
|
|
return crypto.subtle.generateKey({name: "aes-kw", length: 128}, extractable, ["unwrapKey", "wrapKey"]);
|
|
}).then(function(result) {
|
|
key = result;
|
|
|
|
// Not support format.
|
|
return shouldReject('crypto.subtle.exportKey("spki", key)');
|
|
}).then(function() {
|
|
return shouldReject('crypto.subtle.exportKey("pkcs8", key)');
|
|
}).then(function() {
|
|
return crypto.subtle.generateKey({name: "aes-cfb-8", length: 128}, extractable, ["decrypt", "encrypt", "unwrapKey", "wrapKey"]);
|
|
}).then(function(result) {
|
|
key = result;
|
|
|
|
// Not support format.
|
|
return shouldReject('crypto.subtle.exportKey("spki", key)');
|
|
}).then(function() {
|
|
return shouldReject('crypto.subtle.exportKey("pkcs8", key)');
|
|
}).then(function() {
|
|
return crypto.subtle.generateKey({name: "aes-gcm", length: 128}, extractable, ["decrypt", "encrypt", "unwrapKey", "wrapKey"]);
|
|
}).then(function(result) {
|
|
key = result;
|
|
|
|
// Not support format.
|
|
return shouldReject('crypto.subtle.exportKey("spki", key)');
|
|
}).then(function() {
|
|
return shouldReject('crypto.subtle.exportKey("pkcs8", key)');
|
|
}).then(finishJSTest, finishJSTest);
|
|
</script>
|
|
|
|
<script src="../../resources/js-test-post.js"></script>
|
|
</body>
|
|
</html>
|