<?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>24806</bug_id>
          
          <creation_ts>2014-02-25 17:49:28 +0000</creation_ts>
          <short_desc>Should the spec mandate a minimum key length for HMAC?</short_desc>
          <delta_ts>2014-09-23 16:47:20 +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>WORKSFORME</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>watsonm</cc>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>101347</commentid>
    <comment_count>0</comment_count>
    <who name="Eric Roman">ericroman</who>
    <bug_when>2014-02-25 17:49:28 +0000</bug_when>
    <thetext>Currently the supported key lengths for HMAC is left up to implementations.

Keys shorter than the blocksize are zero padded by HMAC, and keys longer than the blocksize are hashed. So in theory any key length can be supported by the algorithm.

I bring this to your attention because Chromium&apos;s implementation currently has an asymmetry in that zero length keys are supported by importKey() but they are not supported by generateKey()  (NSS is choking on zero length keys given to &quot;PK11_GenerateKeyPairWithOpFlags&quot;). I can resolve this and consistently support zero-length keys in both functions, or in neither for our implementation.

My question is whether this is something that we would want to mention in the spec so that implementations can better inter-operate.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101576</commentid>
    <comment_count>1</comment_count>
    <who name="Mark Watson">watsonm</who>
    <bug_when>2014-02-28 00:49:36 +0000</bug_when>
    <thetext>It seems odd to me to require that people do implementation work for a case that likely has no utility (zero length key) and so I&apos;d suggest that we disallow zero-length keys.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>111940</commentid>
    <comment_count>2</comment_count>
    <who name="Mark Watson">watsonm</who>
    <bug_when>2014-09-22 17:37:36 +0000</bug_when>
    <thetext>In the absence of additional comments, shall we go with my suggestion above to consistently disallow zero-length HMAC keys ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>112029</commentid>
    <comment_count>3</comment_count>
    <who name="Mark Watson">watsonm</who>
    <bug_when>2014-09-23 16:47:20 +0000</bug_when>
    <thetext>The specification already returns DataError if the length field if zero on generateKey() or if the length field or actual data is zero length on importKey().</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>