| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../resources/js-test-pre.js"></script> |
| <script src="../resources/common.js"></script> |
| </head> |
| <body> |
| <p id="description"></p> |
| <div id="console"></div> |
| |
| <script type="text/javascript"> |
| description("Test generating an EC key pair with P-256 using ECDSA algorithm."); |
| |
| jsTestIsAsync = true; |
| |
| var extractable = true; |
| |
| debug("Generating a key pair..."); |
| crypto.subtle.generateKey({ name: "ECDSA", namedCurve: "P-256"}, extractable, ["sign", "verify"]).then(function(result) { |
| keyPair = result; |
| shouldBe("keyPair.toString()", "'[object Object]'"); |
| shouldBe("keyPair.publicKey.type", "'public'"); |
| shouldBe("keyPair.publicKey.extractable", "true"); |
| shouldBe("keyPair.publicKey.algorithm.name", "'ECDSA'"); |
| shouldBe("keyPair.publicKey.algorithm.namedCurve", "'P-256'"); |
| shouldBe("keyPair.publicKey.usages", "['verify']"); |
| shouldBe("keyPair.privateKey.type", "'private'"); |
| shouldBe("keyPair.privateKey.extractable", "true"); |
| shouldBe("keyPair.privateKey.algorithm.name", "'ECDSA'"); |
| shouldBe("keyPair.privateKey.algorithm.namedCurve", "'P-256'"); |
| shouldBe("keyPair.privateKey.usages", "['sign']"); |
| |
| finishJSTest(); |
| }); |
| </script> |
| |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |