This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 24806 - Should the spec mandate a minimum key length for HMAC?
Summary: Should the spec mandate a minimum key length for HMAC?
Status: RESOLVED WORKSFORME
Alias: None
Product: Web Cryptography
Classification: Unclassified
Component: Web Cryptography API Document (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: Ryan Sleevi
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-25 17:49 UTC by Eric Roman
Modified: 2014-09-23 16:47 UTC (History)
1 user (show)

See Also:


Attachments

Description Eric Roman 2014-02-25 17:49:28 UTC
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'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 "PK11_GenerateKeyPairWithOpFlags"). 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.
Comment 1 Mark Watson 2014-02-28 00:49:36 UTC
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'd suggest that we disallow zero-length keys.
Comment 2 Mark Watson 2014-09-22 17:37:36 UTC
In the absence of additional comments, shall we go with my suggestion above to consistently disallow zero-length HMAC keys ?
Comment 3 Mark Watson 2014-09-23 16:47:20 UTC
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().