Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / crypto / subtle / rsa-export-key.html
blob94d00f3717d133e74567b976e10e70088742fd97
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>
11 <script>
12 description("Test exporting an RSA key.");
14 jsTestIsAsync = true;
16 var extractable = true;
17 var nonExtractable = false;
19 var publicKeyJSON = {
20 kty: "RSA",
21 alg: "RS256",
22 n: "rcCUCv7Oc1HVam1DIhCzqknThWawOp8QLk8Ziy2p10ByjQFCajoFiyuAWl-R1WXZaf4xitLRracT9agpzIzc-MbLSHIGgWQGO21lGiImy5ftZ-D8bHAqRz2y15pzD4c4CEou7XSSLDoRnR0QG5MsDhD6s2gV9mwHkrtkCxtMWdBi-77as8wGmlNRldcOSgZDLK8UnCSgA1OguZ989bFyc8tOOEIb0xUSfPSz3LPSCnyYz68aDjmKVeNH-ig857OScyWbGyEy3Biw64qun3juUlNWsJ3zngkOdteYWytx5Qr4XKNs6R-Myyq72KUp02mJDZiiyiglxML_i3-_CeecCw",
23 e: "AQAB"
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;
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);
46 debug("\nExporting the key as JWK...");
47 return crypto.subtle.exportKey("jwk", key);
48 }).then(function(result) {
49 exportedJWK = result;
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>
61 </body>
62 </html>