<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>233705</bug_id>
          
          <creation_ts>2021-12-01 08:12:31 -0800</creation_ts>
          <short_desc>PKCS8 EC private keys without the public key component cannot be imported with SubtleCrypto.importKey</short_desc>
          <delta_ts>2026-03-06 05:05:29 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit Misc.</component>
          <version>Other</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Filip Skokan">panva.ip</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ahmad.saleem792</cc>
    
    <cc>bfulgham</cc>
    
    <cc>davertay</cc>
    
    <cc>karlcow</cc>
    
    <cc>katherine_cheney</cc>
    
    <cc>pranjal.jain</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1819245</commentid>
    <comment_count>0</comment_count>
    <who name="Filip Skokan">panva.ip</who>
    <bug_when>2021-12-01 08:12:31 -0800</bug_when>
    <thetext>Steps to reproduce:

// PKCS8 representation of a private P-384 EC key with the public key omitted
const pkcs8 = new Uint8Array([48, 78, 2, 1, 0, 48, 16, 6, 7, 42, 134, 72, 206, 61, 2, 1, 6, 5, 43, 129, 4, 0, 34, 4, 55, 48, 53, 2, 1, 1, 4, 48, 32, 52, 118, 9, 96, 116, 119, 172, 168, 251, 251, 197, 230, 33, 132, 85, 243, 25, 150, 105, 121, 46, 248, 180, 102, 250, 168, 123, 220, 103, 121, 129, 68, 200, 72, 221, 3, 102, 30, 237, 90, 198, 36, 97, 52, 12, 234, 150])

crypto.subtle.importKey(&apos;pkcs8&apos;, pkcs8, { name: &apos;ECDSA&apos;, namedCurve: &apos;P-384&apos; }, false, [&apos;sign&apos;])

Actual result:

importKey is rejected with DataError: Data provided to an operation does not meet requirements

Expected result:
EC private key PKCS8 without the public key component should import as in other browsers and Web Cryptography API implementations (we expect interoperability in this regard)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1821563</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-12-08 08:13:44 -0800</bug_when>
    <thetext>&lt;rdar://problem/86211792&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2020064</commentid>
    <comment_count>2</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2024-03-11 05:33:11 -0700</bug_when>
    <thetext>Using this in console for all browsers, I get similar error;

const pkcs8 = new Uint8Array([48, 78, 2, 1, 0, 48, 16, 6, 7, 42, 134, 72, 206, 61, 2, 1, 6, 5, 43, 129, 4, 0, 34, 4, 55, 48, 53, 2, 1, 1, 4, 48, 32, 52, 118, 9, 96, 116, 119, 172, 168, 251, 251, 197, 230, 33, 132, 85, 243, 25, 150, 105, 121, 46, 248, 180, 102, 250, 168, 123, 220, 103, 121, 129, 68, 200, 72, 221, 3, 102, 30, 237, 90, 198, 36, 97, 52, 12, 234, 150])

crypto.subtle.importKey(&apos;pkcs8&apos;, pkcs8, { name: &apos;ECDSA&apos;, namedCurve: &apos;P-384&apos; }, false, [&apos;sign&apos;])

___

Safari 17.4, Chrome Canary 124 and Firefox Nightly 125.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2020067</commentid>
    <comment_count>3</comment_count>
    <who name="Ahmad Saleem">ahmad.saleem792</who>
    <bug_when>2024-03-11 05:38:58 -0700</bug_when>
    <thetext>Actually I might have copied code wrong in Chrome:

const pkcs8 = new Uint8Array([48, 78, 2, 1, 0, 48, 16, 6, 7, 42, 134, 72, 206, 61, 2, 1, 6, 5, 43, 129, 4, 0, 34, 4, 55, 48, 53, 2, 1, 1, 4, 48, 32, 52, 118, 9, 96, 116, 119, 172, 168, 251, 251, 197, 230, 33, 132, 85, 243, 25, 150, 105, 121, 46, 248, 180, 102, 250, 168, 123, 220, 103, 121, 129, 68, 200, 72, 221, 3, 102, 30, 237, 90, 198, 36, 97, 52, 12, 234, 150])

crypto.subtle.importKey(&apos;pkcs8&apos;, pkcs8, { name: &apos;ECDSA&apos;, namedCurve: &apos;P-384&apos; }, false, [&apos;sign&apos;])

__

It shows `Promise &lt;pending&gt;`.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2143805</commentid>
    <comment_count>4</comment_count>
    <who name="">davertay</who>
    <bug_when>2025-09-17 16:31:24 -0700</bug_when>
    <thetext>Confirming that an EC private key PKCS8 without the public key fails to import in this manner.

And I have further found that if the a private key payload (RFC5915) does contain the public key, but also contains a `parameters` field then this too will fail to import. For things to work, the inner EC Private Key needs to both include the public key and omit the parameters.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2187755</commentid>
    <comment_count>5</comment_count>
    <who name="pjain">pranjal.jain</who>
    <bug_when>2026-03-06 05:00:07 -0800</bug_when>
    <thetext>*** Bug 309347 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2187758</commentid>
    <comment_count>6</comment_count>
    <who name="pjain">pranjal.jain</who>
    <bug_when>2026-03-06 05:05:29 -0800</bug_when>
    <thetext>Is nobody going to fix this issue?</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>