blob: 25a4afb3a137bb1bdee69922e1131c9f9d092a9b [file] [log] [blame]
jiewen_tan@apple.com8a7dc9c2017-03-08 02:09:38 +00001<!DOCTYPE html>
2<html>
3<head>
4<script src="../../resources/js-test-pre.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>
12description("Test importing a JWK ECDH public key with P-384");
13
14jsTestIsAsync = true;
15
16var jwkKey = {
17 kty: "EC",
18 use: "enc",
19 ext: true,
20 crv: "P-384",
21 x: "1bHwFrsaPRjYq-zFOyLXK8Ugv3EqbVF075ct7ouTl_pwyhjeBu03JHjKTsyVbNWK",
22 y: "1bHwFrsaPRjYq-zFOyLXK8Ugv3EqbVF075ct7ouTl_pwyhjeBu03JHjKTsyVbNWK",
23};
24var extractable = true;
25
26debug("Importing a key...");
27crypto.subtle.importKey("jwk", jwkKey, { name: "ECDH", namedCurve: "P-384" }, extractable, [ ]).then(function(result) {
28 publicKey = result;
29
30 shouldBe("publicKey.toString()", "'[object CryptoKey]'");
31 shouldBe("publicKey.type", "'public'");
32 shouldBe("publicKey.extractable", "true");
33 shouldBe("publicKey.algorithm.name", "'ECDH'");
34 shouldBe("publicKey.algorithm.namedCurve", "'P-384'");
35 shouldBe("publicKey.usages", "[ ]");
36
37 finishJSTest();
38});
39
40</script>
41
42<script src="../../resources/js-test-post.js"></script>
43</body>
44</html>