| <!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 importing a SPKI ECDSA key"); |
| |
| jsTestIsAsync = true; |
| |
| var spkiKey = hexStringToUint8Array("3059301306072a8648ce3d020106082a8648ce3d03010703420004c3ee3a2c3380072b9b2a59fed2cada65121806e22c4f4f8a25e740fc3e54d75d86c200298e6dfc1611d185eedbdb3c2661b0eb0441f7fd57c90d08112e9ae71c"); |
| var extractable = true; |
| |
| debug("Importing a key..."); |
| crypto.subtle.importKey("spki", spkiKey, {name: "ECDSA", namedCurve: "P-256"}, extractable, ['verify']).then(function(result) { |
| publicKey = result; |
| |
| shouldBe("publicKey.toString()", "'[object CryptoKey]'"); |
| shouldBe("publicKey.type", "'public'"); |
| shouldBe("publicKey.extractable", "true"); |
| shouldBe("publicKey.algorithm.name", "'ECDSA'"); |
| shouldBe("publicKey.algorithm.namedCurve", "'P-256'"); |
| shouldBe("publicKey.usages", "['verify']"); |
| |
| finishJSTest(); |
| }); |
| |
| </script> |
| |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |