4 <script src=
"../../../resources/js-test.js"></script>
5 <script src=
"../resources/common.js"></script>
8 <p id=
"description"></p>
9 <div id=
"console"></div>
12 description("Test generating an EC key pair for ECDSA.");
16 var algorithmKeyGen
= {
20 var extractable
= true;
22 debug("Generating a key pair...");
23 crypto
.subtle
.generateKey(algorithmKeyGen
, extractable
, ["sign", "verify"]).then(function(result
) {
25 shouldBe("keyPair.toString()", "'[object Object]'");
26 shouldBe("keyPair.publicKey.type", "'public'");
27 shouldBe("keyPair.publicKey.algorithm.name", "'ECDSA'");
28 shouldBe("keyPair.publicKey.algorithm.namedCurve", "'P-256'");
29 shouldBe("keyPair.publicKey.usages", '["verify"]');
30 shouldBe("keyPair.privateKey.type", "'private'");
31 shouldBe("keyPair.privateKey.algorithm.name", "'ECDSA'");
32 shouldBe("keyPair.privateKey.algorithm.namedCurve", "'P-256'");
33 shouldBe("keyPair.privateKey.usages", '["sign"]');
35 debug("\nTesting that custom attributes on keys survive garbage collection...");
36 keyPair
.publicKey
.foo
= "bar";
38 setTimeout(function() {
40 setTimeout(function() {
41 shouldBe("keyPair.publicKey.foo", "'bar'");
45 }).catch(failAndFinishJSTest
);