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

Side by Side Diff: LayoutTests/crypto/rsa-export-key.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 </head>
7 <body>
8 <p id="description"></p>
9 <div id="console"></div>
10
11 <script>
12 description("Test exporting an RSA key.");
13
14 jsTestIsAsync = true;
15
16 var extractable = true;
17 var nonExtractable = false;
18
19 var publicKeyJSON = {
20 kty: "RSA",
21 alg: "RS256",
22 n: "rcCUCv7Oc1HVam1DIhCzqknThWawOp8QLk8Ziy2p10ByjQFCajoFiyuAWl-R1WXZaf4xitLR racT9agpzIzc-MbLSHIGgWQGO21lGiImy5ftZ-D8bHAqRz2y15pzD4c4CEou7XSSLDoRnR0QG5MsDhD6 s2gV9mwHkrtkCxtMWdBi-77as8wGmlNRldcOSgZDLK8UnCSgA1OguZ989bFyc8tOOEIb0xUSfPSz3LPS CnyYz68aDjmKVeNH-ig857OScyWbGyEy3Biw64qun3juUlNWsJ3zngkOdteYWytx5Qr4XKNs6R-Myyq7 2KUp02mJDZiiyiglxML_i3-_CeecCw",
23 e: "AQAB"
24 };
25
26 debug("\nImporting a JWK key...");
27 crypto.subtle.importKey("jwk", publicKeyJSON, {name: "RSASSA-PKCS1-v1_5", hash: {name: "sha-256"}}, extractable, ['verify']).then(function(result) {
28 key = result;
29
30 return crypto.subtle.exportKey(null, key);
31 }).then(failAndFinishJSTest, function(result) {
32 logError(result);
33 return crypto.subtle.exportKey(undefined, key);
34 }).then(failAndFinishJSTest, function(result) {
35 logError(result);
36 return crypto.subtle.exportKey({}, key);
37 }).then(failAndFinishJSTest, function(result) {
38 logError(result);
39 return crypto.subtle.exportKey("", key);
40 }).then(failAndFinishJSTest, function(result) {
41 logError(result);
42 return crypto.subtle.exportKey("foobar", key);
43 }).then(failAndFinishJSTest, function(result) {
44 logError(result);
45
46 debug("\nExporting the key as JWK...");
47 return crypto.subtle.exportKey("jwk", key);
48 }).then(function(result) {
49 exportedJWK = result;
50
51 shouldBe("exportedJWK.kty", "'RSA'");
52 shouldBe("exportedJWK.n", "publicKeyJSON.n");
53 shouldBe("exportedJWK.e", "publicKeyJSON.e");
54 shouldBe("exportedJWK.alg", "'RS256'");
55 shouldBe("exportedJWK.ext", "true");
56 shouldBe("exportedJWK.use", "undefined");
57 shouldBe("exportedJWK.key_ops", "['verify']");
58 }).then(finishJSTest, failAndFinishJSTest);
59 </script>
60
61 </body>
62 </html>
OLDNEW
« no previous file with comments | « LayoutTests/crypto/resources/worker-start-slow-operations.js ('k') | LayoutTests/crypto/rsa-export-key-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698