<?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>25741</bug_id>
          
          <creation_ts>2014-05-16 18:45:23 +0000</creation_ts>
          <short_desc>RSA-OAEP is under-specified when the parameters define an operation not supported by the key size</short_desc>
          <delta_ts>2014-10-22 21:03:33 +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>Windows NT</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</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>
          
          <blocked>26903</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Ryan Sleevi">sleevi</reporter>
          <assigned_to name="Ryan Sleevi">sleevi</assigned_to>
          <cc>public-webcrypto</cc>
    
    <cc>virginie.galindo</cc>
    
    <cc>watsonm</cc>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>106190</commentid>
    <comment_count>0</comment_count>
    <who name="Ryan Sleevi">sleevi</who>
    <bug_when>2014-05-16 18:45:23 +0000</bug_when>
    <thetext>With RSA-OAEP, the maximum message size is equivalent to:

modulus length - 1 (leading 0x00 octet) - hash size (masked seed) - hash size (lHash portion of the maskedDB) - 1 (at least one octet for the padding string, equal to 0x01)

The result of this is that it&apos;s possible to specify a set of parameters during an operation that are not supportable by the key.

For example, using a 1024-bit key with SHA-512 as the hash algorithm is not possible, because the minimum size of an OAEP encoded message is 1040 bits.

The question is whether this should be presented as a DataError (implying implementations may need to do validation prior to the underlying implementation) or left as an OperationError.

The spec is unclear on this. In the case of AES-KW, for example, a DataError is raised if plaintext is not a multiple of 64 bits. With RSA-ES, however, which also has a maximum message size (modulus length - 11), no spec-specific behaviour is defined, therefore an OperationError is expected.

At least one user agent (Chrome) implemented behaviour that treated RSA-ES message failures as a DataError, assuming the AES-KW behaviour, so the spec should be explicit either way for interoperability.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>106191</commentid>
    <comment_count>1</comment_count>
    <who name="Ryan Sleevi">sleevi</who>
    <bug_when>2014-05-16 18:46:21 +0000</bug_when>
    <thetext>For what it&apos;s worth, my vote is on OperationError consistently for all of these, as otherwise it implies that implementations may need to be redundantly validating the parameters of the underlying implementation.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>111950</commentid>
    <comment_count>2</comment_count>
    <who name="Mark Watson">watsonm</who>
    <bug_when>2014-09-22 17:50:10 +0000</bug_when>
    <thetext>I agree with normalization to OperationError for all such cases, since the detection of the error may be delegated to cryptographic libraries in some implementations.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>112274</commentid>
    <comment_count>3</comment_count>
    <who name="Mark Watson">watsonm</who>
    <bug_when>2014-09-26 17:32:06 +0000</bug_when>
    <thetext>The following are the instances of explicit operation parameter validation currently in the specification:
- AES-CTR encrypt/decrypt: check counter length -&gt; SyntaxError
- AES-CTR generate: check key length -&gt; SyntaxError
- AES-CTR encrypt/decrypt: check length of counter bits -&gt; SyntaxError
- AES-CBC encrypt/decrypt: check IV length -&gt; SyntaxError
- AES-CBC generate: check key length -&gt; SyntaxError
- AES-GCM encrypt: check plaintext length -&gt; DataError
- AES-GCM encrypt/decrypt: check IV length -&gt; DataError
- AES-GCM encrypt/decrypt: check additional data length -&gt; DataError
- AES-GCM encrypt/decrypt: check tag length -&gt; DataError
- AES-GCM generate:  check key length -&gt; DataError
- AES-CMAC sign/verify: check MAC length -&gt; SyntaxError
- AES-CMAC generate: check key length -&gt; SyntaxError
- AES-CFB encrypt/decrypt: check IV length -&gt; DataError
- AES-CFB generate: check key length -&gt; SyntaxError
- AES-KW wrap: check plaintext length -&gt; DataError
- AES-KW generate: check key length -&gt; SyntaxError
- HMAC generate: check key length is non-zero -&gt; DataError
- HKDF derive: check length is not null -&gt; SyntaxError
- PBKDF2 derive: check length -&gt; SyntaxError

I suggest we leave these checks in the specification, but change them all to OperationError. We therefore leave it to implementors whether the check is done inside or outside whatever cryptographic library is being used.

[I don&apos;t think it would be a good idea to remove the checks without checking first that the same checks are indeed specified in all the referenced specifications. Otherwise we may have a situation where behaviour is undefined].</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>113091</commentid>
    <comment_count>4</comment_count>
    <who name="">virginie.galindo</who>
    <bug_when>2014-10-14 10:03:08 +0000</bug_when>
    <thetext>In order to progress towards exit to Last Call for the Web Crypto API, the chair suggests the following resolution for that bug. 

Resolution : Bug CLOSED. Proposed suggestions made by Mark in https://www.w3.org/Bugs/Public/show_bug.cgi?id=25741#c3 will be implemented. 

If none objects before the 20th of Oct @20:00 UTC, this resolution will be endorsed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>113266</commentid>
    <comment_count>5</comment_count>
    <who name="Mark Watson">watsonm</who>
    <bug_when>2014-10-16 00:43:43 +0000</bug_when>
    <thetext>https://dvcs.w3.org/hg/webcrypto-api/rev/5e7ba79bdf36</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>