<?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>25436</bug_id>
          
          <creation_ts>2014-04-24 01:56:00 +0000</creation_ts>
          <short_desc>Handling of CryptoOperationData needs to be defined</short_desc>
          <delta_ts>2014-06-16 23:22:11 +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>All</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>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Boris Zbarsky">bzbarsky</reporter>
          <assigned_to name="Ryan Sleevi">sleevi</assigned_to>
          <cc>public-webcrypto</cc>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>104309</commentid>
    <comment_count>0</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-04-24 01:56:00 +0000</bug_when>
    <thetext>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 &quot;plaintext&quot; here.  I assume it&apos;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&apos;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?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>105672</commentid>
    <comment_count>1</comment_count>
    <who name="Ryan Sleevi">sleevi</who>
    <bug_when>2014-05-12 05:04:17 +0000</bug_when>
    <thetext>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 &quot;the contents of X&quot;, where X is an ArrayBuffer object. I&apos;ve updated the spec to clarify, within the terminology section, that when the spec says &quot;The contents of X&quot;, 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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>107881</commentid>
    <comment_count>2</comment_count>
    <who name="Ryan Sleevi">sleevi</who>
    <bug_when>2014-06-16 23:11:30 +0000</bug_when>
    <thetext>https://dvcs.w3.org/hg/webcrypto-api/rev/b6a1fb5aab25</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>107914</commentid>
    <comment_count>3</comment_count>
    <who name="Ryan Sleevi">sleevi</who>
    <bug_when>2014-06-16 23:22:11 +0000</bug_when>
    <thetext>https://dvcs.w3.org/hg/webcrypto-api/rev/71498804a64d</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>