New issue
Advanced search Search tips

Issue 628413 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Jul 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Reject with a TypeError rather than DataError when crypto.subtle.importKey() is given wrong data type

Project Member Reported by eroman@chromium.org, Jul 14 2016

Issue description

According to 14.3.9.6.1 when there is a mismatch between "format" and keyData's type (i.e. expecting a JsonWebKey but got a BufferSource, and vice versa) a TypeError should be returned:

https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-importKey

Chrome however returns a DataError:
 

Comment 1 by eroman@chromium.org, Jul 19 2016

Owner: eroman@chromium.org
Status: Assigned (was: Available)
Project Member

Comment 2 by bugdroid1@chromium.org, Jul 20 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c28c47588a5093e8383b497c6bc8732f088762b3

commit c28c47588a5093e8383b497c6bc8732f088762b3
Author: eroman <eroman@chromium.org>
Date: Wed Jul 20 02:27:21 2016

Miscelaneous updates to WebCrypto to match latest spec.

 * Matches version 2ac0c945d78d8b66246ce47c5a366a1fd6464aa5 of
   https://github.com/w3c/webcrypto
 * Adds comments referencing the spec procedure text
 * Renames "algorithm" --> "normalizedAlgorithm" to match spec text
 * Re-orders an algorithm normalization step
 * Changes DataError --> TypeError for an importKey() case

BUG= 628413 

Review-Url: https://codereview.chromium.org/2159313002
Cr-Commit-Position: refs/heads/master@{#406467}

[modify] https://crrev.com/c28c47588a5093e8383b497c6bc8732f088762b3/third_party/WebKit/LayoutTests/crypto/subtle/hkdf/importKey-failures-expected.txt
[modify] https://crrev.com/c28c47588a5093e8383b497c6bc8732f088762b3/third_party/WebKit/LayoutTests/crypto/subtle/importKey-badParameters-expected.txt
[modify] https://crrev.com/c28c47588a5093e8383b497c6bc8732f088762b3/third_party/WebKit/Source/modules/crypto/SubtleCrypto.cpp

Comment 3 by eroman@chromium.org, Jul 20 2016

Status: Fixed (was: Assigned)

Sign in to add a comment