Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / crypto / subtle / ec-export-private-key.html
blobbf4b9b6e86429b5a3720cd86d66830123a6450ce
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 a private RSA key.");
14 jsTestIsAsync = true;
16 var extractable = true;
18 var privateKeyPkcs8Hex = "3081B6020100301006072A8648CE3D020106052B8104002204819E30819B0201010430A492CE8FA90084C227E1A32F7974D39E9FF67A7E8705EC3419B35FB607582BEBD461E0B1520AC76EC2DD4E9B63EBAE71A16403620004E55FEE6C49D8D523F5CE7BF9C0425CE4FF650708B7DE5CFB095901523979A7F042602DB30854735369813B5C3F5EF86828F59CC5DC509892A988D38A8E2519DE3D0C4FD0FBDB0993E38F18506C17606C5E24249246F1CE94983A5361C5BE983E";
20 debug("\nImporting a PKCS8 key...");
21 crypto.subtle.importKey("pkcs8", hexStringToUint8Array(privateKeyPkcs8Hex), {name: "ECDSA", namedCurve: "P-384" }, extractable, ['sign']).then(function(result) {
22 key = result;
24 debug("\nExporting the key as JWK...");
25 return crypto.subtle.exportKey("jwk", key);
26 }).then(function(result) {
27 exportedJWK = result;
29 shouldEvaluateAs("exportedJWK.kty", "EC");
30 shouldEvaluateAs("exportedJWK.crv", "P-384");
31 shouldEvaluateAs("exportedJWK.d", "pJLOj6kAhMIn4aMveXTTnp_2en6HBew0GbNftgdYK-vUYeCxUgrHbsLdTptj665x");
32 shouldEvaluateAs("exportedJWK.x", "5V_ubEnY1SP1znv5wEJc5P9lBwi33lz7CVkBUjl5p_BCYC2zCFRzU2mBO1w_Xvho");
33 shouldEvaluateAs("exportedJWK.y", "KPWcxdxQmJKpiNOKjiUZ3j0MT9D72wmT448YUGwXYGxeJCSSRvHOlJg6U2HFvpg-");
34 shouldBe("exportedJWK.alg", "undefined");
35 shouldBe("exportedJWK.ext", "true");
36 shouldBe("exportedJWK.key_ops", "['sign']");
37 shouldBe("exportedJWK.use", "undefined");
39 debug("\nExporting the key as PKCS8...");
40 return crypto.subtle.exportKey("pkcs8", key);
41 }).then(function(result) {
42 exportedPkcs8 = result;
44 bytesShouldMatchHexString("exportedPkcs8", privateKeyPkcs8Hex, exportedPkcs8);
45 }).then(finishJSTest, failAndFinishJSTest);
47 </script>
49 </body>
50 </html>