blob: dabb9f8b31b38dc9ab6b3eef91773601ed13f0c5 [file] [log] [blame]
<!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 and exporting it in SPKI format");
jsTestIsAsync = true;
var spkiKeyHex = "3076301006072a8648ce3d020106052b8104002203620004478f6119747475f94b742654be32ab6ebbdc371afa34fbee6d12c32fe2d586231262b17d13a1f271f19c8008c034d8716b7df0ce1d987990c5b175ecae1aa40f2fb89e4778528e1234e56d69638db135d103fa68448fee2b4f58ecc86d7f4b7a";
var spkiKey = hexStringToUint8Array(spkiKeyHex);
var extractable = true;
debug("Importing a key...");
crypto.subtle.importKey("spki", spkiKey, {name: "ECDH", namedCurve: "P-384"}, extractable, [ ]).then(function(key) {
return crypto.subtle.exportKey("spki", key);
}).then(function(result) {
publicKey = result;
shouldBe("bytesToHexString(publicKey)", "spkiKeyHex");
finishJSTest();
});
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>