blob: 73ffa986861a33cf1766513ea7c1790771665f5b [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 type="text/javascript">
description("Test importing a EC key with malformed parameters");
var extractable = true;
var rawP256Key = hexStringToUint8Array("04dc08d9bf603333eab1ad29cef41a6203ab6ecce03c5a4a9bf5771a3fb9f971d89a09664bfb87c61199b3453220eadec714c49ad1e24bf5d7ec5bddeca6420893");
var rawP384Key = hexStringToUint8Array("048ba3e0a0ac5c9bb25476323570fa11dff30745a13da751a5eb1dacb5e9b439df0f77979077ee9ac97c02ca1e3cd72677cbbc256a69b99fd83a519ca9a9a26c62d45b51659274b1cea3c9858543abf5c64bfcfcd1948b7075c0409da4494f9060");
var x = "1FSVWieTvikFkG1NOyhkUCaMbdQhxwH6aCu4Ez-sRtA"; // P-256
var y = "9jmNTLqM4cjBhdAnHcNI9YQV3O8LFmo-EdZWk8ntAaI"; // P-256
var d = "ppxBSov3N8_AUcisAuvmLV4yE8e_L_BLE8bZb9Z1Xjg"; // P-256
var x384 = "1bHwFrsaPRjYq-zFOyLXK8Ugv3EqbVF075ct7ouTl_pwyhjeBu03JHjKTsyVbNWK";
var y384 = "1bHwFrsaPRjYq-zFOyLXK8Ugv3EqbVF075ct7ouTl_pwyhjeBu03JHjKTsyVbNWK";
var spkiP256Key = hexStringToUint8Array("3059301306072a8648ce3d020106082a8648ce3d03010703420004c3ee3a2c3380072b9b2a59fed2cada65121806e22c4f4f8a25e740fc3e54d75d86c200298e6dfc1611d185eedbdb3c2661b0eb0441f7fd57c90d08112e9ae71c");
var spkiP384Key = hexStringToUint8Array("3076301006072a8648ce3d020106052b8104002203620004478f6119747475f94b742654be32ab6ebbdc371afa34fbee6d12c32fe2d586231262b17d13a1f271f19c8008c034d8716b7df0ce1d987990c5b175ecae1aa40f2fb89e4778528e1234e56d69638db135d103fa68448fee2b4f58ecc86d7f4b7a");
var truncatedSpkiP256Key1 = hexStringToUint8Array("30");
var truncatedSpkiP256Key2 = hexStringToUint8Array("305930");
var truncatedSpkiP256Key3 = hexStringToUint8Array("305930130607");
var truncatedSpkiP256Key4 = hexStringToUint8Array("3059301306072b8648ce3d0201");
var truncatedSpkiP256Key5 = hexStringToUint8Array("3059301306072a8648ce3d02010608");
var truncatedSpkiP256Key6 = hexStringToUint8Array("3059301306072a8648ce3d020106082a8648ce3d030108");
var truncatedSpkiP256Key7 = hexStringToUint8Array("3059301306072a8648ce3d020106082a8648ce3d030107034200");
var truncatedSpkiP256Key8 = hexStringToUint8Array("3059301306072a8648ce3d020106082a8648ce3d03010703420004c3ee3a2c3380072b9b2a59fed2cada65121806e22c4f4f8a25e740fc3e54d75d86c200298e6dfc1611d185eedbdb3c2661b0eb0441f7fd57c90d08112e9ae7");
var truncatedSpkiP384Key1 = hexStringToUint8Array("3076301006072a8648ce3d02010605");
var truncatedSpkiP384Key2 = hexStringToUint8Array("3076301006072a8648ce3d020106052b81040022");
var truncatedSpkiP384Key3 = hexStringToUint8Array("3076301006072a8648ce3d020106052b8104002203620004478f6119747475f94b742654be32ab6ebbdc371afa34fbee6d12c32fe2d586231262b17d13a1f271f19c8008c034d8716b7df0ce1d987990c5b175ecae1aa40f2fb89e4778528e1234e56d69638db135d103fa68448fee2b4f58ecc86d7f4b");
var corruptedSpkiP256Key = hexStringToUint8Array("3059301306072a8648ce3d020106082a8648ce3d03010703420000c3ee3a2c3380072b9b2a59fed2cada65121806e22c4f4f8a25e740fc3e54d75d86c200298e6dfc1611d185eedbdb3c2661b0eb0441f7fd57c90d08112e9ae71c");
var pkcs8P256Key = hexStringToUint8Array("308187020100301306072a8648ce3d020106082a8648ce3d030107046d306b02010104200a21f3f048b893b0f2b5a8459bd6d2bc112614aa86437f8fa2496a0e27f5b0a8a14403420004d726bd565878f24ee3616890d3668503334b84da3434b2774a44d6e4b9c536dd60e9181e1d1469ba3e6aba8987225f6e797d01a0dc400a4a298c902bae66abe2");
var pkcs8P384Key = hexStringToUint8Array("3081b6020100301006072a8648ce3d020106052b8104002204819e30819b0201010430c38e34a7cd58961c8deda9c9118548724945d3f3b3bd71f03c93247304c1f7d86b8507501e4e05a0fbae76e44bbe8cc2a16403620004cb75013d8ba42edd022e9de8dfe856a2ee3f48ec28a666c4a73cf3d16e09c7d5747e6c5b5795a656e175c71feed01ec5e282b19e6650f6ea31970114f3e1e6e2275dd6811f87e7f7128c48806a9763785ac31bd345436e57eae23a1151355ef2");
var truncatedPkcs8P256Key1 = hexStringToUint8Array("30");
var truncatedPkcs8P256Key2 = hexStringToUint8Array("30818702010030");
var truncatedPkcs8P256Key3 = hexStringToUint8Array("3081870201003013");
var truncatedPkcs8P256Key4 = hexStringToUint8Array("308187020100301306072b8648ce3d0201");
var truncatedPkcs8P256Key5 = hexStringToUint8Array("308187020100301306072a8648ce3d0201");
var truncatedPkcs8P256Key6 = hexStringToUint8Array("308187020100301306072a8648ce3d020106082b8648ce3d030107");
var truncatedPkcs8P256Key7 = hexStringToUint8Array("308187020100301306072a8648ce3d020106082a8648ce3d03010704");
var truncatedPkcs8P256Key8 = hexStringToUint8Array("308187020100301306072a8648ce3d020106082a8648ce3d030107046d30");
var truncatedPkcs8P256Key9 = hexStringToUint8Array("308187020100301306072a8648ce3d020106082a8648ce3d030107046d306b02010104");
var truncatedPkcs8P256Key10 = hexStringToUint8Array("308187020100301306072a8648ce3d020106082a8648ce3d030107046d306b0201010420");
var truncatedPkcs8P256Key11 = hexStringToUint8Array("308187020100301306072a8648ce3d020106082a8648ce3d030107046d306b02010104200a21f3f048b893b0f2b5a8459bd6d2bc112614aa86437f8fa2496a0e27f5b0a8a14403");
var longPkcs8P256Key = hexStringToUint8Array("308187020100301306072a8648ce3d020106082a8648ce3d030107046d306b02010104200a21f3f048b893b0f2b5a8459bd6d2bc112614aa86437f8fa2496a0e27f5b0a8a14403420004d726bd565878f24ee3616890d3668503334b84da3434b2774a44d6e4b9c536dd60e9181e1d1469ba3e6aba8987225f6e797d01a0dc400a4a298c902bae66abe2badbad");
var corruptedPkcs8P256Key = hexStringToUint8Array("308187020100301306072a8648ce3d020106082a8648ce3d030107046d306b02010104200a21f3f048b893b0f2b5a8459bd6d2bc112614aa86437f8fa2496a0e27f5b0a8a14403420005d726bd565878f24ee3616890d3668503334b84da3434b2774a44d6e4b9c536dd60e9181e1d1469ba3e6aba8987225f6e797d01a0dc400a4a298c902bae66abe2");
var truncatedPkcs8P384Key1 = hexStringToUint8Array("3081b6020100301006072a8648ce3d0201");
var truncatedPkcs8P384Key2 = hexStringToUint8Array("3081b6020100301006072a8648ce3d020106052b81040023");
// Named curves mismatch raw keys
shouldReject('crypto.subtle.importKey("raw", rawP256Key, { name: "ECDH", namedCurve: "P-384" }, extractable, [ ])');
shouldReject('crypto.subtle.importKey("raw", rawP384Key, { name: "ECDH", namedCurve: "P-256" }, extractable, [ ])');
// Raw: Wrong usages
shouldReject('crypto.subtle.importKey("raw", rawP256Key, { name: "ECDH", namedCurve: "P-256" }, extractable, ["deriveBits"])');
shouldReject('crypto.subtle.importKey("raw", rawP256Key, { name: "ECDSA", namedCurve: "P-256" }, extractable, ["sign"])');
// Raw: Not support named curve
shouldReject('crypto.subtle.importKey("raw", rawP256Key, { name: "ECDH", namedCurve: "P-521" }, extractable, [ ])');
// Jwk: Wrong usages
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-256", x:x, y:y}, { name: "ECDH", namedCurve: "P-256" }, extractable, ["deriveKey"])');
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-256", x:x, y:y, d:d}, { name: "ECDH", namedCurve: "P-256" }, extractable, ["encrypt"])');
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-256", x:x, y:y, d:d}, { name: "ECDH", namedCurve: "P-256" }, extractable, ["decrypt"])');
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-256", x:x, y:y, d:d}, { name: "ECDH", namedCurve: "P-256" }, extractable, ["sign"])');
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-256", x:x, y:y, d:d}, { name: "ECDH", namedCurve: "P-256" }, extractable, ["verify"])');
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-256", x:x, y:y, d:d}, { name: "ECDH", namedCurve: "P-256" }, extractable, ["wrapKey"])');
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-256", x:x, y:y, d:d}, { name: "ECDH", namedCurve: "P-256" }, extractable, ["unwrapKey"])');
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-256", x:x, y:y}, { name: "ECDSA", namedCurve: "P-256" }, extractable, ["encrypt"])');
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-256", x:x, y:y}, { name: "ECDSA", namedCurve: "P-256" }, extractable, ["decrypt"])');
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-256", x:x, y:y}, { name: "ECDSA", namedCurve: "P-256" }, extractable, ["sign"])');
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-256", x:x, y:y}, { name: "ECDSA", namedCurve: "P-256" }, extractable, ["deriveKey"])');
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-256", x:x, y:y}, { name: "ECDSA", namedCurve: "P-256" }, extractable, ["deriveBits"])');
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-256", x:x, y:y}, { name: "ECDSA", namedCurve: "P-256" }, extractable, ["wrapKey"])');
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-256", x:x, y:y}, { name: "ECDSA", namedCurve: "P-256" }, extractable, ["unwrapKey"])');
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-256", x:x, y:y, d:d}, { name: "ECDSA", namedCurve: "P-256" }, extractable, ["encrypt"])');
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-256", x:x, y:y, d:d}, { name: "ECDSA", namedCurve: "P-256" }, extractable, ["decrypt"])');
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-256", x:x, y:y, d:d}, { name: "ECDSA", namedCurve: "P-256" }, extractable, ["verify"])');
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-256", x:x, y:y, d:d}, { name: "ECDSA", namedCurve: "P-256" }, extractable, ["deriveKey"])');
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-256", x:x, y:y, d:d}, { name: "ECDSA", namedCurve: "P-256" }, extractable, ["deriveBits"])');
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-256", x:x, y:y, d:d}, { name: "ECDSA", namedCurve: "P-256" }, extractable, ["wrapKey"])');
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-256", x:x, y:y, d:d}, { name: "ECDSA", namedCurve: "P-256" }, extractable, ["unwrapKey"])');
// Jwk: Wrong alg
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-256", x:x, y:y, alg: "ES384"}, { name: "ECDSA", namedCurve: "P-256" }, extractable, ["verify"])');
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-384", x:x, y:y, alg: "ES256"}, { name: "ECDSA", namedCurve: "P-256" }, extractable, ["verify"])');
// Jwk: Wrong use
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-256", x:x, y:y, d:d, use: "sig"}, { name: "ECDH", namedCurve: "P-256" }, extractable, ["deriveKey"])');
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-256", x:x, y:y, d:d, use: "enc"}, { name: "ECDSA", namedCurve: "P-256" }, extractable, ["sign"])');
// Jwk: Wrong kty
shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", crv: "P-256", x:x, y:y}, { name: "ECDH", namedCurve: "P-256" }, extractable, [ ])');
// Jwk: Wrong key_ops
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-256", x:x, y:y, d:d, key_ops: ["sign", "verify"]}, { name: "ECDH", namedCurve: "P-256" }, extractable, ["deriveKey"])');
// Jwk: Wrong ext
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-256", x:x, y:y, ext: false}, { name: "ECDH", namedCurve: "P-256" }, extractable, [ ])');
// Jwk: Missing crv
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", x:x, y:y}, { name: "ECDH", namedCurve: "P-256" }, extractable, [ ])');
// Jwk: Mismatched crv
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-384", x:x, y:y}, { name: "ECDH", namedCurve: "P-256" }, extractable, [ ])');
// Jwk: Not supported crv
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-521", x:x, y:y}, { name: "ECDH", namedCurve: "P-521" }, extractable, [ ])');
// Jwk: Missing x, y
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-256", y:y}, { name: "ECDH", namedCurve: "P-256" }, extractable, [ ])');
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-256", x:x}, { name: "ECDH", namedCurve: "P-256" }, extractable, [ ])');
// Jwk: Mismatched x, y, d
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-384", x:x, y:y}, { name: "ECDH", namedCurve: "P-384" }, extractable, [ ])');
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-384", x:x384, y:y}, { name: "ECDH", namedCurve: "P-384" }, extractable, [ ])');
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-384", x:x, y:y384}, { name: "ECDH", namedCurve: "P-384" }, extractable, [ ])');
shouldReject('crypto.subtle.importKey("jwk", {kty: "EC", crv: "P-384", x:x384, y:y384, d:d}, { name: "ECDH", namedCurve: "P-384" }, extractable, [ ])');
// Spki: Wrong usages
shouldReject('crypto.subtle.importKey("spki", spkiP256Key, { name: "ECDH", namedCurve: "P-256" }, extractable, ["deriveBits"])');
shouldReject('crypto.subtle.importKey("spki", spkiP256Key, { name: "ECDSA", namedCurve: "P-256" }, extractable, ["encrypt"])');
shouldReject('crypto.subtle.importKey("spki", spkiP256Key, { name: "ECDSA", namedCurve: "P-256" }, extractable, ["decrypt"])');
shouldReject('crypto.subtle.importKey("spki", spkiP256Key, { name: "ECDSA", namedCurve: "P-256" }, extractable, ["sign"])');
shouldReject('crypto.subtle.importKey("spki", spkiP256Key, { name: "ECDSA", namedCurve: "P-256" }, extractable, ["deriveKey"])');
shouldReject('crypto.subtle.importKey("spki", spkiP256Key, { name: "ECDSA", namedCurve: "P-256" }, extractable, ["deriveBits"])');
shouldReject('crypto.subtle.importKey("spki", spkiP256Key, { name: "ECDSA", namedCurve: "P-256" }, extractable, ["wrapKey"])');
shouldReject('crypto.subtle.importKey("spki", spkiP256Key, { name: "ECDSA", namedCurve: "P-256" }, extractable, ["unwrapKey"])');
// Spki: Truncated keys
shouldReject('crypto.subtle.importKey("spki", truncatedSpkiP256Key1, { name: "ECDH", namedCurve: "P-256" }, extractable, [ ])');
shouldReject('crypto.subtle.importKey("spki", truncatedSpkiP256Key2, { name: "ECDH", namedCurve: "P-256" }, extractable, [ ])');
shouldReject('crypto.subtle.importKey("spki", truncatedSpkiP256Key3, { name: "ECDH", namedCurve: "P-256" }, extractable, [ ])');
shouldReject('crypto.subtle.importKey("spki", truncatedSpkiP256Key4, { name: "ECDH", namedCurve: "P-256" }, extractable, [ ])');
shouldReject('crypto.subtle.importKey("spki", truncatedSpkiP256Key5, { name: "ECDH", namedCurve: "P-256" }, extractable, [ ])');
shouldReject('crypto.subtle.importKey("spki", truncatedSpkiP256Key6, { name: "ECDH", namedCurve: "P-256" }, extractable, [ ])');
shouldReject('crypto.subtle.importKey("spki", truncatedSpkiP256Key7, { name: "ECDH", namedCurve: "P-256" }, extractable, [ ])');
shouldReject('crypto.subtle.importKey("spki", truncatedSpkiP256Key8, { name: "ECDH", namedCurve: "P-256" }, extractable, [ ])');
shouldReject('crypto.subtle.importKey("spki", truncatedSpkiP384Key1, { name: "ECDH", namedCurve: "P-384" }, extractable, [ ])');
shouldReject('crypto.subtle.importKey("spki", truncatedSpkiP384Key2, { name: "ECDH", namedCurve: "P-384" }, extractable, [ ])');
shouldReject('crypto.subtle.importKey("spki", truncatedSpkiP384Key3, { name: "ECDH", namedCurve: "P-384" }, extractable, [ ])');
// Spki: Missmatched Curves
shouldReject('crypto.subtle.importKey("spki", spkiP256Key, { name: "ECDH", namedCurve: "P-384" }, extractable, [ ])');
shouldReject('crypto.subtle.importKey("spki", spkiP384Key, { name: "ECDH", namedCurve: "P-256" }, extractable, [ ])');
// Spki: Corrupted Key Data
shouldReject('crypto.subtle.importKey("spki", corruptedSpkiP256Key, { name: "ECDH", namedCurve: "P-256" }, extractable, [ ])');
// Pkcs8: Wrong usages
shouldReject('crypto.subtle.importKey("pkcs8", pkcs8P256Key, { name: "ECDH", namedCurve: "P-256" }, extractable, ["encrypt"])');
shouldReject('crypto.subtle.importKey("pkcs8", pkcs8P256Key, { name: "ECDH", namedCurve: "P-256" }, extractable, ["decrypt"])');
shouldReject('crypto.subtle.importKey("pkcs8", pkcs8P256Key, { name: "ECDH", namedCurve: "P-256" }, extractable, ["sign"])');
shouldReject('crypto.subtle.importKey("pkcs8", pkcs8P256Key, { name: "ECDH", namedCurve: "P-256" }, extractable, ["verify"])');
shouldReject('crypto.subtle.importKey("pkcs8", pkcs8P256Key, { name: "ECDH", namedCurve: "P-256" }, extractable, ["wrapKey"])');
shouldReject('crypto.subtle.importKey("pkcs8", pkcs8P256Key, { name: "ECDH", namedCurve: "P-256" }, extractable, ["unwrapKey"])');
shouldReject('crypto.subtle.importKey("pkcs8", pkcs8P256Key, { name: "ECDSA", namedCurve: "P-256" }, extractable, ["encrypt"])');
shouldReject('crypto.subtle.importKey("pkcs8", pkcs8P256Key, { name: "ECDSA", namedCurve: "P-256" }, extractable, ["decrypt"])');
shouldReject('crypto.subtle.importKey("pkcs8", pkcs8P256Key, { name: "ECDSA", namedCurve: "P-256" }, extractable, ["verify"])');
shouldReject('crypto.subtle.importKey("pkcs8", pkcs8P256Key, { name: "ECDSA", namedCurve: "P-256" }, extractable, ["deriveKey"])');
shouldReject('crypto.subtle.importKey("pkcs8", pkcs8P256Key, { name: "ECDSA", namedCurve: "P-256" }, extractable, ["deriveBits"])');
shouldReject('crypto.subtle.importKey("pkcs8", pkcs8P256Key, { name: "ECDSA", namedCurve: "P-256" }, extractable, ["wrapKey"])');
shouldReject('crypto.subtle.importKey("pkcs8", pkcs8P256Key, { name: "ECDSA", namedCurve: "P-256" }, extractable, ["unwrapKey"])');
// Pkcs8: Truncated keys
shouldReject('crypto.subtle.importKey("pkcs8", truncatedPkcs8P256Key1, { name: "ECDH", namedCurve: "P-256" }, extractable, ["deriveKey"])');
shouldReject('crypto.subtle.importKey("pkcs8", truncatedPkcs8P256Key2, { name: "ECDH", namedCurve: "P-256" }, extractable, ["deriveKey"])');
shouldReject('crypto.subtle.importKey("pkcs8", truncatedPkcs8P256Key3, { name: "ECDH", namedCurve: "P-256" }, extractable, ["deriveKey"])');
shouldReject('crypto.subtle.importKey("pkcs8", truncatedPkcs8P256Key4, { name: "ECDH", namedCurve: "P-256" }, extractable, ["deriveKey"])');
shouldReject('crypto.subtle.importKey("pkcs8", truncatedPkcs8P256Key5, { name: "ECDH", namedCurve: "P-256" }, extractable, ["deriveKey"])');
shouldReject('crypto.subtle.importKey("pkcs8", truncatedPkcs8P256Key6, { name: "ECDH", namedCurve: "P-256" }, extractable, ["deriveKey"])');
shouldReject('crypto.subtle.importKey("pkcs8", truncatedPkcs8P256Key7, { name: "ECDH", namedCurve: "P-256" }, extractable, ["deriveKey"])');
shouldReject('crypto.subtle.importKey("pkcs8", truncatedPkcs8P256Key8, { name: "ECDH", namedCurve: "P-256" }, extractable, ["deriveKey"])');
shouldReject('crypto.subtle.importKey("pkcs8", truncatedPkcs8P256Key9, { name: "ECDH", namedCurve: "P-256" }, extractable, ["deriveKey"])');
shouldReject('crypto.subtle.importKey("pkcs8", truncatedPkcs8P256Key10, { name: "ECDH", namedCurve: "P-256" }, extractable, ["deriveKey"])');
shouldReject('crypto.subtle.importKey("pkcs8", truncatedPkcs8P256Key11, { name: "ECDH", namedCurve: "P-256" }, extractable, ["deriveKey"])');
shouldReject('crypto.subtle.importKey("pkcs8", truncatedPkcs8P384Key1, { name: "ECDH", namedCurve: "P-384" }, extractable, ["deriveKey"])');
shouldReject('crypto.subtle.importKey("pkcs8", truncatedPkcs8P384Key2, { name: "ECDH", namedCurve: "P-384" }, extractable, ["deriveKey"])');
// Pkcs8: Long key
shouldReject('crypto.subtle.importKey("pkcs8", longPkcs8P256Key, { name: "ECDH", namedCurve: "P-256" }, extractable, ["deriveKey"])');
// Pkcs8: Corrupted Key Data
shouldReject('crypto.subtle.importKey("pkcs8", corruptedPkcs8P256Key, { name: "ECDH", namedCurve: "P-256" }, extractable, ["deriveKey"])');
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>