<p dir="auto">The following script fails with an "Unsupported namedCurve" error. It works fine if the P-384 is changed to P-256.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="function generate_keypair() {
    return crypto.subtle.generateKey(
        {name: &quot;ECDH&quot;, namedCurve: &quot;P-384&quot;},
        true,
        [&quot;deriveBits&quot;]
    );
}

Promise.all([
    generate_keypair(),
    generate_keypair()
]).then(function ([alice, bob]) {
    return crypto.subtle.deriveBits(
        {name: &quot;ECDH&quot;, public: bob.publicKey},
        alice.privateKey,
        256
    );
}).then(
    console.log
);"><pre class="notranslate"><code class="notranslate">function generate_keypair() {
    return crypto.subtle.generateKey(
        {name: "ECDH", namedCurve: "P-384"},
        true,
        ["deriveBits"]
    );
}

Promise.all([
    generate_keypair(),
    generate_keypair()
]).then(function ([alice, bob]) {
    return crypto.subtle.deriveBits(
        {name: "ECDH", public: bob.publicKey},
        alice.privateKey,
        256
    );
}).then(
    console.log
);
</code></pre></div>
<p dir="auto">It appears that the upstream fix mentioned in <a href="https://github.com/denoland/deno/blob/7eee521199e9735ab7c347d99e9d90ba3046be1a/ext/crypto/lib.rs#L561">this TODO comment</a> has just landed, meaning that it should be possible to make SubtleCrypto.deriveBits work with P-384 keys.</p>
<p dir="auto"><a href="https://docs.rs/elliptic-curve/0.11.5/src/elliptic_curve/ecdh.rs.html#58-68" rel="nofollow">Diffie-Hellman function</a> requires <code class="notranslate">p384::NistP384</code> to implement <code class="notranslate">ProjectiveArithmetic</code> trait. Blocked on <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="754581168" data-permission-text="Title is private" data-url="https://github.com/RustCrypto/elliptic-curves/issues/240" data-hovercard-type="issue" data-hovercard-url="/RustCrypto/elliptic-curves/issues/240/hovercard" href="https://github.com/RustCrypto/elliptic-curves/issues/240">RustCrypto/elliptic-curves#240</a></p>