<?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>260430</bug_id>
          
          <creation_ts>2023-08-19 07:10:17 -0700</creation_ts>
          <short_desc>[WebCrypto] Import key in jwk format should throw DataError instead of TypeError</short_desc>
          <delta_ts>2023-09-08 01:45:49 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore Misc.</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</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>
          
          <blocked>245778</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Javier Fernandez">jfernandez</reporter>
          <assigned_to name="Javier Fernandez">jfernandez</assigned_to>
          <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1972232</commentid>
    <comment_count>0</comment_count>
    <who name="Javier Fernandez">jfernandez</who>
    <bug_when>2023-08-19 07:10:17 -0700</bug_when>
    <thetext>This bug affects the recently added algorithm Ed25519, but also other algorithms. In the case of the former one, according to the Secure Curves spec [1], if the kty field is not present or incorrect, we should throw a DataError exception.

&gt; If the kty field of jwk is not &quot;OKP&quot;, then throw a DataError. 

On the other hand, the Web Cryptography specification states something similar for other algorithms:

* In case of the RSA-* [2][3][4] algorithms:

&gt; If the &quot;kty&quot; field of jwk is not a case-sensitive string match to &quot;RSA&quot;, then throw a DataError. 

* In case of the EC* [5][6] algorithms:

&gt; If the &quot;kty&quot; field of jwk is not &quot;EC&quot;, then throw a DataError. 

* In case of the AES-* [7][8][9][10] algorithms:

&gt; If the &quot;kty&quot; field of jwk is not &quot;oct&quot;, then throw a DataError. 

* In case of the HMAC [11] algorithm:

&gt; If the &quot;kty&quot; field of jwk is not &quot;oct&quot;, then throw a DataError. 


[1] https://wicg.github.io/webcrypto-secure-curves/#ed25519-operations  
[2] https://www.w3.org/TR/WebCryptoAPI/#rsassa-pkcs1-operations
[3] https://www.w3.org/TR/WebCryptoAPI/#rsa-pss-operations
[4] https://www.w3.org/TR/WebCryptoAPI/#rsa-oaep-operations
[5] https://www.w3.org/TR/WebCryptoAPI/#ecdsa-operations
[6] https://www.w3.org/TR/WebCryptoAPI/#ecdh-operations
[7] https://www.w3.org/TR/WebCryptoAPI/#aes-ctr-operations
[8] https://www.w3.org/TR/WebCryptoAPI/#aes-cbc-operations
[9] https://www.w3.org/TR/WebCryptoAPI/#aes-gcm-operations
[10] https://www.w3.org/TR/WebCryptoAPI/#aes-kw-operations
[11] https://www.w3.org/TR/WebCryptoAPI/#hmac-operations</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1972258</commentid>
    <comment_count>1</comment_count>
    <who name="Javier Fernandez">jfernandez</who>
    <bug_when>2023-08-19 16:29:15 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/16869</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1972623</commentid>
    <comment_count>2</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2023-08-22 06:57:15 -0700</bug_when>
    <thetext>Committed 267131@main (58f6c8c90849): &lt;https://commits.webkit.org/267131@main&gt;

Reviewed commits have been landed. Closing PR #16869 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1972625</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2023-08-22 06:58:15 -0700</bug_when>
    <thetext>&lt;rdar://problem/114256855&gt;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>