ISSUE-46: Optional algorithm parameters must have default values

Optional algorithm parameters must have default values

crypto for Web Crypto API
Raised by:
Richard Barnes
Opened on:
In the current editor's draft, several algorithm parameters are marked as optional [1], but there is no default value specified. In most cases, it is obvious enough; many should be set to an empty byte string / ArrayBufferView, for example. However, the specification should state these values to avoid ambiguity, or make them non-optional. I'll address the current parameters in three groups:

First, optional attributes that should be set to the empty ArrayBufferView:
RsaOaepParams.label -> Empty ArrayBufferView
AesGcmParams.additionalData -> Empty ArrayBufferView
ConcatParams.publicInfo -> Empty ArrayBufferView
ConcatParams.privateInfo -> Empty ArrayBufferView
Pbkdf2Params.password -> Empty ArrayBufferView

Second, one optional attribute that should be made non-optional:
AesGcmParams.iv -> Make non-optional

Third, one optional attribute that could either be made non-optional or provided with a safe default:
AesGcmParams.tagLength -> 128 or make non-optional

On the last question, my personal preference would be to keep it optional set the default at 128, since it seems developer-hostile to require this to be specified every time. Going slightly OT, it seems like the same approach could be taken with AesCtrParams.length, making it optional and setting the default equal to 32 (the value that GCM uses).

[1] Technically "nullable" in the WebIDL jargon. But having a null value is functionally equivalent to not having a value specified.
Related Actions Items:
Related emails:
  1. W3C Web Crypto WG - take away from 10th of Feb call (from on 2014-02-13)
  2. Re: ISSUE-44 and ISSUE-46 (from on 2014-02-12)
  3. ISSUE-44 and ISSUE-46 (from on 2014-02-12)
  4. W3C Web Crypto WG - progressing on ISSUE-46 (and ACTION-128) (from on 2014-01-09)
  5. crypto-ISSUE-46: Optional algorithm parameters must have default values [crypto for Web Crypto API] (from on 2013-06-05)

Related notes:

No additional notes.

Display change log ATOM feed

Chair, Staff Contact
Tracker: documentation, (configuration for this group), originally developed by Dean Jackson, is developed and maintained by the Systems Team <>.
$Id: 46.html,v 1.1 2017/02/13 16:16:52 ted Exp $