blob: 9a39bd7bc7ba46df9859ada5f855af014b99e730 [file] [log] [blame]
importScripts('../../../../resources/js-test-pre.js');
importScripts("../../../resources/common.js");
description("Test exporting an ECDH public key with SPKI format in workers.");
jsTestIsAsync = true;
var algorithmKeyGen = {
name: "ECDH",
namedCurve: "P-256"
};
var extractable = true;
var keyPair;
debug("Generating a key pair...");
crypto.subtle.generateKey(algorithmKeyGen, extractable, ["deriveKey", "deriveBits"]).then(function(result) {
keyPair = result;
debug("Exporting the public key...");
return crypto.subtle.exportKey("spki", keyPair.publicKey);
}).then(function(result) {
publicKey = result;
shouldBe("publicKey.byteLength", "91");
finishJSTest();
});