| <!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> |
| description("Test importing a P-384 SPKI ECDH key"); |
| |
| jsTestIsAsync = true; |
| |
| // From OpenSSL |
| var spkiKey = Base64URL.parse("MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAET+j0eaAbLVJND2N63QORtzM0Sp7KRwI1nUKtQqz9BjLnfIVVNOiWgo/sdjGLOqf5dF7ZShmlUVKkQYz98nfT1wbd89RD7gcQrHF86FumDo/inn2LPf4Hl8frR9LBmobK"); |
| var extractable = true; |
| |
| debug("Importing a key..."); |
| crypto.subtle.importKey("spki", spkiKey, {name: "ECDH", namedCurve: "P-384"}, extractable, [ ]).then(function(result) { |
| publicKey = result; |
| |
| shouldBe("publicKey.toString()", "'[object CryptoKey]'"); |
| shouldBe("publicKey.type", "'public'"); |
| shouldBe("publicKey.extractable", "true"); |
| shouldBe("publicKey.algorithm.name", "'ECDH'"); |
| shouldBe("publicKey.algorithm.namedCurve", "'P-384'"); |
| shouldBe("publicKey.usages", "[ ]"); |
| |
| finishJSTest(); |
| }); |
| |
| </script> |
| |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |