Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Side by Side Diff: LayoutTests/crypto/rsa-oaep-encrypt-parseAlgorithm-failures.html

Issue 806913006: [WebCrypto] Move LayoutTests from crypto to crypto/subtle (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update path for deserialize legacy tests Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
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");
14
15 jsTestIsAsync = true;
16
17 var data = new Uint8Array(16);
18
19 function importPublicKey()
20 {
21 var usages = ['encrypt'];
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 }
29
30 Promise.resolve(null).then(function(result) {
31 return importPublicKey();
32 }).then(function(result) {
33 publicKey = result;
34
35 shouldEvaluateAs("publicKey.algorithm.name", "RSA-OAEP");
36 shouldEvaluateAs("publicKey.algorithm.hash.name", "SHA-256");
37 shouldEvaluateAs("publicKey.type", "public");
38 shouldEvaluateAs("publicKey.extractable", true);
39 shouldEvaluateAs("publicKey.usages.join(',')", "encrypt");
40
41 return crypto.subtle.encrypt({name: "rsa-oaep", label: -1}, publicKey, data) ;
42 }).then(failAndFinishJSTest, function(result) {
43 logError(result);
44
45 return crypto.subtle.encrypt({name: "rsa-oaep", label: "foo"}, publicKey, da ta);
46 }).then(failAndFinishJSTest, function(result) {
47 logError(result);
48 }).then(finishJSTest, failAndFinishJSTest);
49
50 </script>
51
52 </body>
53 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698