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 25436 - Handling of CryptoOperationData needs to be defined
Summary: Handling of CryptoOperationData needs to be defined
Status: RESOLVED FIXED
Alias: None
Product: Web Cryptography
Classification: Unclassified
Component: Web Cryptography API Document (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Ryan Sleevi
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-24 01:56 UTC by Boris Zbarsky
Modified: 2014-06-16 23:22 UTC (History)
1 user (show)

See Also:


Attachments

Description Boris Zbarsky 2014-04-24 01:56:00 UTC
As far as I can tell, nothing actually defines the handling of CryptoOperationData arguments.

For example, looking at https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html#dfn-SubtleCrypto-method-encrypt it just says:

  Let ciphertext be the result of performing the encrypt operation
  specified by normalizedAlgorithm using algorithm and key and with
  data as plaintext.

but nothing ever defines the type of "plaintext" here.  I assume it's meant to be some sort of byte array, right?

If so, the following need to be clearly defined:

1)  How do extract a byte array from an ArrayBufferView.  Presumably this is a matter of looking at the underlying buffer and taking byteLength bytes starting at byteOffset.  And presumably this uses the canonical getters for those properties, not whatever is on the prototype (so the [[ViewedArrayBuffer]], [[ByteLength]], and [[ByteOffset]] internal slots of the object).  Note that at least one implementor just used all the bytes of the underlying ArrayBuffer instead, so this clearly does need defining.

2) The exact point when the snapshot of the data is taken.  This matters, because the data is not immutable.  Presumably there's some sort of data copy before step 3 of https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html#dfn-SubtleCrypto-method-encrypt for example?
Comment 1 Ryan Sleevi 2014-05-12 05:04:17 UTC
Bug 23728 addresses the exact point of snapshot creation, and thus resolves point 2. It also defines how to normalize an ArrayBufferView into an ArrayBuffer (necessary for the Snapshot Creation)

For point 1, the current spec makes use of the language "the contents of X", where X is an ArrayBuffer object. I've updated the spec to clarify, within the terminology section, that when the spec says "The contents of X", it means the sequence of bytes obtained from the Data Block stored within the [[ArrayBufferData]] internal slot of X, whose length in bytes is the value of the [[ArrayBufferByteLength]] internal slot.