Chromium Code Reviews| Index: LayoutTests/crypto/rsa-oaep-parseAlgorithmFailures.html |
| diff --git a/LayoutTests/crypto/rsa-oaep-parseAlgorithmFailures.html b/LayoutTests/crypto/rsa-oaep-parseAlgorithmFailures.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..81e873cbf69bc3434e5a0e63bbe639cd5413e90e |
| --- /dev/null |
| +++ b/LayoutTests/crypto/rsa-oaep-parseAlgorithmFailures.html |
| @@ -0,0 +1,57 @@ |
| +<!DOCTYPE html> |
|
jww
2014/05/21 15:04:22
nit: Name of this file doesn't match others in thi
eroman
2014/05/21 17:46:33
Done. Renamed to:
rsa-oaep-encrypt-parseAlgorit
|
| +<html> |
| +<head> |
| +<script src="../resources/js-test.js"></script> |
| +<script src="resources/common.js"></script> |
| +<script src="resources/keys.js"></script> |
| +</head> |
| +<body> |
| +<p id="description"></p> |
| +<div id="console"></div> |
| + |
| +<script> |
| +description("Tests bad algorithm inputs for RSA-OAEP encrypt/decrypt"); |
|
jww
2014/05/21 15:04:22
Seems like there's no tests here to validate key g
eroman
2014/05/21 17:46:33
Done. Added:
rsa-oaep-generateKey-parseAlgorith
|
| + |
| +jsTestIsAsync = true; |
| + |
| + |
| +var data = new Uint8Array(16); |
| + |
| +Promise.resolve(null).then(function(result) { |
| + var usages = ['encrypt', 'decrypt']; |
| + var extractable = true; |
| + |
| + var importData = hexStringToUint8Array(kKeyData.rsa1.spki); |
| + var importAlgorithm = { name: 'rsa-oaep', hash: {name: 'SHA-256'} }; |
| + |
| + return crypto.subtle.importKey('spki', importData, importAlgorithm, extractable, usages); |
| +}).then(function(result) { |
| + key = result; |
| + |
| + shouldEvaluateAs("key.algorithm.name", "RSA-OAEP"); |
| + shouldEvaluateAs("key.algorithm.hash.name", "SHA-256"); |
| + shouldEvaluateAs("key.type", "public"); |
| + shouldEvaluateAs("key.extractable", true); |
| + shouldEvaluateAs("key.usages.join(',')", "encrypt,decrypt"); |
| + |
| + return crypto.subtle.encrypt({name: "rsa-oaep", label: -1}, key, data); |
| +}).then(failAndFinishJSTest, function(result) { |
| + logError(result); |
| + |
| + return crypto.subtle.encrypt({name: "rsa-oaep", label: "foo"}, key, data); |
| +}).then(failAndFinishJSTest, function(result) { |
| + logError(result); |
| + |
| + return crypto.subtle.decrypt({name: "rsa-oaep", label: -1}, key, data); |
| +}).then(failAndFinishJSTest, function(result) { |
| + logError(result); |
| + |
| + return crypto.subtle.decrypt({name: "rsa-oaep", label: "foo"}, key, data); |
| +}).then(failAndFinishJSTest, function(result) { |
| + logError(result); |
| +}).then(finishJSTest, failAndFinishJSTest); |
| + |
| +</script> |
| + |
| +</body> |
| +</html> |