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

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>27601</bug_id>
          
          <creation_ts>2014-12-13 01:34:08 +0000</creation_ts>
          <short_desc>Inconsistent enforcement of JWK&apos;s &quot;use&quot; versus &quot;key_ops&quot; during public key import</short_desc>
          <delta_ts>2016-05-24 00:07:10 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Web Cryptography</product>
          <component>Web Cryptography API Document</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>MOVED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Eric Roman">ericroman</reporter>
          <assigned_to name="Ryan Sleevi">sleevi</assigned_to>
          <cc>public-webcrypto</cc>
    
    <cc>watsonm</cc>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>116248</commentid>
    <comment_count>0</comment_count>
    <who name="Eric Roman">ericroman</who>
    <bug_when>2014-12-13 01:34:08 +0000</bug_when>
    <thetext>Consider the case of importing an RSA-PSS public key using JWK.

WebCrypto callers can request usages of either [&apos;verify&apos; or []  (no usages)

If empty usages are specified then it is possible to import the following JWK:


 {
   &quot;kty&quot;: &quot;RSA&quot;,
   &quot;key_ops&quot;: [&quot;encrypt&quot;, &quot;decrypt&quot;, &quot;wrapKey&quot;, &quot;unwrapKey&quot;],
   ...
 }

The above key is for an encryption algorithm, but it is allowed to be imported for a signing algorithm because the requested usages, [], were a subset of the usages granted to the key.

OK fine.

However, it is NOT possible to import the following:


 {
   &quot;kty&quot;: &quot;RSA&quot;,
   &quot;use&quot;: &quot;enc&quot;,
   ...
 }

Conceptually these represent the same kind of key, however WebCrypto enforces &quot;use&quot; differently from &quot;key_ops&quot;. &quot;use&quot; in this case is required to be an exact match of &quot;sig&quot;.

The same situation applies to ECDH keys.

I believe the key_ops behavior is the correct one, and &quot;use&quot; should work the same way. I feel this way because JWK allows pairing unrelated usages in key_ops (although discourages it) [1]. So it stands to reason that such a key should be importable into WebCrypto.


[1] Section 4.3 of JWK spec says: &quot;Multiple unrelated key operations SHOULD NOT be specified&quot;   .....  SHOULD NOT != MUST NOT</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>126524</commentid>
    <comment_count>1</comment_count>
    <who name="Mark Watson">watsonm</who>
    <bug_when>2016-05-24 00:07:10 +0000</bug_when>
    <thetext>Moved https://github.com/w3c/webcrypto/issues/64</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>