OLD | NEW |
---|---|
(Empty) | |
1 <!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
| |
2 <html> | |
3 <head> | |
4 <script src="../resources/js-test.js"></script> | |
5 <script src="resources/common.js"></script> | |
6 <script src="resources/keys.js"></script> | |
7 </head> | |
8 <body> | |
9 <p id="description"></p> | |
10 <div id="console"></div> | |
11 | |
12 <script> | |
13 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
| |
14 | |
15 jsTestIsAsync = true; | |
16 | |
17 | |
18 var data = new Uint8Array(16); | |
19 | |
20 Promise.resolve(null).then(function(result) { | |
21 var usages = ['encrypt', 'decrypt']; | |
22 var extractable = true; | |
23 | |
24 var importData = hexStringToUint8Array(kKeyData.rsa1.spki); | |
25 var importAlgorithm = { name: 'rsa-oaep', hash: {name: 'SHA-256'} }; | |
26 | |
27 return crypto.subtle.importKey('spki', importData, importAlgorithm, extracta ble, usages); | |
28 }).then(function(result) { | |
29 key = result; | |
30 | |
31 shouldEvaluateAs("key.algorithm.name", "RSA-OAEP"); | |
32 shouldEvaluateAs("key.algorithm.hash.name", "SHA-256"); | |
33 shouldEvaluateAs("key.type", "public"); | |
34 shouldEvaluateAs("key.extractable", true); | |
35 shouldEvaluateAs("key.usages.join(',')", "encrypt,decrypt"); | |
36 | |
37 return crypto.subtle.encrypt({name: "rsa-oaep", label: -1}, key, data); | |
38 }).then(failAndFinishJSTest, function(result) { | |
39 logError(result); | |
40 | |
41 return crypto.subtle.encrypt({name: "rsa-oaep", label: "foo"}, key, data); | |
42 }).then(failAndFinishJSTest, function(result) { | |
43 logError(result); | |
44 | |
45 return crypto.subtle.decrypt({name: "rsa-oaep", label: -1}, key, data); | |
46 }).then(failAndFinishJSTest, function(result) { | |
47 logError(result); | |
48 | |
49 return crypto.subtle.decrypt({name: "rsa-oaep", label: "foo"}, key, data); | |
50 }).then(failAndFinishJSTest, function(result) { | |
51 logError(result); | |
52 }).then(finishJSTest, failAndFinishJSTest); | |
53 | |
54 </script> | |
55 | |
56 </body> | |
57 </html> | |
OLD | NEW |