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

Side by Side Diff: LayoutTests/crypto/rsa-export-private-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 a private RSA key.");
13
14 jsTestIsAsync = true;
15
16 var extractable = true;
17 var nonExtractable = false;
18
19 // Example from JWK specification.
20 var privateKeyJSON = {
21 "kty":"RSA",
22 "n":"0vx7agoebGcQSuuPiLJXZptN9nndrQmbXEps2aiAFbWhM78LhWx4cbbfAAtVT86zwu1RK7a PFFxuhDR1L6tSoc_BJECPebWKRXjBZCiFV4n3oknjhMstn64tZ_2W-5JsGY4Hc5n9yBXArwl93lqt7_R N5w6Cf0h4QyQ5v-65YGjQR0_FDW2QvzqY368QQMicAtaSqzs8KJZgnYb9c7d0zgdAZHzu6qMQvRL5haj rn1n91CbOpbISD08qNLyrdkt-bFTWhAI4vMQFh6WeZu0fM4lFd2NcRwr3XPksINHaQ-G_xBniIqbw0Ls 1jF44-csFCur-kEgU8awapJzKnqDKgw",
23 "e":"AQAB",
24 "d":"X4cTteJY_gn4FYPsXB8rdXix5vwsg1FLN5E3EaG6RJoVH-HLLKD9M7dx5oo7GURknchnrRw eUkC7hT5fJLM0WbFAKNLWY2vv7B6NqXSzUvxT0_YSfqijwp3RTzlBaCxWp4doFk5N2o8Gy_nHNKroADI kJ46pRUohsXywbReAdYaMwFs9tv8d_cPVY3i07a3t8MN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
32 }
33
34 debug("\nImporting a JWK key...");
35 crypto.subtle.importKey("jwk", privateKeyJSON, {name: "RSASSA-PKCS1-v1_5", hash: {name: "sha-256"}}, extractable, ['sign']).then(function(result) {
36 key = result;
37
38 debug("\nExporting the key as JWK...");
39 return crypto.subtle.exportKey("jwk", key);
40 }).then(function(result) {
41 exportedJWK = result;
42
43 shouldBe("exportedJWK.kty", "'RSA'");
44 shouldBe("exportedJWK.n", "privateKeyJSON.n");
45 shouldBe("exportedJWK.e", "privateKeyJSON.e");
46 shouldBe("exportedJWK.d", "privateKeyJSON.d");
47 shouldBe("exportedJWK.p", "privateKeyJSON.p");
48 shouldBe("exportedJWK.q", "privateKeyJSON.q");
49 shouldBe("exportedJWK.dp", "privateKeyJSON.dp");
50 shouldBe("exportedJWK.dq", "privateKeyJSON.dq");
51 shouldBe("exportedJWK.qi", "privateKeyJSON.qi");
52 shouldBe("exportedJWK.oth", "privateKeyJSON.oth");
53 shouldBe("exportedJWK.alg", "privateKeyJSON.alg");
54 shouldBe("exportedJWK.ext", "true");
55 shouldBe("exportedJWK.key_ops", "['sign']");
56 shouldBe("exportedJWK.use", "undefined");
57 }).then(finishJSTest, failAndFinishJSTest);
58
59 </script>
60
61 </body>
62 </html>
OLDNEW
« no previous file with comments | « LayoutTests/crypto/rsa-export-key-expected.txt ('k') | LayoutTests/crypto/rsa-export-private-key-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698