Changeset 208548 in webkit


Ignore:
Timestamp:
Nov 10, 2016 10:36:44 AM (7 years ago)
Author:
jiewen_tan@apple.com
Message:

Update SubtleCrypto::importKey to match the latest spec
https://bugs.webkit.org/show_bug.cgi?id=164446
<rdar://problem/29123621>

Reviewed by Brent Fulgham.

LayoutTests/imported/w3c:

  • WebCryptoAPI/idlharness-expected.txt:

Source/WebCore:

This patch does following few things:

  1. It updates the SubtleCrypto::importKey method to match the latest spec: https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-importKey. It also refers to the latest Editor's Draft at a certain degree: https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-importKey.
  2. It implements importKey operations of following algorithms: AES-CBC, AES-KW, HMAC, RSAES-PKCS1-V1_5, RSASSA-PKCS1-V1_5, and RSA-OAEP.
  3. It fixes some minor problems of SubtleCrypto::generateKey.
  4. It addes move constructors for CryptoKeyAES, CryptoKeyHMAC, CryptoKeyRSA and CryptoKeyDataRSAComponents.
  5. It renames HmacKeyGenParams to HmacKeyParams to serve the purpose of both HmacKeyGenParams and HmacImportParams which are essentially the same.
  6. It enforces the key length in bits of CryptoKeyHMAC to be multiples of 8.
  7. It also fixes the following bugs: https://bugs.webkit.org/show_bug.cgi?id=126033, https://bugs.webkit.org/show_bug.cgi?id=126034, https://bugs.webkit.org/show_bug.cgi?id=151308.

P.S. We currently only support Raw and Jwk key format.

Tests: crypto/subtle/aes-cbc-import-jwk-key-length-128.html

crypto/subtle/aes-cbc-import-jwk-key-length-192.html
crypto/subtle/aes-cbc-import-jwk-key-length-256.html
crypto/subtle/aes-cbc-import-jwk-key-minimum.html
crypto/subtle/aes-cbc-import-jwk-key-non-extractable.html
crypto/subtle/aes-cbc-import-raw-key-length-128.html
crypto/subtle/aes-cbc-import-raw-key-length-192.html
crypto/subtle/aes-cbc-import-raw-key-length-256.html
crypto/subtle/aes-import-key-malformed-parameters.html
crypto/subtle/aes-kw-import-jwk-key-length-128.html
crypto/subtle/aes-kw-import-jwk-key-length-192.html
crypto/subtle/aes-kw-import-jwk-key-length-256.html
crypto/subtle/aes-kw-import-raw-key.html
crypto/subtle/generate-key-malformed-parameters.html
crypto/subtle/hmac-import-jwk-key-minimum.html
crypto/subtle/hmac-import-jwk-key-non-extractable.html
crypto/subtle/hmac-import-jwk-key-sha1.html
crypto/subtle/hmac-import-jwk-key-sha224.html
crypto/subtle/hmac-import-jwk-key-sha256.html
crypto/subtle/hmac-import-jwk-key-sha384.html
crypto/subtle/hmac-import-jwk-key-sha512.html
crypto/subtle/hmac-import-malformed-parameters.html
crypto/subtle/hmac-import-raw-key-customized-length.html
crypto/subtle/hmac-import-raw-key.html
crypto/subtle/import-key-malformed-parameters.html
crypto/subtle/rsa-import-key-malformed-parameters.html
crypto/subtle/rsa-oaep-import-jwk-private-key.html
crypto/subtle/rsa-oaep-import-jwk-public-key-sha1.html
crypto/subtle/rsa-oaep-import-jwk-public-key-sha224.html
crypto/subtle/rsa-oaep-import-jwk-public-key-sha256.html
crypto/subtle/rsa-oaep-import-jwk-public-key-sha384.html
crypto/subtle/rsa-oaep-import-jwk-public-key-sha512.html
crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-private-key.html
crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-leading-zero.html
crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-minimum.html
crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-non-extractable.html
crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key.html
crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-private-key.html
crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha1.html
crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha224.html
crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha256.html
crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha384.html
crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha512.html
crypto/workers/subtle/aes-import-jwk-key.html
crypto/workers/subtle/aes-import-raw-key.html
crypto/workers/subtle/hmac-import-jwk-key.html
crypto/workers/subtle/hmac-import-raw-key.html
crypto/workers/subtle/rsa-import-jwk-private-key.html
crypto/workers/subtle/rsa-import-jwk-public-key.html

  • CMakeLists.txt:
  • DerivedSources.make:
  • PlatformEfl.cmake:
  • PlatformGTK.cmake:
  • PlatformMac.cmake:
  • WebCore.xcodeproj/project.pbxproj:
  • bindings/js/JSSubtleCryptoCustom.cpp:

(WebCore::normalizeCryptoAlgorithmParameters):
(WebCore::cryptoKeyUsageFromString):
(WebCore::cryptoKeyUsagesFromJSValue):
(WebCore::toKeyData):
(WebCore::jsSubtleCryptoFunctionGenerateKeyPromise):
(WebCore::jsSubtleCryptoFunctionImportKeyPromise):
(WebCore::JSSubtleCrypto::importKey):

  • crypto/CryptoAlgorithm.cpp:

(WebCore::CryptoAlgorithm::importKey):

  • crypto/CryptoAlgorithm.h:
  • crypto/CryptoAlgorithmParameters.h:
  • crypto/JsonWebKey.h: Added.
  • crypto/JsonWebKey.idl: Added.
  • crypto/RsaOtherPrimesInfo.h: Added.
  • crypto/RsaOtherPrimesInfo.idl: Added.
  • crypto/SubtleCrypto.h:
  • crypto/SubtleCrypto.idl:
  • crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:

(WebCore::CryptoAlgorithmAES_CBC::generateKey):
(WebCore::CryptoAlgorithmAES_CBC::importKey):

  • crypto/algorithms/CryptoAlgorithmAES_CBC.h:
  • crypto/algorithms/CryptoAlgorithmAES_KW.cpp:

(WebCore::CryptoAlgorithmAES_KW::generateKey):
(WebCore::CryptoAlgorithmAES_KW::importKey):

  • crypto/algorithms/CryptoAlgorithmAES_KW.h:
  • crypto/algorithms/CryptoAlgorithmHMAC.cpp:

(WebCore::CryptoAlgorithmHMAC::generateKey):
(WebCore::CryptoAlgorithmHMAC::importKey):

  • crypto/algorithms/CryptoAlgorithmHMAC.h:
  • crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:

(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):

  • crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
  • crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:

(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):

  • crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
  • crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:

(WebCore::CryptoAlgorithmRSA_OAEP::importKey):

  • crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
  • crypto/keys/CryptoKeyAES.cpp:

(WebCore::CryptoKeyAES::CryptoKeyAES):
(WebCore::CryptoKeyAES::generate):
(WebCore::CryptoKeyAES::importRaw):
(WebCore::CryptoKeyAES::importJwk):

  • crypto/keys/CryptoKeyAES.h:
  • crypto/keys/CryptoKeyDataRSAComponents.cpp:

(WebCore::CryptoKeyDataRSAComponents::CryptoKeyDataRSAComponents):

  • crypto/keys/CryptoKeyDataRSAComponents.h:
  • crypto/keys/CryptoKeyHMAC.cpp:

(WebCore::CryptoKeyHMAC::CryptoKeyHMAC):
(WebCore::CryptoKeyHMAC::generate):
(WebCore::CryptoKeyHMAC::importRaw):
(WebCore::CryptoKeyHMAC::importJwk):
(WebCore::CryptoKeyHMAC::buildAlgorithm):

  • crypto/keys/CryptoKeyHMAC.h:
  • crypto/keys/CryptoKeyRSA.cpp: Added.

(WebCore::CryptoKeyRSA::importJwk):

  • crypto/keys/CryptoKeyRSA.h:
  • crypto/parameters/CryptoAlgorithmHmacKeyParams.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmHmacKeyGenParams.h.
  • crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h: Added.
  • crypto/parameters/HmacKeyParams.idl: Renamed from Source/WebCore/crypto/parameters/HmacKeyGenParams.idl.
  • crypto/parameters/RsaHashedImportParams.idl: Added.

LayoutTests:

Besides adding test cases for SubtleCrypto::importKey. This patch also corrects a typo:
generate-key-malformed-paramters*.

  • crypto/subtle/aes-cbc-import-jwk-key-length-128-expected.txt: Added.
  • crypto/subtle/aes-cbc-import-jwk-key-length-128.html: Added.
  • crypto/subtle/aes-cbc-import-jwk-key-length-192-expected.txt: Added.
  • crypto/subtle/aes-cbc-import-jwk-key-length-192.html: Added.
  • crypto/subtle/aes-cbc-import-jwk-key-length-256-expected.txt: Added.
  • crypto/subtle/aes-cbc-import-jwk-key-length-256.html: Added.
  • crypto/subtle/aes-cbc-import-jwk-key-minimum-expected.txt: Added.
  • crypto/subtle/aes-cbc-import-jwk-key-minimum.html: Added.
  • crypto/subtle/aes-cbc-import-jwk-key-non-extractable-expected.txt: Added.
  • crypto/subtle/aes-cbc-import-jwk-key-non-extractable.html: Added.
  • crypto/subtle/aes-cbc-import-raw-key-length-128-expected.txt: Added.
  • crypto/subtle/aes-cbc-import-raw-key-length-128.html: Added.
  • crypto/subtle/aes-cbc-import-raw-key-length-192-expected.txt: Added.
  • crypto/subtle/aes-cbc-import-raw-key-length-192.html: Added.
  • crypto/subtle/aes-cbc-import-raw-key-length-256-expected.txt: Added.
  • crypto/subtle/aes-cbc-import-raw-key-length-256.html: Added.
  • crypto/subtle/aes-import-key-malformed-parameters-expected.txt: Added.
  • crypto/subtle/aes-import-key-malformed-parameters.html: Added.
  • crypto/subtle/aes-kw-import-jwk-key-length-128-expected.txt: Added.
  • crypto/subtle/aes-kw-import-jwk-key-length-128.html: Added.
  • crypto/subtle/aes-kw-import-jwk-key-length-192-expected.txt: Added.
  • crypto/subtle/aes-kw-import-jwk-key-length-192.html: Added.
  • crypto/subtle/aes-kw-import-jwk-key-length-256-expected.txt: Added.
  • crypto/subtle/aes-kw-import-jwk-key-length-256.html: Added.
  • crypto/subtle/aes-kw-import-raw-key-expected.txt: Added.
  • crypto/subtle/aes-kw-import-raw-key.html: Added.
  • crypto/subtle/generate-key-malformed-parameters-expected.txt: Renamed from LayoutTests/crypto/subtle/generate-key-malformed-paramters-expected.txt.
  • crypto/subtle/generate-key-malformed-parameters.html: Renamed from LayoutTests/crypto/subtle/generate-key-malformed-paramters.html.
  • crypto/subtle/hmac-generate-key-customized-length-expected.txt:
  • crypto/subtle/hmac-generate-key-customized-length.html:
  • crypto/subtle/hmac-generate-key-malformed-parameters-expected.txt:
  • crypto/subtle/hmac-generate-key-malformed-parameters.html:
  • crypto/subtle/hmac-import-raw-key-customized-length-expected.txt:
  • crypto/subtle/hmac-import-raw-key-customized-length.html:
  • crypto/subtle/hmac-import-jwk-key-minimum-expected.txt: Added.
  • crypto/subtle/hmac-import-jwk-key-minimum.html: Added.
  • crypto/subtle/hmac-import-jwk-key-non-extractable-expected.txt: Added.
  • crypto/subtle/hmac-import-jwk-key-non-extractable.html: Added.
  • crypto/subtle/hmac-import-jwk-key-sha1-expected.txt: Added.
  • crypto/subtle/hmac-import-jwk-key-sha1.html: Added.
  • crypto/subtle/hmac-import-jwk-key-sha224-expected.txt: Added.
  • crypto/subtle/hmac-import-jwk-key-sha224.html: Added.
  • crypto/subtle/hmac-import-jwk-key-sha256-expected.txt: Added.
  • crypto/subtle/hmac-import-jwk-key-sha256.html: Added.
  • crypto/subtle/hmac-import-jwk-key-sha384-expected.txt: Added.
  • crypto/subtle/hmac-import-jwk-key-sha384.html: Added.
  • crypto/subtle/hmac-import-jwk-key-sha512-expected.txt: Added.
  • crypto/subtle/hmac-import-jwk-key-sha512.html: Added.
  • crypto/subtle/hmac-import-malformed-parameters-expected.txt: Added.
  • crypto/subtle/hmac-import-malformed-parameters.html: Added.
  • crypto/subtle/hmac-import-raw-key-customized-length-expected.txt: Added.
  • crypto/subtle/hmac-import-raw-key-customized-length.html: Added.
  • crypto/subtle/hmac-import-raw-key-expected.txt: Added.
  • crypto/subtle/hmac-import-raw-key.html: Added.
  • crypto/subtle/import-key-malformed-parameters-expected.txt: Added.
  • crypto/subtle/import-key-malformed-parameters.html: Added.
  • crypto/subtle/rsa-import-key-malformed-parameters-expected.txt: Added.
  • crypto/subtle/rsa-import-key-malformed-parameters.html: Added.
  • crypto/subtle/rsa-oaep-import-jwk-private-key-expected.txt: Added.
  • crypto/subtle/rsa-oaep-import-jwk-private-key.html: Added.
  • crypto/subtle/rsa-oaep-import-jwk-public-key-sha1-expected.txt: Added.
  • crypto/subtle/rsa-oaep-import-jwk-public-key-sha1.html: Added.
  • crypto/subtle/rsa-oaep-import-jwk-public-key-sha224-expected.txt: Added.
  • crypto/subtle/rsa-oaep-import-jwk-public-key-sha224.html: Added.
  • crypto/subtle/rsa-oaep-import-jwk-public-key-sha256-expected.txt: Added.
  • crypto/subtle/rsa-oaep-import-jwk-public-key-sha256.html: Added.
  • crypto/subtle/rsa-oaep-import-jwk-public-key-sha384-expected.txt: Added.
  • crypto/subtle/rsa-oaep-import-jwk-public-key-sha384.html: Added.
  • crypto/subtle/rsa-oaep-import-jwk-public-key-sha512-expected.txt: Added.
  • crypto/subtle/rsa-oaep-import-jwk-public-key-sha512.html: Added.
  • crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-private-key-expected.txt: Added.
  • crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-private-key.html: Added.
  • crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-expected.txt: Added.
  • crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-leading-zero-expected.txt: Added.
  • crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-leading-zero.html: Added.
  • crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-minimum-expected.txt: Added.
  • crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-minimum.html: Added.
  • crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-non-extractable-expected.txt: Added.
  • crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-non-extractable.html: Added.
  • crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key.html: Added.
  • crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-private-key-expected.txt: Added.
  • crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-private-key.html: Added.
  • crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha1-expected.txt: Added.
  • crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha1.html: Added.
  • crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha224-expected.txt: Added.
  • crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha224.html: Added.
  • crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha256-expected.txt: Added.
  • crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha256.html: Added.
  • crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha384-expected.txt: Added.
  • crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha384.html: Added.
  • crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha512-expected.txt: Added.
  • crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha512.html: Added.
  • crypto/webkitSubtle/hmac-generate-key-expected.txt:
  • crypto/webkitSubtle/hmac-generate-key.html:
  • crypto/webkitSubtle/hmac-import-jwk-expected.txt:
  • crypto/webkitSubtle/hmac-import-jwk.html:
  • crypto/webkitSubtle/hmac-postMessage-expected.txt:
  • crypto/webkitSubtle/hmac-postMessage.html:
  • crypto/webkitSubtle/hmac-sign-verify-expected.txt:
  • crypto/webkitSubtle/hmac-sign-verify.html:
  • crypto/workers/subtle/aes-import-jwk-key-expected.txt: Added.
  • crypto/workers/subtle/aes-import-jwk-key.html: Added.
  • crypto/workers/subtle/aes-import-raw-key-expected.txt: Added.
  • crypto/workers/subtle/aes-import-raw-key.html: Added.
  • crypto/workers/subtle/hmac-import-jwk-key-expected.txt: Added.
  • crypto/workers/subtle/hmac-import-jwk-key.html: Added.
  • crypto/workers/subtle/hmac-import-raw-key-expected.txt: Added.
  • crypto/workers/subtle/hmac-import-raw-key.html: Added.
  • crypto/workers/subtle/hmac-postMessage-worker-expected.txt:
  • crypto/workers/subtle/hmac-postMessage-worker.html:
  • crypto/workers/subtle/resources/aes-import-jwk-key.js: Added.
  • crypto/workers/subtle/resources/aes-import-raw-key.js: Added.
  • crypto/workers/subtle/resources/hmac-import-jwk-key.js: Added.
  • crypto/workers/subtle/resources/hmac-import-raw-key.js: Added.
  • crypto/workers/subtle/resources/hmac-postMessage-worker.js:
  • crypto/workers/subtle/resources/rsa-import-jwk-private-key.js: Added.
  • crypto/workers/subtle/resources/rsa-import-jwk-public-key.js: Added.
  • crypto/workers/subtle/rsa-import-jwk-private-key-expected.txt: Added.
  • crypto/workers/subtle/rsa-import-jwk-private-key.html: Added.
  • crypto/workers/subtle/rsa-import-jwk-public-key-expected.txt: Added.
  • crypto/workers/subtle/rsa-import-jwk-public-key.html: Added.
Location:
trunk
Files:
84 added
50 edited
25 copied
4 moved

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r208547 r208548  
     12016-11-04  Jiewen Tan  <jiewen_tan@apple.com>
     2
     3        Update SubtleCrypto::importKey to match the latest spec
     4        https://bugs.webkit.org/show_bug.cgi?id=164446
     5        <rdar://problem/29123621>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        Besides adding test cases for SubtleCrypto::importKey. This patch also corrects a typo:
     10        generate-key-malformed-paramters*.
     11
     12        * crypto/subtle/aes-cbc-import-jwk-key-length-128-expected.txt: Added.
     13        * crypto/subtle/aes-cbc-import-jwk-key-length-128.html: Added.
     14        * crypto/subtle/aes-cbc-import-jwk-key-length-192-expected.txt: Added.
     15        * crypto/subtle/aes-cbc-import-jwk-key-length-192.html: Added.
     16        * crypto/subtle/aes-cbc-import-jwk-key-length-256-expected.txt: Added.
     17        * crypto/subtle/aes-cbc-import-jwk-key-length-256.html: Added.
     18        * crypto/subtle/aes-cbc-import-jwk-key-minimum-expected.txt: Added.
     19        * crypto/subtle/aes-cbc-import-jwk-key-minimum.html: Added.
     20        * crypto/subtle/aes-cbc-import-jwk-key-non-extractable-expected.txt: Added.
     21        * crypto/subtle/aes-cbc-import-jwk-key-non-extractable.html: Added.
     22        * crypto/subtle/aes-cbc-import-raw-key-length-128-expected.txt: Added.
     23        * crypto/subtle/aes-cbc-import-raw-key-length-128.html: Added.
     24        * crypto/subtle/aes-cbc-import-raw-key-length-192-expected.txt: Added.
     25        * crypto/subtle/aes-cbc-import-raw-key-length-192.html: Added.
     26        * crypto/subtle/aes-cbc-import-raw-key-length-256-expected.txt: Added.
     27        * crypto/subtle/aes-cbc-import-raw-key-length-256.html: Added.
     28        * crypto/subtle/aes-import-key-malformed-parameters-expected.txt: Added.
     29        * crypto/subtle/aes-import-key-malformed-parameters.html: Added.
     30        * crypto/subtle/aes-kw-import-jwk-key-length-128-expected.txt: Added.
     31        * crypto/subtle/aes-kw-import-jwk-key-length-128.html: Added.
     32        * crypto/subtle/aes-kw-import-jwk-key-length-192-expected.txt: Added.
     33        * crypto/subtle/aes-kw-import-jwk-key-length-192.html: Added.
     34        * crypto/subtle/aes-kw-import-jwk-key-length-256-expected.txt: Added.
     35        * crypto/subtle/aes-kw-import-jwk-key-length-256.html: Added.
     36        * crypto/subtle/aes-kw-import-raw-key-expected.txt: Added.
     37        * crypto/subtle/aes-kw-import-raw-key.html: Added.
     38        * crypto/subtle/generate-key-malformed-parameters-expected.txt: Renamed from LayoutTests/crypto/subtle/generate-key-malformed-paramters-expected.txt.
     39        * crypto/subtle/generate-key-malformed-parameters.html: Renamed from LayoutTests/crypto/subtle/generate-key-malformed-paramters.html.
     40        * crypto/subtle/hmac-generate-key-customized-length-expected.txt:
     41        * crypto/subtle/hmac-generate-key-customized-length.html:
     42        * crypto/subtle/hmac-generate-key-malformed-parameters-expected.txt:
     43        * crypto/subtle/hmac-generate-key-malformed-parameters.html:
     44        * crypto/subtle/hmac-import-raw-key-customized-length-expected.txt:
     45        * crypto/subtle/hmac-import-raw-key-customized-length.html:
     46        * crypto/subtle/hmac-import-jwk-key-minimum-expected.txt: Added.
     47        * crypto/subtle/hmac-import-jwk-key-minimum.html: Added.
     48        * crypto/subtle/hmac-import-jwk-key-non-extractable-expected.txt: Added.
     49        * crypto/subtle/hmac-import-jwk-key-non-extractable.html: Added.
     50        * crypto/subtle/hmac-import-jwk-key-sha1-expected.txt: Added.
     51        * crypto/subtle/hmac-import-jwk-key-sha1.html: Added.
     52        * crypto/subtle/hmac-import-jwk-key-sha224-expected.txt: Added.
     53        * crypto/subtle/hmac-import-jwk-key-sha224.html: Added.
     54        * crypto/subtle/hmac-import-jwk-key-sha256-expected.txt: Added.
     55        * crypto/subtle/hmac-import-jwk-key-sha256.html: Added.
     56        * crypto/subtle/hmac-import-jwk-key-sha384-expected.txt: Added.
     57        * crypto/subtle/hmac-import-jwk-key-sha384.html: Added.
     58        * crypto/subtle/hmac-import-jwk-key-sha512-expected.txt: Added.
     59        * crypto/subtle/hmac-import-jwk-key-sha512.html: Added.
     60        * crypto/subtle/hmac-import-malformed-parameters-expected.txt: Added.
     61        * crypto/subtle/hmac-import-malformed-parameters.html: Added.
     62        * crypto/subtle/hmac-import-raw-key-customized-length-expected.txt: Added.
     63        * crypto/subtle/hmac-import-raw-key-customized-length.html: Added.
     64        * crypto/subtle/hmac-import-raw-key-expected.txt: Added.
     65        * crypto/subtle/hmac-import-raw-key.html: Added.
     66        * crypto/subtle/import-key-malformed-parameters-expected.txt: Added.
     67        * crypto/subtle/import-key-malformed-parameters.html: Added.
     68        * crypto/subtle/rsa-import-key-malformed-parameters-expected.txt: Added.
     69        * crypto/subtle/rsa-import-key-malformed-parameters.html: Added.
     70        * crypto/subtle/rsa-oaep-import-jwk-private-key-expected.txt: Added.
     71        * crypto/subtle/rsa-oaep-import-jwk-private-key.html: Added.
     72        * crypto/subtle/rsa-oaep-import-jwk-public-key-sha1-expected.txt: Added.
     73        * crypto/subtle/rsa-oaep-import-jwk-public-key-sha1.html: Added.
     74        * crypto/subtle/rsa-oaep-import-jwk-public-key-sha224-expected.txt: Added.
     75        * crypto/subtle/rsa-oaep-import-jwk-public-key-sha224.html: Added.
     76        * crypto/subtle/rsa-oaep-import-jwk-public-key-sha256-expected.txt: Added.
     77        * crypto/subtle/rsa-oaep-import-jwk-public-key-sha256.html: Added.
     78        * crypto/subtle/rsa-oaep-import-jwk-public-key-sha384-expected.txt: Added.
     79        * crypto/subtle/rsa-oaep-import-jwk-public-key-sha384.html: Added.
     80        * crypto/subtle/rsa-oaep-import-jwk-public-key-sha512-expected.txt: Added.
     81        * crypto/subtle/rsa-oaep-import-jwk-public-key-sha512.html: Added.
     82        * crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-private-key-expected.txt: Added.
     83        * crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-private-key.html: Added.
     84        * crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-expected.txt: Added.
     85        * crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-leading-zero-expected.txt: Added.
     86        * crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-leading-zero.html: Added.
     87        * crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-minimum-expected.txt: Added.
     88        * crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-minimum.html: Added.
     89        * crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-non-extractable-expected.txt: Added.
     90        * crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-non-extractable.html: Added.
     91        * crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key.html: Added.
     92        * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-private-key-expected.txt: Added.
     93        * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-private-key.html: Added.
     94        * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha1-expected.txt: Added.
     95        * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha1.html: Added.
     96        * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha224-expected.txt: Added.
     97        * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha224.html: Added.
     98        * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha256-expected.txt: Added.
     99        * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha256.html: Added.
     100        * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha384-expected.txt: Added.
     101        * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha384.html: Added.
     102        * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha512-expected.txt: Added.
     103        * crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha512.html: Added.
     104        * crypto/webkitSubtle/hmac-generate-key-expected.txt:
     105        * crypto/webkitSubtle/hmac-generate-key.html:
     106        * crypto/webkitSubtle/hmac-import-jwk-expected.txt:
     107        * crypto/webkitSubtle/hmac-import-jwk.html:
     108        * crypto/webkitSubtle/hmac-postMessage-expected.txt:
     109        * crypto/webkitSubtle/hmac-postMessage.html:
     110        * crypto/webkitSubtle/hmac-sign-verify-expected.txt:
     111        * crypto/webkitSubtle/hmac-sign-verify.html:
     112        * crypto/workers/subtle/aes-import-jwk-key-expected.txt: Added.
     113        * crypto/workers/subtle/aes-import-jwk-key.html: Added.
     114        * crypto/workers/subtle/aes-import-raw-key-expected.txt: Added.
     115        * crypto/workers/subtle/aes-import-raw-key.html: Added.
     116        * crypto/workers/subtle/hmac-import-jwk-key-expected.txt: Added.
     117        * crypto/workers/subtle/hmac-import-jwk-key.html: Added.
     118        * crypto/workers/subtle/hmac-import-raw-key-expected.txt: Added.
     119        * crypto/workers/subtle/hmac-import-raw-key.html: Added.
     120        * crypto/workers/subtle/hmac-postMessage-worker-expected.txt:
     121        * crypto/workers/subtle/hmac-postMessage-worker.html:
     122        * crypto/workers/subtle/resources/aes-import-jwk-key.js: Added.
     123        * crypto/workers/subtle/resources/aes-import-raw-key.js: Added.
     124        * crypto/workers/subtle/resources/hmac-import-jwk-key.js: Added.
     125        * crypto/workers/subtle/resources/hmac-import-raw-key.js: Added.
     126        * crypto/workers/subtle/resources/hmac-postMessage-worker.js:
     127        * crypto/workers/subtle/resources/rsa-import-jwk-private-key.js: Added.
     128        * crypto/workers/subtle/resources/rsa-import-jwk-public-key.js: Added.
     129        * crypto/workers/subtle/rsa-import-jwk-private-key-expected.txt: Added.
     130        * crypto/workers/subtle/rsa-import-jwk-private-key.html: Added.
     131        * crypto/workers/subtle/rsa-import-jwk-public-key-expected.txt: Added.
     132        * crypto/workers/subtle/rsa-import-jwk-public-key.html: Added.
     133
    11342016-11-10  Ryan Haddad  <ryanhaddad@apple.com>
    2135
  • trunk/LayoutTests/crypto/subtle/aes-kw-import-jwk-key-length-128-expected.txt

    r208547 r208548  
    1 Test sending crypto keys via postMessage.
     1Test importing a JWK AES-KW key with legnth 128
    22
    33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
    44
    55
     6Importing a key...
    67PASS key.type is 'secret'
    78PASS key.extractable is true
    8 PASS key.algorithm.name is 'HMAC'
    9 PASS key.algorithm.length is 16
    10 PASS key.usages is ["sign", "verify"]
     9PASS key.algorithm.name is 'AES-KW'
     10PASS key.algorithm.length is 128
     11PASS key.usages is ['unwrapKey', 'wrapKey']
    1112PASS successfullyParsed is true
    1213
  • trunk/LayoutTests/crypto/subtle/aes-kw-import-jwk-key-length-128.html

    r208547 r208548  
    1010
    1111<script>
    12 description("Test generating a HMAC key with customized length.");
     12description("Test importing a JWK AES-KW key with legnth 128");
    1313
    1414jsTestIsAsync = true;
    1515
     16var jwkKey = {
     17    kty: "oct",
     18    k: "YWJjZGVmZ2gxMjM0NTY3OA",
     19    alg: "A128KW",
     20};
    1621var extractable = true;
    1722
    18 debug("\nGenerating a key...");
    19 crypto.subtle.generateKey({name: "hmac", hash: "sha-512", length: 111}, extractable, ["sign", "verify"]).then(function(result) {
     23debug("Importing a key...");
     24crypto.subtle.importKey("jwk", jwkKey, "aes-kw", extractable, ["wrapKey", "unwrapKey"]).then(function(result) {
    2025    key = result;
    2126
    2227    shouldBe("key.type", "'secret'");
    2328    shouldBe("key.extractable", "true");
    24     shouldBe("key.algorithm.name", "'HMAC'");
    25     shouldBe("key.algorithm.length", "111");
    26     shouldBe("key.algorithm.hash.name", "'SHA-512'");
    27     shouldBe("key.usages", '["sign", "verify"]');
     29    shouldBe("key.algorithm.name", "'AES-KW'");
     30    shouldBe("key.algorithm.length", "128");
     31    shouldBe("key.usages", "['unwrapKey', 'wrapKey']");
    2832
    2933    finishJSTest();
    3034});
     35
    3136</script>
    3237
  • trunk/LayoutTests/crypto/subtle/aes-kw-import-jwk-key-length-192-expected.txt

    r208547 r208548  
    1 Test sending crypto keys via postMessage.
     1Test importing a JWK AES-KW key with legnth 192
    22
    33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
    44
    55
     6Importing a key...
    67PASS key.type is 'secret'
    78PASS key.extractable is true
    8 PASS key.algorithm.name is 'HMAC'
    9 PASS key.algorithm.length is 16
    10 PASS key.usages is ["sign", "verify"]
     9PASS key.algorithm.name is 'AES-KW'
     10PASS key.algorithm.length is 192
     11PASS key.usages is ['unwrapKey', 'wrapKey']
    1112PASS successfullyParsed is true
    1213
  • trunk/LayoutTests/crypto/subtle/aes-kw-import-jwk-key-length-256-expected.txt

    r208547 r208548  
    1 Test sending crypto keys via postMessage.
     1Test importing a JWK AES-KW key with legnth 256
    22
    33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
    44
    55
     6Importing a key...
    67PASS key.type is 'secret'
    78PASS key.extractable is true
    8 PASS key.algorithm.name is 'HMAC'
    9 PASS key.algorithm.length is 16
    10 PASS key.usages is ["sign", "verify"]
     9PASS key.algorithm.name is 'AES-KW'
     10PASS key.algorithm.length is 256
     11PASS key.usages is ['unwrapKey', 'wrapKey']
    1112PASS successfullyParsed is true
    1213
  • trunk/LayoutTests/crypto/subtle/aes-kw-import-raw-key-expected.txt

    r208547 r208548  
    1 Test sending crypto keys via postMessage.
     1Test importing a raw AES-KW key with legnth 128
    22
    33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
    44
    55
     6Importing a key...
    67PASS key.type is 'secret'
    78PASS key.extractable is true
    8 PASS key.algorithm.name is 'HMAC'
    9 PASS key.algorithm.length is 16
    10 PASS key.usages is ["sign", "verify"]
     9PASS key.algorithm.name is 'AES-KW'
     10PASS key.algorithm.length is 128
     11PASS key.usages is ['unwrapKey', 'wrapKey']
    1112PASS successfullyParsed is true
    1213
  • trunk/LayoutTests/crypto/subtle/aes-kw-import-raw-key.html

    r208547 r208548  
    1010
    1111<script>
    12 description("Test generating a HMAC key with customized length.");
     12description("Test importing a raw AES-KW key with legnth 128");
    1313
    1414jsTestIsAsync = true;
    1515
     16var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
    1617var extractable = true;
    1718
    18 debug("\nGenerating a key...");
    19 crypto.subtle.generateKey({name: "hmac", hash: "sha-512", length: 111}, extractable, ["sign", "verify"]).then(function(result) {
     19debug("Importing a key...");
     20crypto.subtle.importKey("raw", rawKey, "aes-kw", extractable, ["wrapKey", "unwrapKey"]).then(function(result) {
    2021    key = result;
    2122
    2223    shouldBe("key.type", "'secret'");
    2324    shouldBe("key.extractable", "true");
    24     shouldBe("key.algorithm.name", "'HMAC'");
    25     shouldBe("key.algorithm.length", "111");
    26     shouldBe("key.algorithm.hash.name", "'SHA-512'");
    27     shouldBe("key.usages", '["sign", "verify"]');
     25    shouldBe("key.algorithm.name", "'AES-KW'");
     26    shouldBe("key.algorithm.length", "128");
     27    shouldBe("key.usages", "['unwrapKey', 'wrapKey']");
    2828
    2929    finishJSTest();
    3030});
     31
    3132</script>
    3233
  • trunk/LayoutTests/crypto/subtle/generate-key-malformed-parameters-expected.txt

    r208547 r208548  
    77PASS crypto.subtle.generateKey(1) rejected promise  with TypeError: Not enough arguments.
    88PASS crypto.subtle.generateKey(1, 2) rejected promise  with TypeError: Not enough arguments.
    9 PASS crypto.subtle.generateKey(1, 2, 3) rejected promise  with TypeError: Invalid AlgorithmIdentifier.
    109PASS crypto.subtle.generateKey("foo", 2, 3) rejected promise  with NotSupportedError (DOM Exception 9): The operation is not supported..
    1110PASS crypto.subtle.generateKey({name: 1}, 2, 3) rejected promise  with NotSupportedError (DOM Exception 9): The operation is not supported..
     
    1918PASS crypto.subtle.generateKey({name: "hmac", hash: 1}, extractable, ["sign", "verify"]) rejected promise  with TypeError: Invalid AlgorithmIdentifier.
    2019PASS crypto.subtle.generateKey({name: "hmac", hash: null}, extractable, ["sign", "verify"]) rejected promise  with TypeError: Invalid AlgorithmIdentifier.
    21 PASS crypto.subtle.generateKey({name: "hmac", hash: undefined}, extractable, ["sign", "verify"]) rejected promise  with TypeError: Member HmacKeyGenParams.hash is required and must be an instance of any.
     20PASS crypto.subtle.generateKey({name: "hmac", hash: undefined}, extractable, ["sign", "verify"]) rejected promise  with TypeError: Member HmacKeyParams.hash is required and must be an instance of any.
    2221PASS crypto.subtle.generateKey({name: "hmac", hash: Symbol()}, extractable, ["sign", "verify"]) rejected promise  with TypeError: Invalid AlgorithmIdentifier.
    2322PASS crypto.subtle.generateKey({name: "hmac", hash: { }}, extractable, ["sign", "verify"]) rejected promise  with TypeError: Member CryptoAlgorithmParameters.name is required and must be an instance of DOMString.
     
    4140PASS crypto.subtle.generateKey({name: "AES-CBC", length: 128}, extractable, { }) rejected promise  with TypeError: Type error.
    4241PASS crypto.subtle.generateKey({name: "AES-CBC", length: 128}, extractable, "foo") rejected promise  with TypeError: Invalid KeyUsages.
     42PASS crypto.subtle.generateKey({name: "AES-CBC", length: 128}, extractable, ["foo"]) rejected promise  with TypeError: Invalid KeyUsages.
    4343PASS crypto.subtle.generateKey({name: "AES-CBC", length: 128}, extractable, [ ]) rejected promise  with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
    4444PASS crypto.subtle.generateKey({name: "RSAES-PKCS1-v1_5", modulusLength: 2048, publicExponent: new Uint8Array([0x01, 0x00, 0x01])}, extractable, [ ]) rejected promise  with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
  • trunk/LayoutTests/crypto/subtle/generate-key-malformed-parameters.html

    r208547 r208548  
    2020shouldReject('crypto.subtle.generateKey(1)');
    2121shouldReject('crypto.subtle.generateKey(1, 2)');
    22 shouldReject('crypto.subtle.generateKey(1, 2, 3)');
    2322// Malformed AlgorithmIdentifiers.
    2423shouldReject('crypto.subtle.generateKey("foo", 2, 3)');
     
    5857shouldReject('crypto.subtle.generateKey({name: "AES-CBC", length: 128}, extractable, { })');
    5958shouldReject('crypto.subtle.generateKey({name: "AES-CBC", length: 128}, extractable, "foo")');
     59shouldReject('crypto.subtle.generateKey({name: "AES-CBC", length: 128}, extractable, ["foo"])');
    6060// Syntax error.
    6161shouldReject('crypto.subtle.generateKey({name: "AES-CBC", length: 128}, extractable, [ ])');
  • trunk/LayoutTests/crypto/subtle/hmac-generate-key-customized-length-expected.txt

    r207809 r208548  
    99PASS key.extractable is true
    1010PASS key.algorithm.name is 'HMAC'
    11 PASS key.algorithm.length is 111
     11PASS key.algorithm.length is 120
    1212PASS key.algorithm.hash.name is 'SHA-512'
    1313PASS key.usages is ["sign", "verify"]
  • trunk/LayoutTests/crypto/subtle/hmac-generate-key-customized-length.html

    r207809 r208548  
    1717
    1818debug("\nGenerating a key...");
    19 crypto.subtle.generateKey({name: "hmac", hash: "sha-512", length: 111}, extractable, ["sign", "verify"]).then(function(result) {
     19crypto.subtle.generateKey({name: "hmac", hash: "sha-512", length: 120}, extractable, ["sign", "verify"]).then(function(result) {
    2020    key = result;
    2121
     
    2323    shouldBe("key.extractable", "true");
    2424    shouldBe("key.algorithm.name", "'HMAC'");
    25     shouldBe("key.algorithm.length", "111");
     25    shouldBe("key.algorithm.length", "120");
    2626    shouldBe("key.algorithm.hash.name", "'SHA-512'");
    2727    shouldBe("key.usages", '["sign", "verify"]');
  • trunk/LayoutTests/crypto/subtle/hmac-generate-key-malformed-parameters-expected.txt

    r207809 r208548  
    44
    55
    6 PASS crypto.subtle.generateKey("hmac", extractable, ["sign", "verify"]) rejected promise  with TypeError: Member HmacKeyGenParams.hash is required and must be an instance of any.
    7 PASS crypto.subtle.generateKey({name: "hmac"}, extractable, ["sign", "verify"]) rejected promise  with TypeError: Member HmacKeyGenParams.hash is required and must be an instance of any.
     6PASS crypto.subtle.generateKey("hmac", extractable, ["sign", "verify"]) rejected promise  with TypeError: Member HmacKeyParams.hash is required and must be an instance of any.
     7PASS crypto.subtle.generateKey({name: "hmac"}, extractable, ["sign", "verify"]) rejected promise  with TypeError: Member HmacKeyParams.hash is required and must be an instance of any.
    88PASS crypto.subtle.generateKey({name: "hmac", hash: "sha-1", length: null}, extractable, ["sign", "verify"]) rejected promise  with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
    99PASS crypto.subtle.generateKey({name: "hmac", hash: "sha-1", length: Symbol()}, extractable, ["sign", "verify"]) rejected promise  with TypeError: Cannot convert a symbol to a number.
     
    1717PASS crypto.subtle.generateKey({name: "hmac", hash: "sha-1"}, extractable, ["unwrapKey"]) rejected promise  with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
    1818PASS crypto.subtle.generateKey({name: "hmac", hash: "sha-1", length: 0}, extractable, ["sign", "verify"]) rejected promise  with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
     19PASS crypto.subtle.generateKey({name: "hmac", hash: "sha-1", length: 5}, extractable, ["sign", "verify"]) rejected promise  with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
    1920PASS successfullyParsed is true
    2021
  • trunk/LayoutTests/crypto/subtle/hmac-generate-key-malformed-parameters.html

    r207809 r208548  
    3030// Wrong length
    3131shouldReject('crypto.subtle.generateKey({name: "hmac", hash: "sha-1", length: 0}, extractable, ["sign", "verify"])');
     32shouldReject('crypto.subtle.generateKey({name: "hmac", hash: "sha-1", length: 5}, extractable, ["sign", "verify"])');
    3233</script>
    3334
  • trunk/LayoutTests/crypto/subtle/hmac-import-jwk-key-minimum-expected.txt

    r208547 r208548  
    1 Test sending hmac crypto keys via postMessage to a worker.
     1Test importing a JWK HMAC key with minimum JWK information
    22
    33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
    44
    55
    6 PASS All checks passed in worker
     6Importing a key...
    77PASS key.type is 'secret'
    88PASS key.extractable is true
    99PASS key.algorithm.name is 'HMAC'
    10 PASS key.algorithm.length is 16
     10PASS key.algorithm.length is 128
    1111PASS key.algorithm.hash.name is 'SHA-1'
    12 PASS key.usages is ["sign", "verify"]
     12PASS key.usages is ['sign', 'verify']
    1313PASS successfullyParsed is true
    1414
  • trunk/LayoutTests/crypto/subtle/hmac-import-jwk-key-minimum.html

    r208547 r208548  
    1010
    1111<script>
    12 description("Test generating a HMAC key with customized length.");
     12description("Test importing a JWK HMAC key with minimum JWK information");
    1313
    1414jsTestIsAsync = true;
    1515
     16var jwkKey = {
     17    kty: "oct",
     18    k: "YWJjZGVmZ2gxMjM0NTY3OA",
     19};
    1620var extractable = true;
    1721
    18 debug("\nGenerating a key...");
    19 crypto.subtle.generateKey({name: "hmac", hash: "sha-512", length: 111}, extractable, ["sign", "verify"]).then(function(result) {
     22debug("Importing a key...");
     23crypto.subtle.importKey("jwk", jwkKey, {name: "hmac", hash: "sha-1"}, extractable, ["sign", "verify"]).then(function(result) {
    2024    key = result;
    2125
     
    2327    shouldBe("key.extractable", "true");
    2428    shouldBe("key.algorithm.name", "'HMAC'");
    25     shouldBe("key.algorithm.length", "111");
    26     shouldBe("key.algorithm.hash.name", "'SHA-512'");
    27     shouldBe("key.usages", '["sign", "verify"]');
     29    shouldBe("key.algorithm.length", "128");
     30    shouldBe("key.algorithm.hash.name", "'SHA-1'");
     31    shouldBe("key.usages", "['sign', 'verify']");
    2832
    2933    finishJSTest();
    3034});
     35
    3136</script>
    3237
  • trunk/LayoutTests/crypto/subtle/hmac-import-jwk-key-non-extractable-expected.txt

    r208547 r208548  
    1 Test sending hmac crypto keys via postMessage to a worker.
     1Test importing a non-extractable JWK HMAC key
    22
    33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
    44
    55
    6 PASS All checks passed in worker
     6Importing a key...
    77PASS key.type is 'secret'
    8 PASS key.extractable is true
     8PASS key.extractable is false
    99PASS key.algorithm.name is 'HMAC'
    10 PASS key.algorithm.length is 16
     10PASS key.algorithm.length is 128
    1111PASS key.algorithm.hash.name is 'SHA-1'
    12 PASS key.usages is ["sign", "verify"]
     12PASS key.usages is ['sign', 'verify']
    1313PASS successfullyParsed is true
    1414
  • trunk/LayoutTests/crypto/subtle/hmac-import-jwk-key-sha1-expected.txt

    r208547 r208548  
    1 Test sending hmac crypto keys via postMessage to a worker.
     1Test importing a JWK HMAC key with SHA-1
    22
    33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
    44
    55
    6 PASS All checks passed in worker
     6Importing a key...
    77PASS key.type is 'secret'
    88PASS key.extractable is true
    99PASS key.algorithm.name is 'HMAC'
    10 PASS key.algorithm.length is 16
     10PASS key.algorithm.length is 128
    1111PASS key.algorithm.hash.name is 'SHA-1'
    12 PASS key.usages is ["sign", "verify"]
     12PASS key.usages is ['sign', 'verify']
    1313PASS successfullyParsed is true
    1414
  • trunk/LayoutTests/crypto/subtle/hmac-import-jwk-key-sha224-expected.txt

    r208547 r208548  
    1 Test sending crypto keys via postMessage.
     1Test importing a JWK HMAC key with SHA-224
    22
    33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
    44
    55
     6Importing a key...
    67PASS key.type is 'secret'
    78PASS key.extractable is true
    89PASS key.algorithm.name is 'HMAC'
    9 PASS key.algorithm.length is 16
    10 PASS key.usages is ["sign", "verify"]
     10PASS key.algorithm.length is 128
     11PASS key.algorithm.hash.name is 'SHA-224'
     12PASS key.usages is ['sign', 'verify']
    1113PASS successfullyParsed is true
    1214
  • trunk/LayoutTests/crypto/subtle/hmac-import-jwk-key-sha256-expected.txt

    r208547 r208548  
    1 Test sending crypto keys via postMessage.
     1Test importing a JWK HMAC key with SHA-256
    22
    33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
    44
    55
     6Importing a key...
    67PASS key.type is 'secret'
    78PASS key.extractable is true
    89PASS key.algorithm.name is 'HMAC'
    9 PASS key.algorithm.length is 16
    10 PASS key.usages is ["sign", "verify"]
     10PASS key.algorithm.length is 128
     11PASS key.algorithm.hash.name is 'SHA-256'
     12PASS key.usages is ['sign', 'verify']
    1113PASS successfullyParsed is true
    1214
  • trunk/LayoutTests/crypto/subtle/hmac-import-jwk-key-sha384-expected.txt

    r208547 r208548  
    1 Test sending crypto keys via postMessage.
     1Test importing a JWK HMAC key with SHA-384
    22
    33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
    44
    55
     6Importing a key...
    67PASS key.type is 'secret'
    78PASS key.extractable is true
    89PASS key.algorithm.name is 'HMAC'
    9 PASS key.algorithm.length is 16
    10 PASS key.usages is ["sign", "verify"]
     10PASS key.algorithm.length is 128
     11PASS key.algorithm.hash.name is 'SHA-384'
     12PASS key.usages is ['sign', 'verify']
    1113PASS successfullyParsed is true
    1214
  • trunk/LayoutTests/crypto/subtle/hmac-import-jwk-key-sha512-expected.txt

    r208547 r208548  
    1 Test generating a HMAC key with customized length.
     1Test importing a JWK HMAC key with SHA-512
    22
    33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
    44
    55
    6 
    7 Generating a key...
     6Importing a key...
    87PASS key.type is 'secret'
    98PASS key.extractable is true
    109PASS key.algorithm.name is 'HMAC'
    11 PASS key.algorithm.length is 111
     10PASS key.algorithm.length is 128
    1211PASS key.algorithm.hash.name is 'SHA-512'
    13 PASS key.usages is ["sign", "verify"]
     12PASS key.usages is ['sign', 'verify']
    1413PASS successfullyParsed is true
    1514
  • trunk/LayoutTests/crypto/subtle/hmac-import-jwk-key-sha512.html

    r208547 r208548  
    1010
    1111<script>
    12 description("Test generating a HMAC key with customized length.");
     12description("Test importing a JWK HMAC key with SHA-512");
    1313
    1414jsTestIsAsync = true;
    1515
     16var jwkKey = {
     17    kty: "oct",
     18    k: "YWJjZGVmZ2gxMjM0NTY3OA",
     19    alg: "HS512",
     20    use: "sig",
     21    key_ops: ["sign", "verify"],
     22    ext: true,
     23};
    1624var extractable = true;
    1725
    18 debug("\nGenerating a key...");
    19 crypto.subtle.generateKey({name: "hmac", hash: "sha-512", length: 111}, extractable, ["sign", "verify"]).then(function(result) {
     26debug("Importing a key...");
     27crypto.subtle.importKey("jwk", jwkKey, {name: "hmac", hash: "sha-512"}, extractable, ["sign", "verify"]).then(function(result) {
    2028    key = result;
    2129
     
    2331    shouldBe("key.extractable", "true");
    2432    shouldBe("key.algorithm.name", "'HMAC'");
    25     shouldBe("key.algorithm.length", "111");
     33    shouldBe("key.algorithm.length", "128");
    2634    shouldBe("key.algorithm.hash.name", "'SHA-512'");
    27     shouldBe("key.usages", '["sign", "verify"]');
     35    shouldBe("key.usages", "['sign', 'verify']");
    2836
    2937    finishJSTest();
    3038});
     39
    3140</script>
    3241
  • trunk/LayoutTests/crypto/subtle/hmac-import-raw-key-customized-length-expected.txt

    r208547 r208548  
    1 Test sending hmac crypto keys via postMessage to a worker.
     1Test importing a raw HMAC key with customized length
    22
    33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
    44
    55
    6 PASS All checks passed in worker
     6Importing a key...
    77PASS key.type is 'secret'
    88PASS key.extractable is true
    99PASS key.algorithm.name is 'HMAC'
    10 PASS key.algorithm.length is 16
     10PASS key.algorithm.length is 128
    1111PASS key.algorithm.hash.name is 'SHA-1'
    12 PASS key.usages is ["sign", "verify"]
     12PASS key.usages is ['sign', 'verify']
    1313PASS successfullyParsed is true
    1414
  • trunk/LayoutTests/crypto/subtle/hmac-import-raw-key-customized-length.html

    r208547 r208548  
    1010
    1111<script>
    12 description("Test generating a HMAC key with customized length.");
     12description("Test importing a raw HMAC key with customized length");
    1313
    1414jsTestIsAsync = true;
    1515
     16var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
    1617var extractable = true;
    1718
    18 debug("\nGenerating a key...");
    19 crypto.subtle.generateKey({name: "hmac", hash: "sha-512", length: 111}, extractable, ["sign", "verify"]).then(function(result) {
     19debug("Importing a key...");
     20crypto.subtle.importKey("raw", rawKey, {name: "hmac", hash: "sha-1", length: 128}, extractable, ["sign", "verify"]).then(function(result) {
    2021    key = result;
    2122
     
    2324    shouldBe("key.extractable", "true");
    2425    shouldBe("key.algorithm.name", "'HMAC'");
    25     shouldBe("key.algorithm.length", "111");
    26     shouldBe("key.algorithm.hash.name", "'SHA-512'");
    27     shouldBe("key.usages", '["sign", "verify"]');
     26    shouldBe("key.algorithm.length", "128");
     27    shouldBe("key.algorithm.hash.name", "'SHA-1'");
     28    shouldBe("key.usages", "['sign', 'verify']");
    2829
    2930    finishJSTest();
    3031});
     32
    3133</script>
    3234
  • trunk/LayoutTests/crypto/subtle/hmac-import-raw-key-expected.txt

    r208547 r208548  
    1 Test sending hmac crypto keys via postMessage to a worker.
     1Test importing a raw HMAC key
    22
    33On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
    44
    55
    6 PASS All checks passed in worker
     6Importing a key...
    77PASS key.type is 'secret'
    88PASS key.extractable is true
    99PASS key.algorithm.name is 'HMAC'
    10 PASS key.algorithm.length is 16
     10PASS key.algorithm.length is 128
    1111PASS key.algorithm.hash.name is 'SHA-1'
    12 PASS key.usages is ["sign", "verify"]
     12PASS key.usages is ['sign', 'verify']
    1313PASS successfullyParsed is true
    1414
  • trunk/LayoutTests/crypto/subtle/hmac-import-raw-key.html

    r208547 r208548  
    1010
    1111<script>
    12 description("Test generating a HMAC key with customized length.");
     12description("Test importing a raw HMAC key");
    1313
    1414jsTestIsAsync = true;
    1515
     16var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
    1617var extractable = true;
    1718
    18 debug("\nGenerating a key...");
    19 crypto.subtle.generateKey({name: "hmac", hash: "sha-512", length: 111}, extractable, ["sign", "verify"]).then(function(result) {
     19debug("Importing a key...");
     20crypto.subtle.importKey("raw", rawKey, {name: "hmac", hash: "sha-1"}, extractable, ["sign", "verify"]).then(function(result) {
    2021    key = result;
    2122
     
    2324    shouldBe("key.extractable", "true");
    2425    shouldBe("key.algorithm.name", "'HMAC'");
    25     shouldBe("key.algorithm.length", "111");
    26     shouldBe("key.algorithm.hash.name", "'SHA-512'");
    27     shouldBe("key.usages", '["sign", "verify"]');
     26    shouldBe("key.algorithm.length", "128");
     27    shouldBe("key.algorithm.hash.name", "'SHA-1'");
     28    shouldBe("key.usages", "['sign', 'verify']");
    2829
    2930    finishJSTest();
    3031});
     32
    3133</script>
    3234
  • trunk/LayoutTests/crypto/webkitSubtle/hmac-generate-key-expected.txt

    r207809 r208548  
    2121PASS key.extractable is true
    2222PASS key.algorithm.name is 'HMAC'
    23 PASS key.algorithm.length is 5
     23PASS key.algorithm.length is 8
    2424PASS key.algorithm.hash.name is 'SHA-1'
    2525PASS key.usages is ["sign"]
  • trunk/LayoutTests/crypto/webkitSubtle/hmac-generate-key.html

    r207809 r208548  
    3333
    3434    debug("\nGenerating a key with custom length...");
    35     return crypto.webkitSubtle.generateKey({name: "hmac", hash: "sha-1", length: 5}, extractable, ["sign"]);
     35    return crypto.webkitSubtle.generateKey({name: "hmac", hash: "sha-1", length: 8}, extractable, ["sign"]);
    3636}).then(function(result) {
    3737    key = result;
     
    4040    shouldBe("key.extractable", "true");
    4141    shouldBe("key.algorithm.name", "'HMAC'");
    42     shouldBe("key.algorithm.length", "5");
     42    shouldBe("key.algorithm.length", "8");
    4343    shouldBe("key.algorithm.hash.name", "'SHA-1'");
    4444    shouldBe("key.usages", '["sign"]');
  • trunk/LayoutTests/crypto/webkitSubtle/hmac-import-jwk-expected.txt

    r206883 r208548  
    99PASS key.extractable is false
    1010PASS key.algorithm.name is 'HMAC'
    11 PASS key.algorithm.length is 32
     11PASS key.algorithm.length is 256
    1212PASS key.usages is ["sign", "verify"]
    1313
  • trunk/LayoutTests/crypto/webkitSubtle/hmac-import-jwk.html

    r206883 r208548  
    3333    shouldBe("key.extractable", "false");
    3434    shouldBe("key.algorithm.name", "'HMAC'");
    35     shouldBe("key.algorithm.length", "32");
     35    shouldBe("key.algorithm.length", "256");
    3636    shouldBe("key.usages", '["sign", "verify"]');
    3737
  • trunk/LayoutTests/crypto/webkitSubtle/hmac-postMessage-expected.txt

    r206883 r208548  
    77PASS key.extractable is true
    88PASS key.algorithm.name is 'HMAC'
    9 PASS key.algorithm.length is 16
     9PASS key.algorithm.length is 128
    1010PASS key.usages is ["sign", "verify"]
    1111PASS successfullyParsed is true
  • trunk/LayoutTests/crypto/webkitSubtle/hmac-postMessage.html

    r206883 r208548  
    1818    shouldBe("key.extractable", "true");
    1919    shouldBe("key.algorithm.name", "'HMAC'");
    20     shouldBe("key.algorithm.length", "16");
     20    shouldBe("key.algorithm.length", "128");
    2121    shouldBe("key.usages", '["sign", "verify"]');
    2222
  • trunk/LayoutTests/crypto/webkitSubtle/hmac-sign-verify-expected.txt

    r206883 r208548  
    88PASS key.extractable is true
    99PASS key.algorithm.name is 'HMAC'
    10 PASS key.algorithm.length is 1
     10PASS key.algorithm.length is 8
    1111PASS key.algorithm.hash.name is 'SHA-1'
    1212PASS key.usages is ['sign', 'verify']
  • trunk/LayoutTests/crypto/webkitSubtle/hmac-sign-verify.html

    r206883 r208548  
    2323    shouldBe("key.extractable", "true");
    2424    shouldBe("key.algorithm.name", "'HMAC'");
    25     shouldBe("key.algorithm.length", "1"); // See <https://www.w3.org/Bugs/Public/show_bug.cgi?id=23098>.
     25    shouldBe("key.algorithm.length", "8"); // See <https://www.w3.org/Bugs/Public/show_bug.cgi?id=23098>.
    2626    shouldBe("key.algorithm.hash.name", "'SHA-1'");
    2727    shouldBe("key.usages", "['sign', 'verify']");
  • trunk/LayoutTests/crypto/workers/subtle/hmac-postMessage-worker-expected.txt

    r206883 r208548  
    88PASS key.extractable is true
    99PASS key.algorithm.name is 'HMAC'
    10 PASS key.algorithm.length is 16
     10PASS key.algorithm.length is 128
    1111PASS key.algorithm.hash.name is 'SHA-1'
    1212PASS key.usages is ["sign", "verify"]
  • trunk/LayoutTests/crypto/workers/subtle/hmac-postMessage-worker.html

    r206883 r208548  
    2424            shouldBe("key.extractable", "true");
    2525            shouldBe("key.algorithm.name", "'HMAC'");
    26             shouldBe("key.algorithm.length", "16");
     26            shouldBe("key.algorithm.length", "128");
    2727            shouldBe("key.algorithm.hash.name", "'SHA-1'");
    2828            shouldBe("key.usages", '["sign", "verify"]');
  • trunk/LayoutTests/crypto/workers/subtle/resources/hmac-postMessage-worker.js

    r206883 r208548  
    1010    else if (key.algorithm.name != "HMAC")
    1111        postMessage({ result:false, message:'key.algorithm.name should be "HMAC"' });
    12     else if (key.algorithm.length != 16)
    13         postMessage({ result:false, message:'key.algorithm.length should be 16' });
     12    else if (key.algorithm.length != 128)
     13        postMessage({ result:false, message:'key.algorithm.length should be 128' });
    1414    else if (key.algorithm.hash.name != "SHA-1")
    1515        postMessage({ result:false, message:'key.algorithm.hash.name should be "SHA-1"' });
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r208539 r208548  
     12016-11-05  Jiewen Tan  <jiewen_tan@apple.com>
     2
     3        Update SubtleCrypto::importKey to match the latest spec
     4        https://bugs.webkit.org/show_bug.cgi?id=164446
     5        <rdar://problem/29123621>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        * WebCryptoAPI/idlharness-expected.txt:
     10
    1112016-11-10  Zan Dobersek  <zdobersek@igalia.com>
    212
  • trunk/LayoutTests/imported/w3c/WebCryptoAPI/idlharness-expected.txt

    r207809 r208548  
    6060FAIL SubtleCrypto interface: crypto.subtle must inherit property "deriveBits" with the proper type (7) assert_inherits: property "deriveBits" not found in prototype chain
    6161FAIL SubtleCrypto interface: calling deriveBits(AlgorithmIdentifier,CryptoKey,unsigned long) on crypto.subtle with too few arguments must throw TypeError assert_inherits: property "deriveBits" not found in prototype chain
    62 FAIL SubtleCrypto interface: crypto.subtle must inherit property "importKey" with the proper type (8) assert_inherits: property "importKey" not found in prototype chain
    63 FAIL SubtleCrypto interface: calling importKey(KeyFormat,[object Object],[object Object],AlgorithmIdentifier,boolean,[object Object]) on crypto.subtle with too few arguments must throw TypeError assert_inherits: property "importKey" not found in prototype chain
     62PASS SubtleCrypto interface: crypto.subtle must inherit property "importKey" with the proper type (8)
     63PASS SubtleCrypto interface: calling importKey(KeyFormat,[object Object],[object Object],AlgorithmIdentifier,boolean,[object Object]) on crypto.subtle with too few arguments must throw TypeError
    6464FAIL SubtleCrypto interface: crypto.subtle must inherit property "exportKey" with the proper type (9) assert_inherits: property "exportKey" not found in prototype chain
    6565FAIL SubtleCrypto interface: calling exportKey(KeyFormat,CryptoKey) on crypto.subtle with too few arguments must throw TypeError assert_inherits: property "exportKey" not found in prototype chain
  • trunk/Source/WebCore/CMakeLists.txt

    r208539 r208548  
    328328    crypto/CryptoKey.idl
    329329    crypto/CryptoKeyPair.idl
     330    crypto/JsonWebKey.idl
     331    crypto/RsaOtherPrimesInfo.idl
    330332    crypto/SubtleCrypto.idl
    331333    crypto/WebKitSubtleCrypto.idl
    332334
    333335    crypto/parameters/AesKeyGenParams.idl
    334     crypto/parameters/HmacKeyGenParams.idl
     336    crypto/parameters/HmacKeyParams.idl
     337    crypto/parameters/RsaHashedImportParams.idl
    335338    crypto/parameters/RsaHashedKeyGenParams.idl
    336339    crypto/parameters/RsaKeyGenParams.idl
  • trunk/Source/WebCore/ChangeLog

    r208545 r208548  
     12016-11-04  Jiewen Tan  <jiewen_tan@apple.com>
     2
     3        Update SubtleCrypto::importKey to match the latest spec
     4        https://bugs.webkit.org/show_bug.cgi?id=164446
     5        <rdar://problem/29123621>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        This patch does following few things:
     10        1. It updates the SubtleCrypto::importKey method to match the latest spec:
     11           https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-importKey.
     12           It also refers to the latest Editor's Draft at a certain degree:
     13           https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-importKey.
     14        2. It implements importKey operations of following algorithms: AES-CBC, AES-KW,
     15           HMAC, RSAES-PKCS1-V1_5, RSASSA-PKCS1-V1_5, and RSA-OAEP.
     16        3. It fixes some minor problems of SubtleCrypto::generateKey.
     17        4. It addes move constructors for CryptoKeyAES, CryptoKeyHMAC, CryptoKeyRSA and
     18           CryptoKeyDataRSAComponents.
     19        5. It renames HmacKeyGenParams to HmacKeyParams to serve the purpose of both
     20           HmacKeyGenParams and HmacImportParams which are essentially the same.
     21        6. It enforces the key length in bits of CryptoKeyHMAC to be multiples of 8.
     22        7. It also fixes the following bugs:
     23           https://bugs.webkit.org/show_bug.cgi?id=126033,
     24           https://bugs.webkit.org/show_bug.cgi?id=126034,
     25           https://bugs.webkit.org/show_bug.cgi?id=151308.
     26        P.S. We currently only support Raw and Jwk key format.
     27
     28        Tests: crypto/subtle/aes-cbc-import-jwk-key-length-128.html
     29               crypto/subtle/aes-cbc-import-jwk-key-length-192.html
     30               crypto/subtle/aes-cbc-import-jwk-key-length-256.html
     31               crypto/subtle/aes-cbc-import-jwk-key-minimum.html
     32               crypto/subtle/aes-cbc-import-jwk-key-non-extractable.html
     33               crypto/subtle/aes-cbc-import-raw-key-length-128.html
     34               crypto/subtle/aes-cbc-import-raw-key-length-192.html
     35               crypto/subtle/aes-cbc-import-raw-key-length-256.html
     36               crypto/subtle/aes-import-key-malformed-parameters.html
     37               crypto/subtle/aes-kw-import-jwk-key-length-128.html
     38               crypto/subtle/aes-kw-import-jwk-key-length-192.html
     39               crypto/subtle/aes-kw-import-jwk-key-length-256.html
     40               crypto/subtle/aes-kw-import-raw-key.html
     41               crypto/subtle/generate-key-malformed-parameters.html
     42               crypto/subtle/hmac-import-jwk-key-minimum.html
     43               crypto/subtle/hmac-import-jwk-key-non-extractable.html
     44               crypto/subtle/hmac-import-jwk-key-sha1.html
     45               crypto/subtle/hmac-import-jwk-key-sha224.html
     46               crypto/subtle/hmac-import-jwk-key-sha256.html
     47               crypto/subtle/hmac-import-jwk-key-sha384.html
     48               crypto/subtle/hmac-import-jwk-key-sha512.html
     49               crypto/subtle/hmac-import-malformed-parameters.html
     50               crypto/subtle/hmac-import-raw-key-customized-length.html
     51               crypto/subtle/hmac-import-raw-key.html
     52               crypto/subtle/import-key-malformed-parameters.html
     53               crypto/subtle/rsa-import-key-malformed-parameters.html
     54               crypto/subtle/rsa-oaep-import-jwk-private-key.html
     55               crypto/subtle/rsa-oaep-import-jwk-public-key-sha1.html
     56               crypto/subtle/rsa-oaep-import-jwk-public-key-sha224.html
     57               crypto/subtle/rsa-oaep-import-jwk-public-key-sha256.html
     58               crypto/subtle/rsa-oaep-import-jwk-public-key-sha384.html
     59               crypto/subtle/rsa-oaep-import-jwk-public-key-sha512.html
     60               crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-private-key.html
     61               crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-leading-zero.html
     62               crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-minimum.html
     63               crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key-non-extractable.html
     64               crypto/subtle/rsaes-pkcs1-v1_5-import-jwk-public-key.html
     65               crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-private-key.html
     66               crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha1.html
     67               crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha224.html
     68               crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha256.html
     69               crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha384.html
     70               crypto/subtle/rsassa-pkcs1-v1_5-import-jwk-public-key-sha512.html
     71               crypto/workers/subtle/aes-import-jwk-key.html
     72               crypto/workers/subtle/aes-import-raw-key.html
     73               crypto/workers/subtle/hmac-import-jwk-key.html
     74               crypto/workers/subtle/hmac-import-raw-key.html
     75               crypto/workers/subtle/rsa-import-jwk-private-key.html
     76               crypto/workers/subtle/rsa-import-jwk-public-key.html
     77
     78        * CMakeLists.txt:
     79        * DerivedSources.make:
     80        * PlatformEfl.cmake:
     81        * PlatformGTK.cmake:
     82        * PlatformMac.cmake:
     83        * WebCore.xcodeproj/project.pbxproj:
     84        * bindings/js/JSSubtleCryptoCustom.cpp:
     85        (WebCore::normalizeCryptoAlgorithmParameters):
     86        (WebCore::cryptoKeyUsageFromString):
     87        (WebCore::cryptoKeyUsagesFromJSValue):
     88        (WebCore::toKeyData):
     89        (WebCore::jsSubtleCryptoFunctionGenerateKeyPromise):
     90        (WebCore::jsSubtleCryptoFunctionImportKeyPromise):
     91        (WebCore::JSSubtleCrypto::importKey):
     92        * crypto/CryptoAlgorithm.cpp:
     93        (WebCore::CryptoAlgorithm::importKey):
     94        * crypto/CryptoAlgorithm.h:
     95        * crypto/CryptoAlgorithmParameters.h:
     96        * crypto/JsonWebKey.h: Added.
     97        * crypto/JsonWebKey.idl: Added.
     98        * crypto/RsaOtherPrimesInfo.h: Added.
     99        * crypto/RsaOtherPrimesInfo.idl: Added.
     100        * crypto/SubtleCrypto.h:
     101        * crypto/SubtleCrypto.idl:
     102        * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
     103        (WebCore::CryptoAlgorithmAES_CBC::generateKey):
     104        (WebCore::CryptoAlgorithmAES_CBC::importKey):
     105        * crypto/algorithms/CryptoAlgorithmAES_CBC.h:
     106        * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
     107        (WebCore::CryptoAlgorithmAES_KW::generateKey):
     108        (WebCore::CryptoAlgorithmAES_KW::importKey):
     109        * crypto/algorithms/CryptoAlgorithmAES_KW.h:
     110        * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
     111        (WebCore::CryptoAlgorithmHMAC::generateKey):
     112        (WebCore::CryptoAlgorithmHMAC::importKey):
     113        * crypto/algorithms/CryptoAlgorithmHMAC.h:
     114        * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
     115        (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):
     116        * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h:
     117        * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
     118        (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
     119        * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
     120        * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
     121        (WebCore::CryptoAlgorithmRSA_OAEP::importKey):
     122        * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h:
     123        * crypto/keys/CryptoKeyAES.cpp:
     124        (WebCore::CryptoKeyAES::CryptoKeyAES):
     125        (WebCore::CryptoKeyAES::generate):
     126        (WebCore::CryptoKeyAES::importRaw):
     127        (WebCore::CryptoKeyAES::importJwk):
     128        * crypto/keys/CryptoKeyAES.h:
     129        * crypto/keys/CryptoKeyDataRSAComponents.cpp:
     130        (WebCore::CryptoKeyDataRSAComponents::CryptoKeyDataRSAComponents):
     131        * crypto/keys/CryptoKeyDataRSAComponents.h:
     132        * crypto/keys/CryptoKeyHMAC.cpp:
     133        (WebCore::CryptoKeyHMAC::CryptoKeyHMAC):
     134        (WebCore::CryptoKeyHMAC::generate):
     135        (WebCore::CryptoKeyHMAC::importRaw):
     136        (WebCore::CryptoKeyHMAC::importJwk):
     137        (WebCore::CryptoKeyHMAC::buildAlgorithm):
     138        * crypto/keys/CryptoKeyHMAC.h:
     139        * crypto/keys/CryptoKeyRSA.cpp: Added.
     140        (WebCore::CryptoKeyRSA::importJwk):
     141        * crypto/keys/CryptoKeyRSA.h:
     142        * crypto/parameters/CryptoAlgorithmHmacKeyParams.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmHmacKeyGenParams.h.
     143        * crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h: Added.
     144        * crypto/parameters/HmacKeyParams.idl: Renamed from Source/WebCore/crypto/parameters/HmacKeyGenParams.idl.
     145        * crypto/parameters/RsaHashedImportParams.idl: Added.
     146
    11472016-11-10  Brady Eidson  <beidson@apple.com>
    2148
  • trunk/Source/WebCore/DerivedSources.make

    r208539 r208548  
    253253    $(WebCore)/crypto/CryptoKey.idl \
    254254    $(WebCore)/crypto/CryptoKeyPair.idl \
     255    $(WebCore)/crypto/JsonWebKey.idl \
    255256    $(WebCore)/crypto/parameters/AesKeyGenParams.idl \
    256     $(WebCore)/crypto/parameters/HmacKeyGenParams.idl \
     257    $(WebCore)/crypto/parameters/HmacKeyParams.idl \
     258    $(WebCore)/crypto/parameters/RsaHashedImportParams.idl \
    257259    $(WebCore)/crypto/parameters/RsaHashedKeyGenParams.idl \
    258260    $(WebCore)/crypto/parameters/RsaKeyGenParams.idl \
     261    $(WebCore)/crypto/RsaOtherPrimesInfo.idl \
    259262    $(WebCore)/crypto/SubtleCrypto.idl \
    260263    $(WebCore)/crypto/WebKitSubtleCrypto.idl \
  • trunk/Source/WebCore/PlatformEfl.cmake

    r208440 r208548  
    439439        crypto/keys/CryptoKeyDataRSAComponents.cpp
    440440        crypto/keys/CryptoKeyHMAC.cpp
     441        crypto/keys/CryptoKeyRSA.cpp
    441442        crypto/keys/CryptoKeySerializationRaw.cpp
    442443    )
  • trunk/Source/WebCore/PlatformGTK.cmake

    r208297 r208548  
    436436        crypto/keys/CryptoKeyDataRSAComponents.cpp
    437437        crypto/keys/CryptoKeyHMAC.cpp
     438        crypto/keys/CryptoKeyRSA.cpp
    438439        crypto/keys/CryptoKeySerializationRaw.cpp
    439440    )
  • trunk/Source/WebCore/PlatformMac.cmake

    r208534 r208548  
    201201    crypto/keys/CryptoKeyDataRSAComponents.cpp
    202202    crypto/keys/CryptoKeyHMAC.cpp
     203    crypto/keys/CryptoKeyRSA.cpp
    203204    crypto/keys/CryptoKeySerializationRaw.cpp
    204205
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r208539 r208548  
    23752375                577483141DAEC2EB00716EF9 /* JSAesKeyGenParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 577483131DAEC2EA00716EF9 /* JSAesKeyGenParams.h */; };
    23762376                577483161DAEC32300716EF9 /* JSAesKeyGenParams.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 577483151DAEC32200716EF9 /* JSAesKeyGenParams.cpp */; };
    2377                 577483191DB4491F00716EF9 /* CryptoAlgorithmHmacKeyGenParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 577483181DB4491F00716EF9 /* CryptoAlgorithmHmacKeyGenParams.h */; };
    2378                 5774831B1DB459BA00716EF9 /* JSHmacKeyGenParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 5774831A1DB459BA00716EF9 /* JSHmacKeyGenParams.h */; };
    2379                 5774831D1DB459DE00716EF9 /* JSHmacKeyGenParams.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5774831C1DB459DE00716EF9 /* JSHmacKeyGenParams.cpp */; };
     2377                577483191DB4491F00716EF9 /* CryptoAlgorithmHmacKeyParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 577483181DB4491F00716EF9 /* CryptoAlgorithmHmacKeyParams.h */; };
    23802378                5778BD821DA4806C009E3009 /* SubtleCrypto.h in Headers */ = {isa = PBXBuildFile; fileRef = 5778BD811DA4802C009E3009 /* SubtleCrypto.h */; };
    23812379                5778BD841DA4817B009E3009 /* SubtleCrypto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5778BD831DA4817B009E3009 /* SubtleCrypto.cpp */; };
     2380                579F6E051DCD7EE400546D80 /* CryptoAlgorithmRsaHashedKeyGenParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 57E233741DCD6D3B00F28D01 /* CryptoAlgorithmRsaHashedKeyGenParams.h */; };
    23822381                57A9C88E1DA70BF800BC7305 /* JSSubtleCryptoCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57A9C88D1DA70BF800BC7305 /* JSSubtleCryptoCustom.cpp */; };
     2382                57E2335B1DC7D5E500F28D01 /* JSJsonWebKey.h in Headers */ = {isa = PBXBuildFile; fileRef = 57E2335A1DC7D5E500F28D01 /* JSJsonWebKey.h */; };
     2383                57E2335D1DC7D60800F28D01 /* JSRsaOtherPrimesInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 57E2335C1DC7D60800F28D01 /* JSRsaOtherPrimesInfo.h */; };
     2384                57E2335F1DC7D67B00F28D01 /* JSJsonWebKey.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57E2335E1DC7D67B00F28D01 /* JSJsonWebKey.cpp */; };
     2385                57E233611DC7D6AA00F28D01 /* JSRsaOtherPrimesInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57E233601DC7D6AA00F28D01 /* JSRsaOtherPrimesInfo.cpp */; };
     2386                57E233631DC7DA2400F28D01 /* RsaOtherPrimesInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 57E233621DC7DA2400F28D01 /* RsaOtherPrimesInfo.h */; };
     2387                57E233651DC7DB1F00F28D01 /* JsonWebKey.h in Headers */ = {isa = PBXBuildFile; fileRef = 57E233641DC7DB1F00F28D01 /* JsonWebKey.h */; };
     2388                57E233671DCAB21C00F28D01 /* JSHmacKeyParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 57E233661DCAB21C00F28D01 /* JSHmacKeyParams.h */; };
     2389                57E233691DCAB24300F28D01 /* JSHmacKeyParams.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57E233681DCAB24300F28D01 /* JSHmacKeyParams.cpp */; };
     2390                57E2336B1DCC262400F28D01 /* CryptoKeyRSA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57E2336A1DCC262400F28D01 /* CryptoKeyRSA.cpp */; };
     2391                57E2336E1DCD43FD00F28D01 /* CryptoAlgorithmRsaHashedImportParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 57E2336D1DCD43FD00F28D01 /* CryptoAlgorithmRsaHashedImportParams.h */; };
     2392                57E233711DCD468F00F28D01 /* JSRsaHashedImportParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 57E233701DCD468F00F28D01 /* JSRsaHashedImportParams.h */; };
     2393                57E233731DCD46B600F28D01 /* JSRsaHashedImportParams.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57E233721DCD46B600F28D01 /* JSRsaHashedImportParams.cpp */; };
    23832394                57EF5E601D20C83900171E60 /* TextCodecReplacement.h in Headers */ = {isa = PBXBuildFile; fileRef = 57EF5E5F1D20C83900171E60 /* TextCodecReplacement.h */; };
    23842395                57EF5E621D20D28700171E60 /* TextCodecReplacement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 57EF5E611D20D28700171E60 /* TextCodecReplacement.cpp */; };
    2385                 57F8273B1DB72D64009D2BF4 /* CryptoAlgorithmRsaHashedKeyGenParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 57F8273A1DB72D64009D2BF4 /* CryptoAlgorithmRsaHashedKeyGenParams.h */; };
    23862396                57FEDD3F1DB6D59200EB96F5 /* CryptoAlgorithmRsaKeyGenParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 57FEDD3E1DB6D59200EB96F5 /* CryptoAlgorithmRsaKeyGenParams.h */; };
    23872397                57FEDD411DB6D73A00EB96F5 /* JSRsaKeyGenParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 57FEDD401DB6D73A00EB96F5 /* JSRsaKeyGenParams.h */; };
     
    95889598                577483131DAEC2EA00716EF9 /* JSAesKeyGenParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAesKeyGenParams.h; sourceTree = "<group>"; };
    95899599                577483151DAEC32200716EF9 /* JSAesKeyGenParams.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAesKeyGenParams.cpp; sourceTree = "<group>"; };
    9590                 577483171DB1FE8900716EF9 /* HmacKeyGenParams.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = HmacKeyGenParams.idl; sourceTree = "<group>"; };
    9591                 577483181DB4491F00716EF9 /* CryptoAlgorithmHmacKeyGenParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmHmacKeyGenParams.h; sourceTree = "<group>"; };
    9592                 5774831A1DB459BA00716EF9 /* JSHmacKeyGenParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHmacKeyGenParams.h; sourceTree = "<group>"; };
    9593                 5774831C1DB459DE00716EF9 /* JSHmacKeyGenParams.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHmacKeyGenParams.cpp; sourceTree = "<group>"; };
     9600                577483171DB1FE8900716EF9 /* HmacKeyParams.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = HmacKeyParams.idl; sourceTree = "<group>"; };
     9601                577483181DB4491F00716EF9 /* CryptoAlgorithmHmacKeyParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmHmacKeyParams.h; sourceTree = "<group>"; };
    95949602                5778BD801DA4733E009E3009 /* SubtleCrypto.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SubtleCrypto.idl; sourceTree = "<group>"; };
    95959603                5778BD811DA4802C009E3009 /* SubtleCrypto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SubtleCrypto.h; sourceTree = "<group>"; };
    95969604                5778BD831DA4817B009E3009 /* SubtleCrypto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SubtleCrypto.cpp; sourceTree = "<group>"; };
    95979605                57A9C88D1DA70BF800BC7305 /* JSSubtleCryptoCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSubtleCryptoCustom.cpp; sourceTree = "<group>"; };
     9606                57E233571DC7D24800F28D01 /* JsonWebKey.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = JsonWebKey.idl; sourceTree = "<group>"; };
     9607                57E233591DC7D37200F28D01 /* RsaOtherPrimesInfo.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = RsaOtherPrimesInfo.idl; sourceTree = "<group>"; };
     9608                57E2335A1DC7D5E500F28D01 /* JSJsonWebKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSJsonWebKey.h; sourceTree = "<group>"; };
     9609                57E2335C1DC7D60800F28D01 /* JSRsaOtherPrimesInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSRsaOtherPrimesInfo.h; sourceTree = "<group>"; };
     9610                57E2335E1DC7D67B00F28D01 /* JSJsonWebKey.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSJsonWebKey.cpp; sourceTree = "<group>"; };
     9611                57E233601DC7D6AA00F28D01 /* JSRsaOtherPrimesInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSRsaOtherPrimesInfo.cpp; sourceTree = "<group>"; };
     9612                57E233621DC7DA2400F28D01 /* RsaOtherPrimesInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RsaOtherPrimesInfo.h; sourceTree = "<group>"; };
     9613                57E233641DC7DB1F00F28D01 /* JsonWebKey.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JsonWebKey.h; sourceTree = "<group>"; };
     9614                57E233661DCAB21C00F28D01 /* JSHmacKeyParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSHmacKeyParams.h; sourceTree = "<group>"; };
     9615                57E233681DCAB24300F28D01 /* JSHmacKeyParams.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHmacKeyParams.cpp; sourceTree = "<group>"; };
     9616                57E2336A1DCC262400F28D01 /* CryptoKeyRSA.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoKeyRSA.cpp; sourceTree = "<group>"; };
     9617                57E2336C1DCD437000F28D01 /* RsaHashedImportParams.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = RsaHashedImportParams.idl; sourceTree = "<group>"; };
     9618                57E2336D1DCD43FD00F28D01 /* CryptoAlgorithmRsaHashedImportParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmRsaHashedImportParams.h; sourceTree = "<group>"; };
     9619                57E233701DCD468F00F28D01 /* JSRsaHashedImportParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSRsaHashedImportParams.h; sourceTree = "<group>"; };
     9620                57E233721DCD46B600F28D01 /* JSRsaHashedImportParams.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSRsaHashedImportParams.cpp; sourceTree = "<group>"; };
     9621                57E233741DCD6D3B00F28D01 /* CryptoAlgorithmRsaHashedKeyGenParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmRsaHashedKeyGenParams.h; sourceTree = "<group>"; };
    95989622                57EF5E5F1D20C83900171E60 /* TextCodecReplacement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextCodecReplacement.h; sourceTree = "<group>"; };
    95999623                57EF5E611D20D28700171E60 /* TextCodecReplacement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextCodecReplacement.cpp; sourceTree = "<group>"; };
    96009624                57F827391DB72C22009D2BF4 /* RsaHashedKeyGenParams.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = RsaHashedKeyGenParams.idl; sourceTree = "<group>"; };
    9601                 57F8273A1DB72D64009D2BF4 /* CryptoAlgorithmRsaHashedKeyGenParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmRsaHashedKeyGenParams.h; sourceTree = "<group>"; };
    96029625                57FEDD3D1DB6D47F00EB96F5 /* RsaKeyGenParams.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = RsaKeyGenParams.idl; sourceTree = "<group>"; };
    96039626                57FEDD3E1DB6D59200EB96F5 /* CryptoAlgorithmRsaKeyGenParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmRsaKeyGenParams.h; sourceTree = "<group>"; };
     
    1651116534                                148B4FFF1B6904C500C954E4 /* CountQueuingStrategy.idl */,
    1651216535                                9908B0EE1BCACF9100ED0F65 /* CountQueuingStrategy.js */,
    16513                                 9908B0F11BCACF9100ED3F64 /* ReadableByteStreamInternals.js */,
    1651416536                                41189EF71AD8232800B93F64 /* ReadableByteStreamController.idl */,
    1651516537                                9908B0F01BCACF9100ED3F64 /* ReadableByteStreamController.js */,
     16538                                9908B0F11BCACF9100ED3F64 /* ReadableByteStreamInternals.js */,
    1651616539                                41A023ED1A39DB7900F722CF /* ReadableStream.idl */,
    1651716540                                9908B0EF1BCACF9100ED0F65 /* ReadableStream.js */,
     
    1780417827                                BC94D1510C275C8B006BC617 /* History.h */,
    1780517828                                BC94D1520C275C8B006BC617 /* History.idl */,
     17829                                0F4710D51DB6FE22002DCEC3 /* IntersectionObserver.cpp */,
    1780617830                                0F4710D61DB6FE22002DCEC3 /* IntersectionObserver.h */,
    17807                                 0F4710D51DB6FE22002DCEC3 /* IntersectionObserver.cpp */,
    1780817831                                0F4710D71DB6FE22002DCEC3 /* IntersectionObserver.idl */,
    1780917832                                0F8B45711DC3FBA300443C3F /* IntersectionObserverCallback.h */,
     
    1803418057                        isa = PBXGroup;
    1803518058                        children = (
    18036                                 714131481DC9D6EF00336107 /* js-files */,
    18037                                 71D02D901DB55C4E00DD5CF5 /* main.js */,
    1803818059                                716FA0D71DB26591007323CC /* controls */,
    1803918060                                71D6AA6F1DA4EAF700B23969 /* images */,
     18061                                714131481DC9D6EF00336107 /* js-files */,
    1804018062                                71D02D911DB55C4E00DD5CF5 /* media */,
     18063                                71D02D901DB55C4E00DD5CF5 /* main.js */,
    1804118064                        );
    1804218065                        path = "modern-media-controls";
     
    2286822891                                E125F8331822F18A00D84CD9 /* CryptoKeyHMAC.cpp */,
    2286922892                                E125F8341822F18A00D84CD9 /* CryptoKeyHMAC.h */,
     22893                                57E2336A1DCC262400F28D01 /* CryptoKeyRSA.cpp */,
    2287022894                                E164FAA218315BF400DB4E61 /* CryptoKeyRSA.h */,
    2287122895                                E125F857182C1AA600D84CD9 /* CryptoKeySerializationRaw.cpp */,
     
    2288222906                                577483111DADC55D00716EF9 /* CryptoAlgorithmAesKeyGenParams.h */,
    2288322907                                E19AC3F61824E5D100349426 /* CryptoAlgorithmAesKeyGenParamsDeprecated.h */,
    22884                                 577483181DB4491F00716EF9 /* CryptoAlgorithmHmacKeyGenParams.h */,
     22908                                577483181DB4491F00716EF9 /* CryptoAlgorithmHmacKeyParams.h */,
    2288522909                                E19DA29B18189ADD00088BC8 /* CryptoAlgorithmHmacKeyParamsDeprecated.h */,
    2288622910                                E1C6571E1816E50300256CDD /* CryptoAlgorithmHmacParamsDeprecated.h */,
    22887                                 57F8273A1DB72D64009D2BF4 /* CryptoAlgorithmRsaHashedKeyGenParams.h */,
     22911                                57E2336D1DCD43FD00F28D01 /* CryptoAlgorithmRsaHashedImportParams.h */,
     22912                                57E233741DCD6D3B00F28D01 /* CryptoAlgorithmRsaHashedKeyGenParams.h */,
    2288822913                                57FEDD3E1DB6D59200EB96F5 /* CryptoAlgorithmRsaKeyGenParams.h */,
    2288922914                                E1BD331D182D8F4200C05D9F /* CryptoAlgorithmRsaKeyGenParamsDeprecated.h */,
     
    2289122916                                E1FE1376184D1E3300892F13 /* CryptoAlgorithmRsaOaepParamsDeprecated.h */,
    2289222917                                E1BD331B182D8EE900C05D9F /* CryptoAlgorithmRsaSsaParamsDeprecated.h */,
    22893                                 577483171DB1FE8900716EF9 /* HmacKeyGenParams.idl */,
     22918                                577483171DB1FE8900716EF9 /* HmacKeyParams.idl */,
     22919                                57E2336C1DCD437000F28D01 /* RsaHashedImportParams.idl */,
    2289422920                                57F827391DB72C22009D2BF4 /* RsaHashedKeyGenParams.idl */,
    2289522921                                57FEDD3D1DB6D47F00EB96F5 /* RsaKeyGenParams.idl */,
     
    2302923055                                E19727151820549E00592D51 /* CryptoKeyType.h */,
    2303023056                                E172AF6F180F289500FBADB9 /* CryptoKeyUsage.h */,
     23057                                57E233641DC7DB1F00F28D01 /* JsonWebKey.h */,
     23058                                57E233571DC7D24800F28D01 /* JsonWebKey.idl */,
     23059                                57E233621DC7DA2400F28D01 /* RsaOtherPrimesInfo.h */,
     23060                                57E233591DC7D37200F28D01 /* RsaOtherPrimesInfo.idl */,
    2303123061                                E18DF33418AAF12C00773E59 /* SerializedCryptoKeyWrap.h */,
    2303223062                                5778BD831DA4817B009E3009 /* SubtleCrypto.cpp */,
     
    2305123081                                E1F80B8B183172B5007885C3 /* JSCryptoKeyPair.cpp */,
    2305223082                                E1F80B8C183172B5007885C3 /* JSCryptoKeyPair.h */,
    23053                                 5774831C1DB459DE00716EF9 /* JSHmacKeyGenParams.cpp */,
    23054                                 5774831A1DB459BA00716EF9 /* JSHmacKeyGenParams.h */,
     23083                                57E233681DCAB24300F28D01 /* JSHmacKeyParams.cpp */,
     23084                                57E233661DCAB21C00F28D01 /* JSHmacKeyParams.h */,
     23085                                57E2335E1DC7D67B00F28D01 /* JSJsonWebKey.cpp */,
     23086                                57E2335A1DC7D5E500F28D01 /* JSJsonWebKey.h */,
     23087                                57E233721DCD46B600F28D01 /* JSRsaHashedImportParams.cpp */,
     23088                                57E233701DCD468F00F28D01 /* JSRsaHashedImportParams.h */,
    2305523089                                5768E4351DB7527300D0A4F7 /* JSRsaHashedKeyGenParams.cpp */,
    2305623090                                5768E4331DB7524500D0A4F7 /* JSRsaHashedKeyGenParams.h */,
    2305723091                                57FEDD421DB6D76000EB96F5 /* JSRsaKeyGenParams.cpp */,
    2305823092                                57FEDD401DB6D73A00EB96F5 /* JSRsaKeyGenParams.h */,
     23093                                57E233601DC7D6AA00F28D01 /* JSRsaOtherPrimesInfo.cpp */,
     23094                                57E2335C1DC7D60800F28D01 /* JSRsaOtherPrimesInfo.h */,
    2305923095                                571F218A1DA57C7A005C9EFD /* JSSubtleCrypto.cpp */,
    2306023096                                571F21881DA57C54005C9EFD /* JSSubtleCrypto.h */,
     
    2464524681                                7CD0BA051B8F79C9005CEBBE /* ActiveDOMCallbackMicrotask.h in Headers */,
    2464624682                                E1C4DE690EA75C1E0023CCD6 /* ActiveDOMObject.h in Headers */,
     24683                                724EE5501DC80D7F00A91FFB /* ActivityState.h in Headers */,
     24684                                724EE5511DC80D8400A91FFB /* ActivityStateChangeObserver.h in Headers */,
    2464724685                                BCF7E491137CD7C7001DDAE7 /* AdjustViewSizeOrNot.h in Headers */,
    2464824686                                84D0C4061115F1EA0018AA34 /* AffineTransform.h in Headers */,
     
    2497725015                                E19AC3F71824E5D100349426 /* CryptoAlgorithmAesKeyGenParamsDeprecated.h in Headers */,
    2497825016                                E125F8321822F11B00D84CD9 /* CryptoAlgorithmHMAC.h in Headers */,
    24979                                 577483191DB4491F00716EF9 /* CryptoAlgorithmHmacKeyGenParams.h in Headers */,
     25017                                577483191DB4491F00716EF9 /* CryptoAlgorithmHmacKeyParams.h in Headers */,
    2498025018                                E19DA29C18189ADD00088BC8 /* CryptoAlgorithmHmacKeyParamsDeprecated.h in Headers */,
    2498125019                                E1C6571F1816E50300256CDD /* CryptoAlgorithmHmacParamsDeprecated.h in Headers */,
     
    2498625024                                E1FE136B183FE1AB00892F13 /* CryptoAlgorithmRSA_OAEP.h in Headers */,
    2498725025                                E1233F0D185A3E3B008DFAF5 /* CryptoAlgorithmRSAES_PKCS1_v1_5.h in Headers */,
     25026                                57E2336E1DCD43FD00F28D01 /* CryptoAlgorithmRsaHashedImportParams.h in Headers */,
    2498825027                                57F8273B1DB72D64009D2BF4 /* CryptoAlgorithmRsaHashedKeyGenParams.h in Headers */,
    2498925028                                57FEDD3F1DB6D59200EB96F5 /* CryptoAlgorithmRsaKeyGenParams.h in Headers */,
     
    2501825057                                BC274B2F140EBEB200EADFA6 /* CSSBorderImageSliceValue.h in Headers */,
    2501925058                                49AE2D8F134EE50C0072920A /* CSSCalculationValue.h in Headers */,
    25020                                 519DBC6F1DC011A700329BF5 /* IDBGetAllRecordsData.h in Headers */,
    2502125059                                BC6049CC0DB560C200204739 /* CSSCanvasValue.h in Headers */,
    2502225060                                BCEA4790097CAAC80094C9E4 /* CSSComputedStyleDeclaration.h in Headers */,
     
    2524025278                                A8185F3B09765766005826D9 /* DOMImplementation.h in Headers */,
    2524125279                                E3150EA71DA7219300194012 /* DOMJITHelpers.h in Headers */,
     25280                                E3C99A091DC3D41C00794AD3 /* DOMJITCheckDOM.h in Headers */,
     25281                                E3A776671DC85D2800B690D8 /* DOMJITIDLConvert.h in Headers */,
     25282                                E3A776681DC85D2800B690D8 /* DOMJITIDLType.h in Headers */,
     25283                                E35802B61DC8435D00A9773C /* DOMJITIDLTypeFilter.h in Headers */,
    2524225284                                A9C6E4E40D745E05006442E9 /* DOMMimeType.h in Headers */,
    2524325285                                A9C6E4E80D745E18006442E9 /* DOMMimeTypeArray.h in Headers */,
     
    2567325715                                5185FC8B1BB4C4E80012898F /* IDBEventDispatcher.h in Headers */,
    2567425716                                5185FC8D1BB4C4E80012898F /* IDBFactory.h in Headers */,
     25717                                519DBC6F1DC011A700329BF5 /* IDBGetAllRecordsData.h in Headers */,
     25718                                519DBC721DC10F5200329BF5 /* IDBGetAllResult.h in Headers */,
    2567525719                                5105F0691D4BA9D900FB80BC /* IDBGetRecordData.h in Headers */,
    2567625720                                5185FC8F1BB4C4E80012898F /* IDBGetResult.h in Headers */,
     
    2579325837                                F3ABFE0C130E9DA000E7F7D1 /* InstrumentingAgents.h in Headers */,
    2579425838                                0F4710DC1DB6FE22002DCEC3 /* IntersectionObserver.h in Headers */,
     25839                                0F8B45721DC3FBA300443C3F /* IntersectionObserverCallback.h in Headers */,
    2579525840                                0F4710DF1DB6FE22002DCEC3 /* IntersectionObserverEntry.h in Headers */,
    2579625841                                B27535720B053814002CE64F /* IntPoint.h in Headers */,
     
    2594125986                                BCBFB53D0DCD29CF0019B3E5 /* JSDOMWindowShell.h in Headers */,
    2594225987                                65E0E9441133C89F00B4CB10 /* JSDOMWrapper.h in Headers */,
    25943                                 E3A776671DC85D2800B690D8 /* DOMJITIDLConvert.h in Headers */,
     25988                                E318039D1DC40099009932C2 /* JSDynamicDowncast.h in Headers */,
    2594425989                                FD7868BA136B999200D403DF /* JSDynamicsCompressorNode.h in Headers */,
    2594525990                                65DF31FA09D1CC60000BE325 /* JSElement.h in Headers */,
     
    2597126016                                C280833F1C6DC26F001451B6 /* JSFontFace.h in Headers */,
    2597226017                                1C24EEA91C72A7B40080F8FC /* JSFontFaceSet.h in Headers */,
    25973                                 0F8B45721DC3FBA300443C3F /* IntersectionObserverCallback.h in Headers */,
    2597426018                                FDA15EAC12B03EE1003A583A /* JSGainNode.h in Headers */,
    2597526019                                518F5002194CAC3A0081BAAE /* JSGamepad.h in Headers */,
     
    2598026024                                8482B7521198CB6B00BFB005 /* JSHashChangeEvent.h in Headers */,
    2598126025                                BC94D14F0C275C68006BC617 /* JSHistory.h in Headers */,
    25982                                 5774831B1DB459BA00716EF9 /* JSHmacKeyGenParams.h in Headers */,
     26026                                57E233671DCAB21C00F28D01 /* JSHmacKeyParams.h in Headers */,
    2598326027                                BC97E413109154FA0010D361 /* JSHTMLAllCollection.h in Headers */,
    2598426028                                1A4A2DF00A1B852A00C807F8 /* JSHTMLAnchorElement.h in Headers */,
     
    2607726121                                7A0E771F10C00DB100A0276E /* JSInspectorFrontendHost.h in Headers */,
    2607826122                                0F4710E61DB700C7002DCEC3 /* JSIntersectionObserver.h in Headers */,
     26123                                0F8B45761DC41DBA00443C3F /* JSIntersectionObserverCallback.h in Headers */,
    2607926124                                0F4710E81DB700C7002DCEC3 /* JSIntersectionObserverEntry.h in Headers */,
     26125                                57E2335B1DC7D5E500F28D01 /* JSJsonWebKey.h in Headers */,
    2608026126                                A86629D309DA2B48009633A5 /* JSKeyboardEvent.h in Headers */,
    2608126127                                12A253E11C8FFF6600C22295 /* JSKeyframeEffect.h in Headers */,
     
    2614326189                                FDF6BAF9134A4C9800822920 /* JSOfflineAudioCompletionEvent.h in Headers */,
    2614426190                                FDA9326716703BA9008982DC /* JSOfflineAudioContext.h in Headers */,
     26191                                57E233651DC7DB1F00F28D01 /* JsonWebKey.h in Headers */,
    2614526192                                FDEA6243152102E200479DF0 /* JSOscillatorNode.h in Headers */,
    2614626193                                0704A40C1D6DFC690086DCDB /* JSOverconstrainedError.h in Headers */,
     
    2617426221                                4998AECE13F9D6C90090B1AA /* JSRequestAnimationFrameCallback.h in Headers */,
    2617526222                                BC74DA491013F468007987AD /* JSRGBColor.h in Headers */,
     26223                                57E233711DCD468F00F28D01 /* JSRsaHashedImportParams.h in Headers */,
    2617626224                                5768E4341DB7524500D0A4F7 /* JSRsaHashedKeyGenParams.h in Headers */,
    2617726225                                57FEDD411DB6D73A00EB96F5 /* JSRsaKeyGenParams.h in Headers */,
     26226                                57E2335D1DC7D60800F28D01 /* JSRsaOtherPrimesInfo.h in Headers */,
    2617826227                                073794E619EE2FF200E5A045 /* JSRTCConfiguration.h in Headers */,
    2617926228                                07969DAC17D14151007FF842 /* JSRTCDataChannel.h in Headers */,
     
    2649526544                                FFDBC047183D27B700407109 /* LineWidth.h in Headers */,
    2649626545                                A7AD2F880EC89D07008AB002 /* LinkHash.h in Headers */,
    26497                                 519DBC721DC10F5200329BF5 /* IDBGetAllResult.h in Headers */,
    2649826546                                1A4DA4221CDD3A8300F4473C /* LinkIconCollector.h in Headers */,
    2649926547                                1A250E0D1CDD632000D0BE63 /* LinkIconType.h in Headers */,
     
    2660626654                                CD8ACA8F1D23971900ECC59E /* MediaRemoteSoftLink.h in Headers */,
    2660726655                                CD8ACA8B1D23946400ECC59E /* MediaRemoteSPI.h in Headers */,
    26608                                 724EE5511DC80D8400A91FFB /* ActivityStateChangeObserver.h in Headers */,
    2660926656                                CEEFCD7A19DB31F7003876D7 /* MediaResourceLoader.h in Headers */,
    2661026657                                1BF9DB3C1D3973AD0026AEB7 /* MediaSample.h in Headers */,
     
    2661226659                                CDBEAEAD19D92B6C00BEBA88 /* MediaSelectionGroupAVFObjC.h in Headers */,
    2661326660                                C9027F421B1D0AD200BFBFEF /* MediaSession.h in Headers */,
    26614                                 83C45B8E1DC2B68A008871BA /* ValidationBubble.h in Headers */,
    2661526661                                C9F87CFE1B28F40E00979B83 /* MediaSessionEvents.h in Headers */,
    2661626662                                C96F5EC81B5872260091EA9D /* MediaSessionInterruptionProvider.h in Headers */,
     
    2717427220                                49E911C90EF86D47009D0CAF /* RotateTransformOperation.h in Headers */,
    2717527221                                A73F95FF12C97BFE0031AAF9 /* RoundedRect.h in Headers */,
     27222                                57E233631DC7DA2400F28D01 /* RsaOtherPrimesInfo.h in Headers */,
    2717627223                                07AB996918DA3C010018771E /* RTCConfiguration.h in Headers */,
    2717727224                                07AB996F18DA3C740018771E /* RTCConfigurationPrivate.h in Headers */,
     
    2751727564                                084DB59B128008CC002A6D64 /* SVGAnimatedString.h in Headers */,
    2751827565                                08250939128BD4D800E2ED8E /* SVGAnimatedTransformList.h in Headers */,
    27519                                 E3A776681DC85D2800B690D8 /* DOMJITIDLType.h in Headers */,
    2752027566                                085A15931289A8DD002710E3 /* SVGAnimatedTransformListPropertyTearOff.h in Headers */,
    2752127567                                439D334313A6911C00C20F4F /* SVGAnimatedType.h in Headers */,
     
    2766727713                                B2227A910D00BF220071B782 /* SVGPolygonElement.h in Headers */,
    2766827714                                B2227A940D00BF220071B782 /* SVGPolylineElement.h in Headers */,
    27669                                 E3C99A091DC3D41C00794AD3 /* DOMJITCheckDOM.h in Headers */,
    2767027715                                B2227A970D00BF220071B782 /* SVGPreserveAspectRatio.h in Headers */,
    2767127716                                088A0E0A126EF1DB00978F7A /* SVGProperty.h in Headers */,
     
    2775927804                                B2C3DA420D006C1D00EF6F26 /* TextCodecUTF16.h in Headers */,
    2776027805                                9343CB8212F25E510033C5EE /* TextCodecUTF8.h in Headers */,
    27761                                 0F8B45761DC41DBA00443C3F /* JSIntersectionObserverCallback.h in Headers */,
    2776227806                                142B97CA13138943008BEF4B /* TextControlInnerElements.h in Headers */,
    2776327807                                582DE3251C30C85400BE02A8 /* TextDecorationPainter.h in Headers */,
     
    2786827912                                5C6E65431D5CEFBF00F7862E /* URLParser.h in Headers */,
    2786927913                                7CC289DF1AA0FE5D009A9CE3 /* URLRegistry.h in Headers */,
    27870                                 E318039D1DC40099009932C2 /* JSDynamicDowncast.h in Headers */,
    2787127914                                93D437A21D57B3FE00AB85EA /* URLUtils.h in Headers */,
    2787227915                                A72763BF16689BFB002FCACB /* UserActionElementSet.h in Headers */,
     
    2789627939                                1FAFBF1915A5FA7400083A20 /* UTIUtilities.h in Headers */,
    2789727940                                2E3BBF081162DA1100B9409A /* UUID.h in Headers */,
     27941                                83C45B8E1DC2B68A008871BA /* ValidationBubble.h in Headers */,
    2789827942                                F5A154281279534D00D0B0C0 /* ValidationMessage.h in Headers */,
    2789927943                                F513A3EA15FF4841001526DB /* ValidationMessageClient.h in Headers */,
     
    2805628100                                4A5A2ADC161E7E00005889DD /* WebSocketExtensionParser.h in Headers */,
    2805728101                                97AABD2414FA09D5007457AE /* WebSocketExtensionProcessor.h in Headers */,
    28058                                 E35802B61DC8435D00A9773C /* DOMJITIDLTypeFilter.h in Headers */,
    2805928102                                97AABD2514FA09D5007457AE /* WebSocketFrame.h in Headers */,
    2806028103                                97AABD2714FA09D5007457AE /* WebSocketHandshake.h in Headers */,
     
    2807528118                                B10B6982140C174000BC1C26 /* WebVTTTokenizer.h in Headers */,
    2807628119                                CD8203101395ACE700F956C6 /* WebWindowAnimation.h in Headers */,
    28077                                 724EE5501DC80D7F00A91FFB /* ActivityState.h in Headers */,
    2807828120                                F55B3DE01251F12D003EF269 /* WeekInputType.h in Headers */,
    2807928121                                85031B510A44EFC700F992E0 /* WheelEvent.h in Headers */,
     
    2852328565                                31A795C81888BCB500382F90 /* ANGLEInstancedArrays.cpp in Sources */,
    2852428566                                490707E61219C04300D90E51 /* ANGLEWebKitBridge.cpp in Sources */,
    28525                                 0F8B45751DC41DBA00443C3F /* JSIntersectionObserverCallback.cpp in Sources */,
    2852628567                                49E912AA0EFAC906009D0CAF /* Animation.cpp in Sources */,
    2852728568                                316FE1110E6E1DA700BF6088 /* AnimationBase.cpp in Sources */,
     
    2871328754                                CDEA76341460B56F008B31F1 /* ClockGeneric.cpp in Sources */,
    2871428755                                9BD8A95A18BEFC7600987E9A /* CollectionIndexCache.cpp in Sources */,
    28715                                 519DBC6E1DC011A200329BF5 /* IDBGetAllRecordsData.cpp in Sources */,
    2871628756                                B27535660B053814002CE64F /* Color.cpp in Sources */,
    2871728757                                0FCF33240F2B9715004B6795 /* ColorCG.cpp in Sources */,
     
    2881128851                                E19AC3F9182566F700349426 /* CryptoKeyMac.cpp in Sources */,
    2881228852                                E1F80B8718317252007885C3 /* CryptoKeyPair.cpp in Sources */,
     28853                                57E2336B1DCC262400F28D01 /* CryptoKeyRSA.cpp in Sources */,
    2881328854                                E164FAA518315E1A00DB4E61 /* CryptoKeyRSAMac.cpp in Sources */,
    2881428855                                E125F859182C1AA600D84CD9 /* CryptoKeySerializationRaw.cpp in Sources */,
     
    2881628857                                CAE9F90F146441F000C245B0 /* CSSAspectRatioValue.cpp in Sources */,
    2881728858                                94DE5C811D7F3A1400164F2A /* CSSAtRuleID.cpp in Sources */,
    28818                                 41E408391DCB748900EFCE19 /* PeerConnectionBackend.cpp in Sources */,
    2881928859                                FBD6AF8B15EF25E5008B7110 /* CSSBasicShapes.cpp in Sources */,
    2882028860                                E16A84F914C85CCC002977DF /* CSSBorderImage.cpp in Sources */,
     
    2900829048                                2ED609BC1145B07100C8684E /* DOMFormData.cpp in Sources */,
    2900929049                                A8185F3E09765766005826D9 /* DOMImplementation.cpp in Sources */,
     29050                                E398FC241DC32A20003C4684 /* DOMJITHelpers.cpp in Sources */,
    2901029051                                A9C6E4E30D745E05006442E9 /* DOMMimeType.cpp in Sources */,
    2901129052                                A9C6E4E70D745E18006442E9 /* DOMMimeTypeArray.cpp in Sources */,
     
    2929829339                                A8EA7D310A19385500A8EF5F /* HTMLImageElement.cpp in Sources */,
    2929929340                                A8EA7D300A19385500A8EF5F /* HTMLImageLoader.cpp in Sources */,
    29300                                 E3B7C0631DC34160001FB0B8 /* JSDocumentDOMJIT.cpp in Sources */,
    2930129341                                A81369CD097374F600D74463 /* HTMLInputElement.cpp in Sources */,
    2930229342                                93309DE5099E64920056E581 /* HTMLInterchange.cpp in Sources */,
     
    2930929349                                A8EA7CAC0A192B9C00A8EF5F /* HTMLMarqueeElement.cpp in Sources */,
    2931029350                                E44613A40CD6331000FADA75 /* HTMLMediaElement.cpp in Sources */,
    29311                                 519DBC731DC10F5600329BF5 /* IDBGetAllResult.cpp in Sources */,
    2931229351                                C968B2E81B1E778100EF1F81 /* HTMLMediaElementMediaSession.cpp in Sources */,
    2931329352                                0779BF0D18453168000B6AE7 /* HTMLMediaElementMediaStream.cpp in Sources */,
     
    2939329432                                5185FC8A1BB4C4E80012898F /* IDBEventDispatcher.cpp in Sources */,
    2939429433                                5185FC8C1BB4C4E80012898F /* IDBFactory.cpp in Sources */,
     29434                                519DBC6E1DC011A200329BF5 /* IDBGetAllRecordsData.cpp in Sources */,
     29435                                519DBC731DC10F5600329BF5 /* IDBGetAllResult.cpp in Sources */,
    2939529436                                5105F06B1D4BB12700FB80BC /* IDBGetRecordData.cpp in Sources */,
    2939629437                                512F1A781C07EB6600908239 /* IDBGetResult.cpp in Sources */,
     
    2951629557                                FDA15EC912B03F50003A583A /* JSAnalyserNode.cpp in Sources */,
    2951729558                                31A795C61888BADC00382F90 /* JSANGLEInstancedArrays.cpp in Sources */,
    29518                                 83C45B8C1DC2B667008871BA /* ValidationBubbleMac.mm in Sources */,
    2951929559                                12A253E21C8FFF6600C22295 /* JSAnimatable.cpp in Sources */,
    2952029560                                120DE3FE1C87E18800B6D4DD /* JSAnimationEffect.cpp in Sources */,
     
    2961129651                                9BE6710B1D5AEB2100345514 /* JSCustomElementRegistry.cpp in Sources */,
    2961229652                                9BC5F9E01D5AAF6B002B749D /* JSCustomElementRegistryCustom.cpp in Sources */,
    29613                                 E398FC241DC32A20003C4684 /* DOMJITHelpers.cpp in Sources */,
    2961429653                                E4778B7F115A581A00B5D372 /* JSCustomEvent.cpp in Sources */,
    2961529654                                DEC297611B4F2F8D005F5945 /* JSCustomEventCustom.cpp in Sources */,
     
    2963329672                                1221E05D1C02B444006A1A00 /* JSDocumentAnimation.cpp in Sources */,
    2963429673                                49C7BA8D1042F5B10009D447 /* JSDocumentCustom.cpp in Sources */,
     29674                                E3B7C0631DC34160001FB0B8 /* JSDocumentDOMJIT.cpp in Sources */,
    2963529675                                1A494EDE0A123F4C00FDAFC1 /* JSDocumentFragment.cpp in Sources */,
    2963629676                                7C33F3621B4A050400502CAF /* JSDocumentFragmentCustom.cpp in Sources */,
     
    2972429764                                BC94D14E0C275C68006BC617 /* JSHistory.cpp in Sources */,
    2972529765                                BCE7B1930D4E86960075A539 /* JSHistoryCustom.cpp in Sources */,
    29726                                 5774831D1DB459DE00716EF9 /* JSHmacKeyGenParams.cpp in Sources */,
     29766                                57E233691DCAB24300F28D01 /* JSHmacKeyParams.cpp in Sources */,
    2972729767                                BC97E412109154FA0010D361 /* JSHTMLAllCollection.cpp in Sources */,
    2972829768                                BC97E42C10915B060010D361 /* JSHTMLAllCollectionCustom.cpp in Sources */,
     
    2973529775                                A80E7B120A19D606007FB8C5 /* JSHTMLBaseElement.cpp in Sources */,
    2973629776                                1AE2AA220A1CDAB400B42B25 /* JSHTMLBodyElement.cpp in Sources */,
    29737                                 837B7D201DC3F55000D051FC /* ValidationBubbleIOS.mm in Sources */,
    2973829777                                1AE2AA240A1CDAB400B42B25 /* JSHTMLBRElement.cpp in Sources */,
    2973929778                                A80E7EA00A1A83E3007FB8C5 /* JSHTMLButtonElement.cpp in Sources */,
     
    2984629885                                7A74ECBD101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp in Sources */,
    2984729886                                0F4710E51DB700C7002DCEC3 /* JSIntersectionObserver.cpp in Sources */,
     29887                                0F8B45751DC41DBA00443C3F /* JSIntersectionObserverCallback.cpp in Sources */,
    2984829888                                0F4710E71DB700C7002DCEC3 /* JSIntersectionObserverEntry.cpp in Sources */,
     29889                                57E2335F1DC7D67B00F28D01 /* JSJsonWebKey.cpp in Sources */,
    2984929890                                A86629D409DA2B48009633A5 /* JSKeyboardEvent.cpp in Sources */,
    2985029891                                12A253E01C8FFF6600C22295 /* JSKeyframeEffect.cpp in Sources */,
     
    2996030001                                4998AECD13F9D6C90090B1AA /* JSRequestAnimationFrameCallback.cpp in Sources */,
    2996130002                                BC74DA481013F468007987AD /* JSRGBColor.cpp in Sources */,
     30003                                57E233731DCD46B600F28D01 /* JSRsaHashedImportParams.cpp in Sources */,
    2996230004                                5768E4361DB7527400D0A4F7 /* JSRsaHashedKeyGenParams.cpp in Sources */,
    2996330005                                57FEDD431DB6D76000EB96F5 /* JSRsaKeyGenParams.cpp in Sources */,
     30006                                57E233611DC7D6AA00F28D01 /* JSRsaOtherPrimesInfo.cpp in Sources */,
    2996430007                                073794E519EE2FF200E5A045 /* JSRTCConfiguration.cpp in Sources */,
    2996530008                                07969DAB17D14151007FF842 /* JSRTCDataChannel.cpp in Sources */,
     
    3059130634                                B27535640B053814002CE64F /* PDFDocumentImage.cpp in Sources */,
    3059230635                                2D6E468417D660F500ECF8BB /* PDFDocumentImageMac.mm in Sources */,
     30636                                41E408391DCB748900EFCE19 /* PeerConnectionBackend.cpp in Sources */,
    3059330637                                8A7CC97012076F8A001D4588 /* PendingScript.cpp in Sources */,
    3059430638                                E526AF3F1727F8F200E41781 /* Performance.cpp in Sources */,
     
    3140831452                                1FAFBF1815A5FA6E00083A20 /* UTIUtilities.mm in Sources */,
    3140931453                                2E3BBF071162DA1100B9409A /* UUID.cpp in Sources */,
     31454                                837B7D201DC3F55000D051FC /* ValidationBubbleIOS.mm in Sources */,
     31455                                83C45B8C1DC2B667008871BA /* ValidationBubbleMac.mm in Sources */,
    3141031456                                F5A154271279534D00D0B0C0 /* ValidationMessage.cpp in Sources */,
    3141131457                                FD3160AE12B026F700C1A359 /* VectorMath.cpp in Sources */,
  • trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp

    r207809 r208548  
    3636#include "JSCryptoKeyPair.h"
    3737#include "JSDOMPromise.h"
    38 #include "JSHmacKeyGenParams.h"
     38#include "JSHmacKeyParams.h"
     39#include "JSJsonWebKey.h"
     40#include "JSRsaHashedImportParams.h"
    3941#include "JSRsaHashedKeyGenParams.h"
    4042#include "JSRsaKeyGenParams.h"
     
    4850
    4951enum class Operations {
     52    Digest,
    5053    GenerateKey,
    51     Digest,
     54    ImportKey,
    5255};
    5356
     
    8790        std::unique_ptr<CryptoAlgorithmParameters> result;
    8891        switch (operation) {
    89         case Operations::GenerateKey:
    90             switch (identifier) {
    91             case CryptoAlgorithmIdentifier::RSAES_PKCS1_v1_5: {
    92                 auto params = convertDictionary<CryptoAlgorithmRsaKeyGenParams>(state, value);
    93                 RETURN_IF_EXCEPTION(scope, nullptr);
    94                 result = std::make_unique<CryptoAlgorithmRsaKeyGenParams>(params);
    95                 break;
    96             }
    97             case CryptoAlgorithmIdentifier::RSASSA_PKCS1_v1_5:
    98             case CryptoAlgorithmIdentifier::RSA_PSS:
    99             case CryptoAlgorithmIdentifier::RSA_OAEP: {
    100                 auto params = convertDictionary<CryptoAlgorithmRsaHashedKeyGenParams>(state, value);
    101                 RETURN_IF_EXCEPTION(scope, nullptr);
    102                 params.hashIdentifier = toHashIdentifier(state, params.hash);
    103                 RETURN_IF_EXCEPTION(scope, nullptr);
    104                 result = std::make_unique<CryptoAlgorithmRsaHashedKeyGenParams>(params);
    105                 break;
    106             }
    107             case CryptoAlgorithmIdentifier::AES_CTR:
    108             case CryptoAlgorithmIdentifier::AES_CBC:
    109             case CryptoAlgorithmIdentifier::AES_CMAC:
    110             case CryptoAlgorithmIdentifier::AES_GCM:
    111             case CryptoAlgorithmIdentifier::AES_CFB:
    112             case CryptoAlgorithmIdentifier::AES_KW: {
    113                 auto params = convertDictionary<CryptoAlgorithmAesKeyGenParams>(state, value);
    114                 RETURN_IF_EXCEPTION(scope, nullptr);
    115                 result = std::make_unique<CryptoAlgorithmAesKeyGenParams>(params);
    116                 break;
    117             }
    118             case CryptoAlgorithmIdentifier::HMAC: {
    119                 auto params = convertDictionary<CryptoAlgorithmHmacKeyGenParams>(state, value);
    120                 RETURN_IF_EXCEPTION(scope, nullptr);
    121                 params.hashIdentifier = toHashIdentifier(state, params.hash);
    122                 RETURN_IF_EXCEPTION(scope, nullptr);
    123                 result = std::make_unique<CryptoAlgorithmHmacKeyGenParams>(params);
    124                 break;
    125             }
    126             default:
    127                 setDOMException(&state, NOT_SUPPORTED_ERR);
    128                 return nullptr;
    129             }
    130             break;
    13192        case Operations::Digest:
    13293            switch (identifier) {
     
    143104            }
    144105            break;
     106        case Operations::GenerateKey:
     107            switch (identifier) {
     108            case CryptoAlgorithmIdentifier::RSAES_PKCS1_v1_5: {
     109                auto params = convertDictionary<CryptoAlgorithmRsaKeyGenParams>(state, value);
     110                RETURN_IF_EXCEPTION(scope, nullptr);
     111                result = std::make_unique<CryptoAlgorithmRsaKeyGenParams>(params);
     112                break;
     113            }
     114            case CryptoAlgorithmIdentifier::RSASSA_PKCS1_v1_5:
     115            case CryptoAlgorithmIdentifier::RSA_PSS:
     116            case CryptoAlgorithmIdentifier::RSA_OAEP: {
     117                auto params = convertDictionary<CryptoAlgorithmRsaHashedKeyGenParams>(state, value);
     118                RETURN_IF_EXCEPTION(scope, nullptr);
     119                params.hashIdentifier = toHashIdentifier(state, params.hash);
     120                RETURN_IF_EXCEPTION(scope, nullptr);
     121                result = std::make_unique<CryptoAlgorithmRsaHashedKeyGenParams>(params);
     122                break;
     123            }
     124            case CryptoAlgorithmIdentifier::AES_CTR:
     125            case CryptoAlgorithmIdentifier::AES_CBC:
     126            case CryptoAlgorithmIdentifier::AES_CMAC:
     127            case CryptoAlgorithmIdentifier::AES_GCM:
     128            case CryptoAlgorithmIdentifier::AES_CFB:
     129            case CryptoAlgorithmIdentifier::AES_KW: {
     130                auto params = convertDictionary<CryptoAlgorithmAesKeyGenParams>(state, value);
     131                RETURN_IF_EXCEPTION(scope, nullptr);
     132                result = std::make_unique<CryptoAlgorithmAesKeyGenParams>(params);
     133                break;
     134            }
     135            case CryptoAlgorithmIdentifier::HMAC: {
     136                auto params = convertDictionary<CryptoAlgorithmHmacKeyParams>(state, value);
     137                RETURN_IF_EXCEPTION(scope, nullptr);
     138                params.hashIdentifier = toHashIdentifier(state, params.hash);
     139                RETURN_IF_EXCEPTION(scope, nullptr);
     140                result = std::make_unique<CryptoAlgorithmHmacKeyParams>(params);
     141                break;
     142            }
     143            default:
     144                setDOMException(&state, NOT_SUPPORTED_ERR);
     145                return nullptr;
     146            }
     147            break;
     148        case Operations::ImportKey:
     149            switch (identifier) {
     150            case CryptoAlgorithmIdentifier::RSAES_PKCS1_v1_5:
     151                result = std::make_unique<CryptoAlgorithmParameters>(params);
     152                break;
     153            case CryptoAlgorithmIdentifier::RSASSA_PKCS1_v1_5:
     154            case CryptoAlgorithmIdentifier::RSA_PSS:
     155            case CryptoAlgorithmIdentifier::RSA_OAEP: {
     156                auto params = convertDictionary<CryptoAlgorithmRsaHashedImportParams>(state, value);
     157                RETURN_IF_EXCEPTION(scope, nullptr);
     158                params.hashIdentifier = toHashIdentifier(state, params.hash);
     159                RETURN_IF_EXCEPTION(scope, nullptr);
     160                result = std::make_unique<CryptoAlgorithmRsaHashedImportParams>(params);
     161                break;
     162            }
     163            case CryptoAlgorithmIdentifier::AES_CTR:
     164            case CryptoAlgorithmIdentifier::AES_CBC:
     165            case CryptoAlgorithmIdentifier::AES_CMAC:
     166            case CryptoAlgorithmIdentifier::AES_GCM:
     167            case CryptoAlgorithmIdentifier::AES_CFB:
     168            case CryptoAlgorithmIdentifier::AES_KW:
     169                result = std::make_unique<CryptoAlgorithmParameters>(params);
     170                break;
     171            case CryptoAlgorithmIdentifier::HMAC: {
     172                auto params = convertDictionary<CryptoAlgorithmHmacKeyParams>(state, value);
     173                RETURN_IF_EXCEPTION(scope, nullptr);
     174                params.hashIdentifier = toHashIdentifier(state, params.hash);
     175                RETURN_IF_EXCEPTION(scope, nullptr);
     176                result = std::make_unique<CryptoAlgorithmHmacKeyParams>(params);
     177                break;
     178            }
     179            default:
     180                setDOMException(&state, NOT_SUPPORTED_ERR);
     181                return nullptr;
     182            }
     183            break;
    145184        default:
    146185            ASSERT_NOT_REACHED();
     
    156195}
    157196
     197static CryptoKeyUsage cryptoKeyUsageFromString(const String& usageString)
     198{
     199    CryptoKeyUsage result = 0;
     200    if (usageString == "encrypt")
     201        result = CryptoKeyUsageEncrypt;
     202    else if (usageString == "decrypt")
     203        result = CryptoKeyUsageDecrypt;
     204    else if (usageString == "sign")
     205        result = CryptoKeyUsageSign;
     206    else if (usageString == "verify")
     207        result = CryptoKeyUsageVerify;
     208    else if (usageString == "deriveKey")
     209        result = CryptoKeyUsageDeriveKey;
     210    else if (usageString == "deriveBits")
     211        result = CryptoKeyUsageDeriveBits;
     212    else if (usageString == "wrapKey")
     213        result = CryptoKeyUsageWrapKey;
     214    else if (usageString == "unwrapKey")
     215        result = CryptoKeyUsageUnwrapKey;
     216
     217    return result;
     218}
     219
    158220static CryptoKeyUsage cryptoKeyUsagesFromJSValue(ExecState& state, JSValue iterable)
    159221{
     
    167229        String usageString = nextItem.toWTFString(state);
    168230        RETURN_IF_EXCEPTION(scope, void());
    169         if (usageString == "encrypt")
    170             result |= CryptoKeyUsageEncrypt;
    171         else if (usageString == "decrypt")
    172             result |= CryptoKeyUsageDecrypt;
    173         else if (usageString == "sign")
    174             result |= CryptoKeyUsageSign;
    175         else if (usageString == "verify")
    176             result |= CryptoKeyUsageVerify;
    177         else if (usageString == "deriveKey")
    178             result |= CryptoKeyUsageDeriveKey;
    179         else if (usageString == "deriveBits")
    180             result |= CryptoKeyUsageDeriveBits;
    181         else if (usageString == "wrapKey")
    182             result |= CryptoKeyUsageWrapKey;
    183         else if (usageString == "unwrapKey")
    184             result |= CryptoKeyUsageUnwrapKey;
    185         else
     231        CryptoKeyUsage usage = cryptoKeyUsageFromString(usageString);
     232        if (!usage)
    186233            throwTypeError(state, scope, ASCIILiteral("Invalid KeyUsages"));
     234
     235        // Maybe we shouldn't silently bypass duplicated usages?
     236        result |= usage;
    187237    });
    188238    RETURN_IF_EXCEPTION(scope, 0);
     
    227277}
    228278
     279static KeyData toKeyData(ExecState& state, SubtleCrypto::KeyFormat format, JSValue value)
     280{
     281    VM& vm = state.vm();
     282    auto scope = DECLARE_THROW_SCOPE(vm);
     283
     284    KeyData result;
     285    switch (format) {
     286    case SubtleCrypto::KeyFormat::Spki:
     287    case SubtleCrypto::KeyFormat::Pkcs8:
     288        setDOMException(&state, NOT_SUPPORTED_ERR);
     289        return result;
     290    case SubtleCrypto::KeyFormat::Raw: {
     291        BufferSource bufferSource = convert<IDLBufferSource>(state, value);
     292        RETURN_IF_EXCEPTION(scope, result);
     293        Vector<uint8_t> vector;
     294        vector.append(bufferSource.data(), bufferSource.length());
     295        result = WTFMove(vector);
     296        return result;
     297    }
     298    case SubtleCrypto::KeyFormat::Jwk: {
     299        result = convertDictionary<JsonWebKey>(state, value);
     300        RETURN_IF_EXCEPTION(scope, result);
     301        CryptoKeyUsage usages = 0;
     302        if (WTF::get<JsonWebKey>(result).key_ops) {
     303            for (auto usageString : WTF::get<JsonWebKey>(result).key_ops.value()) {
     304                CryptoKeyUsage usage = cryptoKeyUsageFromString(usageString);
     305                if (!usage)
     306                    throwTypeError(&state, scope, ASCIILiteral("Invalid key_ops"));
     307                // Maybe we shouldn't silently bypass duplicated usages?
     308                usages |= cryptoKeyUsageFromString(usageString);
     309            }
     310        }
     311        WTF::get<JsonWebKey>(result).usages = usages;
     312        return result;
     313    }
     314    }
     315    ASSERT_NOT_REACHED();
     316    return result;
     317}
     318
    229319static void jsSubtleCryptoFunctionGenerateKeyPromise(ExecState& state, Ref<DeferredPromise>&& promise)
    230320{
     
    243333    RETURN_IF_EXCEPTION(scope, void());
    244334
    245     auto keyUsages = cryptoKeyUsagesFromJSValue(state, state.argument(2));
     335    auto keyUsages = cryptoKeyUsagesFromJSValue(state, state.uncheckedArgument(2));
    246336    RETURN_IF_EXCEPTION(scope, void());
    247337
     
    276366}
    277367
     368static void jsSubtleCryptoFunctionImportKeyPromise(ExecState& state, Ref<DeferredPromise>&& promise)
     369{
     370    VM& vm = state.vm();
     371    auto scope = DECLARE_THROW_SCOPE(vm);
     372
     373    if (UNLIKELY(state.argumentCount() < 5)) {
     374        promise->reject<JSValue>(createNotEnoughArgumentsError(&state));
     375        return;
     376    }
     377
     378    auto format = convertEnumeration<SubtleCrypto::KeyFormat>(state, state.uncheckedArgument(0));
     379    RETURN_IF_EXCEPTION(scope, void());
     380
     381    auto keyData = toKeyData(state, format, state.uncheckedArgument(1));
     382    RETURN_IF_EXCEPTION(scope, void());
     383
     384    auto params = normalizeCryptoAlgorithmParameters(state, state.uncheckedArgument(2), Operations::ImportKey);
     385    RETURN_IF_EXCEPTION(scope, void());
     386
     387    auto extractable = state.uncheckedArgument(3).toBoolean(&state);
     388    RETURN_IF_EXCEPTION(scope, void());
     389
     390    auto keyUsages = cryptoKeyUsagesFromJSValue(state, state.uncheckedArgument(4));
     391    RETURN_IF_EXCEPTION(scope, void());
     392
     393    auto algorithm = createAlgorithm(state, params->identifier);
     394    RETURN_IF_EXCEPTION(scope, void());
     395
     396    auto callback = [capturedPromise = promise.copyRef()](CryptoKey& key) mutable {
     397        if ((key.type() == CryptoKeyType::Private || key.type() == CryptoKeyType::Secret) && !key.usagesBitmap()) {
     398            rejectWithException(WTFMove(capturedPromise), SYNTAX_ERR);
     399            return;
     400        }
     401        capturedPromise->resolve(key);
     402    };
     403    auto exceptionCallback = [capturedPromise =  promise.copyRef()](ExceptionCode ec) mutable {
     404        rejectWithException(WTFMove(capturedPromise), ec);
     405    };
     406
     407    // The spec suggests we should perform the following task asynchronously as of 11 December 2014:
     408    // https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-importKey
     409    // That's simply not necessary. Therefore, we perform it synchronously.
     410    algorithm->importKey(format, WTFMove(keyData), WTFMove(params), extractable, keyUsages, WTFMove(callback), WTFMove(exceptionCallback));
     411}
     412
    278413JSValue JSSubtleCrypto::generateKey(ExecState& state)
    279414{
     
    281416}
    282417
     418JSValue JSSubtleCrypto::importKey(ExecState& state)
     419{
     420    return callPromiseFunction<jsSubtleCryptoFunctionImportKeyPromise, PromiseExecutionScope::WindowOrWorker>(state);
     421}
     422
    283423} // namespace WebCore
    284424
  • trunk/Source/WebCore/crypto/CryptoAlgorithm.cpp

    r207809 r208548  
    4242
    4343void CryptoAlgorithm::generateKey(const std::unique_ptr<CryptoAlgorithmParameters>&&, bool, CryptoKeyUsage, KeyOrKeyPairCallback&&, ExceptionCallback&& exceptionCallback, ScriptExecutionContext*)
     44{
     45    exceptionCallback(NOT_SUPPORTED_ERR);
     46}
     47
     48void CryptoAlgorithm::importKey(SubtleCrypto::KeyFormat, KeyData&&, const std::unique_ptr<CryptoAlgorithmParameters>&&, bool, CryptoKeyUsage, KeyCallback&&, ExceptionCallback&& exceptionCallback)
    4449{
    4550    exceptionCallback(NOT_SUPPORTED_ERR);
  • trunk/Source/WebCore/crypto/CryptoAlgorithm.h

    r207809 r208548  
    2929#include "CryptoAlgorithmIdentifier.h"
    3030#include "CryptoKeyUsage.h"
     31#include "JsonWebKey.h"
     32#include "SubtleCrypto.h"
    3133#include <wtf/Function.h>
    3234#include <wtf/Noncopyable.h>
    3335#include <wtf/RefCounted.h>
     36#include <wtf/Variant.h>
    3437#include <wtf/Vector.h>
    3538
     
    5053typedef std::pair<const uint8_t*, size_t> CryptoOperationData;
    5154
     55using KeyData = Variant<Vector<uint8_t>, JsonWebKey>;
     56
    5257class CryptoAlgorithm : public RefCounted<CryptoAlgorithm> {
    5358public:
     
    6469
    6570    virtual void generateKey(const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsage, KeyOrKeyPairCallback&&, ExceptionCallback&&, ScriptExecutionContext*);
     71    virtual void importKey(SubtleCrypto::KeyFormat, KeyData&&, const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsage, KeyCallback&&, ExceptionCallback&&);
    6672
    6773    // The following will be deprecated.
  • trunk/Source/WebCore/crypto/CryptoAlgorithmParameters.h

    r207809 r208548  
    3939        None,
    4040        AesKeyGenParams,
    41         HmacKeyGenParams,
     41        HmacKeyParams,
    4242        RsaHashedKeyGenParams,
     43        RsaHashedImportParams,
    4344        RsaKeyGenParams,
    4445    };
  • trunk/Source/WebCore/crypto/JsonWebKey.h

    r208547 r208548  
    2626#pragma once
    2727
    28 #include "CryptoAlgorithmParameters.h"
    29 #include <runtime/JSCJSValue.h>
     28#include "CryptoKeyUsage.h"
     29#include "RsaOtherPrimesInfo.h"
     30#include <wtf/Vector.h>
    3031
    3132#if ENABLE(SUBTLE_CRYPTO)
     
    3334namespace WebCore {
    3435
    35 class CryptoAlgorithmHmacKeyGenParams final : public CryptoAlgorithmParameters {
    36 public:
    37     // FIXME: Consider merging hash and hashIdentifier.
    38     JSC::JSValue hash;
    39     CryptoAlgorithmIdentifier hashIdentifier;
    40     Optional<unsigned long> length;
     36struct JsonWebKey {
     37    String kty;
     38    Optional<String> use;
     39    // FIXME: Consider merging key_ops and usages.
     40    Optional<Vector<String>> key_ops;
     41    CryptoKeyUsage usages;
     42    Optional<String> alg;
    4143
    42     Class parametersClass() const final { return Class::HmacKeyGenParams; }
     44    Optional<bool> ext;
     45
     46    Optional<String> crv;
     47    Optional<String> x;
     48    Optional<String> y;
     49    Optional<String> d;
     50    Optional<String> n;
     51    Optional<String> e;
     52    Optional<String> p;
     53    Optional<String> q;
     54    Optional<String> dp;
     55    Optional<String> dq;
     56    Optional<String> qi;
     57    Optional<Vector<RsaOtherPrimesInfo>> oth;
     58    Optional<String> k;
    4359};
    4460
    4561} // namespace WebCore
    4662
    47 SPECIALIZE_TYPE_TRAITS_CRYPTO_ALGORITHM_PARAMETERS(HmacKeyGenParams)
    48 
    4963#endif // ENABLE(SUBTLE_CRYPTO)
  • trunk/Source/WebCore/crypto/JsonWebKey.idl

    r208547 r208548  
    2626[
    2727    Conditional=SUBTLE_CRYPTO,
    28     ImplementedAs=CryptoAlgorithmHmacKeyGenParams
    29 ] dictionary HmacKeyGenParams : CryptoAlgorithmParameters {
    30     // The inner hash function to use.
    31     required any hash;
    32     // The length (in bits) of the key to generate. If unspecified, the
    33     // recommended length will be used, which is the size of the associated hash function's block
    34     // size.
    35     [EnforceRange] unsigned long length;
     28] dictionary JsonWebKey {
     29    // The following fields are defined in Section 3.1 of JSON Web Key
     30    required DOMString kty;
     31    DOMString use;
     32    sequence<DOMString> key_ops;
     33    DOMString alg;
     34
     35    // The following fields are defined in JSON Web Key Parameters Registration
     36    boolean ext;
     37
     38    // The following fields are defined in Section 6 of JSON Web Algorithms
     39    DOMString crv;
     40    DOMString x;
     41    DOMString y;
     42    DOMString d;
     43    DOMString n;
     44    DOMString e;
     45    DOMString p;
     46    DOMString q;
     47    DOMString dp;
     48    DOMString dq;
     49    DOMString qi;
     50    sequence<RsaOtherPrimesInfo> oth;
     51    DOMString k;
    3652};
  • trunk/Source/WebCore/crypto/RsaOtherPrimesInfo.h

    r208547 r208548  
    2626#pragma once
    2727
    28 #include "ContextDestructionObserver.h"
    29 #include <wtf/Ref.h>
    30 #include <wtf/RefCounted.h>
     28#include <wtf/text/WTFString.h>
    3129
    3230#if ENABLE(SUBTLE_CRYPTO)
     
    3432namespace WebCore {
    3533
    36 class SubtleCrypto : public ContextDestructionObserver, public RefCounted<SubtleCrypto> {
    37 public:
    38     static Ref<SubtleCrypto> create(ScriptExecutionContext& context) { return adoptRef(*new SubtleCrypto(context)); }
    39 
    40 private:
    41     SubtleCrypto(ScriptExecutionContext&);
     34struct RsaOtherPrimesInfo {
     35    String r;
     36    String d;
     37    String t;
    4238};
    4339
    44 }
     40} // namespace WebCore
    4541
    46 #endif
     42#endif // ENABLE(SUBTLE_CRYPTO)
  • trunk/Source/WebCore/crypto/RsaOtherPrimesInfo.idl

    r208547 r208548  
    2626[
    2727    Conditional=SUBTLE_CRYPTO,
    28     Exposed=(Window,Worker),
    29     GenerateIsReachable=ImplScriptExecutionContext,
    30     NoInterfaceObject,
    31 ] interface SubtleCrypto {
    32     // FIXME: Should this return a Promise<(CryptoKey or CryptoKeyPair)>?
    33     [Custom] Promise<any> generateKey(AlgorithmIdentifier algorithm, boolean extractable, sequence<KeyUsage> keyUsages);
     28] dictionary RsaOtherPrimesInfo {
     29    // The following fields are defined in Section 6.3.2.7 of JSON Web Algorithms
     30    required DOMString r;
     31    required DOMString d;
     32    required DOMString t;
    3433};
  • trunk/Source/WebCore/crypto/SubtleCrypto.h

    r206883 r208548  
    3636class SubtleCrypto : public ContextDestructionObserver, public RefCounted<SubtleCrypto> {
    3737public:
     38    enum class KeyFormat { Raw, Spki, Pkcs8, Jwk };
     39
    3840    static Ref<SubtleCrypto> create(ScriptExecutionContext& context) { return adoptRef(*new SubtleCrypto(context)); }
    3941
  • trunk/Source/WebCore/crypto/SubtleCrypto.idl

    r208474 r208548  
    2424 */
    2525
     26enum KeyFormat { "raw", "spki", "pkcs8", "jwk" };
     27
    2628[
    2729    Conditional=SUBTLE_CRYPTO,
     
    3234    // FIXME: Should this return a Promise<(CryptoKey or CryptoKeyPair)>?
    3335    [Custom] Promise<any> generateKey(AlgorithmIdentifier algorithm, boolean extractable, sequence<KeyUsage> keyUsages);
     36    [Custom] Promise<CryptoKey> importKey(KeyFormat format, (BufferSource or JsonWebKey) keyData, AlgorithmIdentifier algorithm, boolen extractable, sequence<KeyUsage> keyUsages);
    3437};
  • trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.cpp

    r207809 r208548  
    4040const char* const CryptoAlgorithmAES_CBC::s_name = "AES-CBC";
    4141
     42static inline bool usagesAreInvalidForCryptoAlgorithmAES_CBC(CryptoKeyUsage usages)
     43{
     44    return usages & (CryptoKeyUsageSign | CryptoKeyUsageVerify | CryptoKeyUsageDeriveKey | CryptoKeyUsageDeriveBits);
     45}
     46
    4247CryptoAlgorithmAES_CBC::CryptoAlgorithmAES_CBC()
    4348{
     
    7176    const auto& aesParameters = downcast<CryptoAlgorithmAesKeyGenParams>(*parameters);
    7277
    73     if (usages & (CryptoKeyUsageSign | CryptoKeyUsageVerify | CryptoKeyUsageDeriveKey | CryptoKeyUsageDeriveBits)) {
     78    if (usagesAreInvalidForCryptoAlgorithmAES_CBC(usages)) {
    7479        exceptionCallback(SYNTAX_ERR);
    7580        return;
     
    8388
    8489    callback(result.get(), nullptr);
     90}
     91
     92void CryptoAlgorithmAES_CBC::importKey(SubtleCrypto::KeyFormat format, KeyData&& data, const std::unique_ptr<CryptoAlgorithmParameters>&& parameters, bool extractable, CryptoKeyUsage usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
     93{
     94    if (usagesAreInvalidForCryptoAlgorithmAES_CBC(usages)) {
     95        exceptionCallback(SYNTAX_ERR);
     96        return;
     97    }
     98
     99    RefPtr<CryptoKeyAES> result;
     100    switch (format) {
     101    case SubtleCrypto::KeyFormat::Raw:
     102        result = CryptoKeyAES::importRaw(parameters->identifier, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages);
     103        break;
     104    case SubtleCrypto::KeyFormat::Jwk: {
     105        auto checkAlgCallback = [](size_t length, const Optional<String>& alg) -> bool {
     106            switch (length) {
     107            case CryptoKeyAES::s_length128:
     108                return !alg || alg.value() == "A128CBC";
     109            case CryptoKeyAES::s_length192:
     110                return !alg || alg.value() == "A192CBC";
     111            case CryptoKeyAES::s_length256:
     112                return !alg || alg.value() == "A256CBC";
     113            }
     114            return false;
     115        };
     116        result = CryptoKeyAES::importJwk(parameters->identifier, WTFMove(WTF::get<JsonWebKey>(data)), extractable, usages, WTFMove(checkAlgCallback));
     117        break;
     118    }
     119    default:
     120        exceptionCallback(NOT_SUPPORTED_ERR);
     121        return;
     122    }
     123    if (!result) {
     124        exceptionCallback(DataError);
     125        return;
     126    }
     127
     128    callback(*result);
    85129}
    86130
  • trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.h

    r207809 r208548  
    4646
    4747    void generateKey(const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsage, KeyOrKeyPairCallback&&, ExceptionCallback&&, ScriptExecutionContext*) final;
     48    void importKey(SubtleCrypto::KeyFormat, KeyData&&, const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsage, KeyCallback&&, ExceptionCallback&&) final;
    4849
    4950    // The following will be deprecated.
  • trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_KW.cpp

    r207809 r208548  
    3939const char* const CryptoAlgorithmAES_KW::s_name = "AES-KW";
    4040
     41static inline bool usagesAreInvalidForCryptoAlgorithmAES_KW(CryptoKeyUsage usages)
     42{
     43    return usages & (CryptoKeyUsageSign | CryptoKeyUsageVerify | CryptoKeyUsageDeriveKey | CryptoKeyUsageDeriveBits | CryptoKeyUsageEncrypt | CryptoKeyUsageDecrypt);
     44}
     45
    4146CryptoAlgorithmAES_KW::CryptoAlgorithmAES_KW()
    4247{
     
    7075    const auto& aesParameters = downcast<CryptoAlgorithmAesKeyGenParams>(*parameters);
    7176
    72     if (usages & (CryptoKeyUsageSign | CryptoKeyUsageVerify | CryptoKeyUsageDeriveKey | CryptoKeyUsageDeriveBits | CryptoKeyUsageEncrypt | CryptoKeyUsageDecrypt)) {
     77    if (usagesAreInvalidForCryptoAlgorithmAES_KW(usages)) {
    7378        exceptionCallback(SYNTAX_ERR);
    7479        return;
     
    8287
    8388    callback(result.get(), nullptr);
     89}
     90
     91void CryptoAlgorithmAES_KW::importKey(SubtleCrypto::KeyFormat format, KeyData&& data, const std::unique_ptr<CryptoAlgorithmParameters>&& parameters, bool extractable, CryptoKeyUsage usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
     92{
     93    if (usagesAreInvalidForCryptoAlgorithmAES_KW(usages)) {
     94        exceptionCallback(SYNTAX_ERR);
     95        return;
     96    }
     97
     98    RefPtr<CryptoKeyAES> result;
     99    switch (format) {
     100    case SubtleCrypto::KeyFormat::Raw:
     101        result = CryptoKeyAES::importRaw(parameters->identifier, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages);
     102        break;
     103    case SubtleCrypto::KeyFormat::Jwk: {
     104        auto checkAlgCallback = [](size_t length, const Optional<String>& alg) -> bool {
     105            switch (length) {
     106            case CryptoKeyAES::s_length128:
     107                return !alg || alg.value() == "A128KW";
     108            case CryptoKeyAES::s_length192:
     109                return !alg || alg.value() == "A192KW";
     110            case CryptoKeyAES::s_length256:
     111                return !alg || alg.value() == "A256KW";
     112            }
     113            return false;
     114        };
     115        result = CryptoKeyAES::importJwk(parameters->identifier, WTFMove(WTF::get<JsonWebKey>(data)), extractable, usages, WTFMove(checkAlgCallback));
     116        break;
     117    }
     118    default:
     119        exceptionCallback(NOT_SUPPORTED_ERR);
     120        return;
     121    }
     122    if (!result) {
     123        exceptionCallback(DataError);
     124        return;
     125    }
     126
     127    callback(*result);
    84128}
    85129
  • trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_KW.h

    r207809 r208548  
    4545
    4646    void generateKey(const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsage, KeyOrKeyPairCallback&&, ExceptionCallback&&, ScriptExecutionContext*) final;
     47    void importKey(SubtleCrypto::KeyFormat, KeyData&&, const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsage, KeyCallback&&, ExceptionCallback&&) final;
    4748
    4849    // The following will be deprecated.
  • trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.cpp

    r207809 r208548  
    2929#if ENABLE(SUBTLE_CRYPTO)
    3030
    31 #include "CryptoAlgorithmHmacKeyGenParams.h"
     31#include "CryptoAlgorithmHmacKeyParams.h"
    3232#include "CryptoAlgorithmHmacKeyParamsDeprecated.h"
    3333#include "CryptoAlgorithmHmacParamsDeprecated.h"
     
    3939
    4040const char* const CryptoAlgorithmHMAC::s_name = "HMAC";
     41
     42static inline bool usagesAreInvalidForCryptoAlgorithmHMAC(CryptoKeyUsage usages)
     43{
     44    return usages & (CryptoKeyUsageEncrypt | CryptoKeyUsageDecrypt | CryptoKeyUsageDeriveKey | CryptoKeyUsageDeriveBits | CryptoKeyUsageWrapKey | CryptoKeyUsageUnwrapKey);
     45}
    4146
    4247CryptoAlgorithmHMAC::CryptoAlgorithmHMAC()
     
    7176void CryptoAlgorithmHMAC::generateKey(const std::unique_ptr<CryptoAlgorithmParameters>&& parameters, bool extractable, CryptoKeyUsage usages, KeyOrKeyPairCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext*)
    7277{
    73     const auto& hmacParameters = downcast<CryptoAlgorithmHmacKeyGenParams>(*parameters);
     78    const auto& hmacParameters = downcast<CryptoAlgorithmHmacKeyParams>(*parameters);
    7479
    75     if (usages & (CryptoKeyUsageEncrypt | CryptoKeyUsageDecrypt | CryptoKeyUsageDeriveKey | CryptoKeyUsageDeriveBits | CryptoKeyUsageWrapKey | CryptoKeyUsageUnwrapKey)) {
     80    if (usagesAreInvalidForCryptoAlgorithmHMAC(usages)) {
    7681        exceptionCallback(SYNTAX_ERR);
    7782        return;
     
    9095
    9196    callback(result.get(), nullptr);
     97}
     98
     99void CryptoAlgorithmHMAC::importKey(SubtleCrypto::KeyFormat format, KeyData&& data, const std::unique_ptr<CryptoAlgorithmParameters>&& parameters, bool extractable, CryptoKeyUsage usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
     100{
     101    const auto& hmacParameters = downcast<CryptoAlgorithmHmacKeyParams>(*parameters);
     102
     103    if (usagesAreInvalidForCryptoAlgorithmHMAC(usages)) {
     104        exceptionCallback(SYNTAX_ERR);
     105        return;
     106    }
     107
     108    RefPtr<CryptoKeyHMAC> result;
     109    switch (format) {
     110    case SubtleCrypto::KeyFormat::Raw:
     111        result = CryptoKeyHMAC::importRaw(hmacParameters.length.valueOr(0), hmacParameters.hashIdentifier, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages);
     112        break;
     113    case SubtleCrypto::KeyFormat::Jwk: {
     114        auto checkAlgCallback = [](CryptoAlgorithmIdentifier hash, const Optional<String>& alg) -> bool {
     115            switch (hash) {
     116            case CryptoAlgorithmIdentifier::SHA_1:
     117                return !alg || alg.value() == "HS1";
     118            case CryptoAlgorithmIdentifier::SHA_224:
     119                return !alg || alg.value() == "HS224";
     120            case CryptoAlgorithmIdentifier::SHA_256:
     121                return !alg || alg.value() == "HS256";
     122            case CryptoAlgorithmIdentifier::SHA_384:
     123                return !alg || alg.value() == "HS384";
     124            case CryptoAlgorithmIdentifier::SHA_512:
     125                return !alg || alg.value() == "HS512";
     126            default:
     127                return false;
     128            }
     129            return false;
     130        };
     131        result = CryptoKeyHMAC::importJwk(hmacParameters.length.valueOr(0), hmacParameters.hashIdentifier, WTFMove(WTF::get<JsonWebKey>(data)), extractable, usages, WTFMove(checkAlgCallback));
     132        break;
     133    }
     134    default:
     135        exceptionCallback(NOT_SUPPORTED_ERR);
     136        return;
     137    }
     138    if (!result) {
     139        exceptionCallback(DataError);
     140        return;
     141    }
     142
     143    callback(*result);
    92144}
    93145
  • trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.h

    r207809 r208548  
    4646
    4747    void generateKey(const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsage, KeyOrKeyPairCallback&&, ExceptionCallback&&, ScriptExecutionContext*) final;
     48    void importKey(SubtleCrypto::KeyFormat, KeyData&&, const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsage, KeyCallback&&, ExceptionCallback&&) final;
    4849
    4950    // The following will be deprecated.
  • trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp

    r207809 r208548  
    8989}
    9090
     91void CryptoAlgorithmRSAES_PKCS1_v1_5::importKey(SubtleCrypto::KeyFormat format, KeyData&& data, const std::unique_ptr<CryptoAlgorithmParameters>&& parameters, bool extractable, CryptoKeyUsage usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
     92{
     93    RefPtr<CryptoKeyRSA> result;
     94    switch (format) {
     95    case SubtleCrypto::KeyFormat::Jwk: {
     96        JsonWebKey key = WTFMove(WTF::get<JsonWebKey>(data));
     97        if ((key.d && (usages ^ CryptoKeyUsageDecrypt)) || (!key.d && (usages ^ CryptoKeyUsageEncrypt))) {
     98            exceptionCallback(SYNTAX_ERR);
     99            return;
     100        }
     101        if (usages && key.use && key.use.value() != "enc") {
     102            exceptionCallback(DataError);
     103            return;
     104        }
     105        if (key.alg && key.alg.value() != "RSA1_5") {
     106            exceptionCallback(DataError);
     107            return;
     108        }
     109        result = CryptoKeyRSA::importJwk(parameters->identifier, Nullopt, WTFMove(key), extractable, usages);
     110        break;
     111    }
     112    default:
     113        exceptionCallback(NOT_SUPPORTED_ERR);
     114        return;
     115    }
     116    if (!result) {
     117        exceptionCallback(DataError);
     118        return;
     119    }
     120
     121    callback(*result);
     122}
     123
    91124void CryptoAlgorithmRSAES_PKCS1_v1_5::encrypt(const CryptoAlgorithmParametersDeprecated&, const CryptoKey& key, const CryptoOperationData& data, VectorCallback&& callback, VoidCallback&& failureCallback, ExceptionCode& ec)
    92125{
  • trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.h

    r207809 r208548  
    4646
    4747    void generateKey(const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsage, KeyOrKeyPairCallback&&, ExceptionCallback&&, ScriptExecutionContext*) final;
     48    void importKey(SubtleCrypto::KeyFormat, KeyData&&, const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsage, KeyCallback&&, ExceptionCallback&&) final;
    4849
    4950    // The following will be deprecated.
  • trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp

    r207809 r208548  
    2929#if ENABLE(SUBTLE_CRYPTO)
    3030
     31#include "CryptoAlgorithmRsaHashedImportParams.h"
    3132#include "CryptoAlgorithmRsaHashedKeyGenParams.h"
    3233#include "CryptoAlgorithmRsaKeyGenParamsDeprecated.h"
     
    9293}
    9394
     95void CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey(SubtleCrypto::KeyFormat format, KeyData&& data, const std::unique_ptr<CryptoAlgorithmParameters>&& parameters, bool extractable, CryptoKeyUsage usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
     96{
     97    const auto& rsaParameters = downcast<CryptoAlgorithmRsaHashedImportParams>(*parameters);
     98
     99    RefPtr<CryptoKeyRSA> result;
     100    switch (format) {
     101    case SubtleCrypto::KeyFormat::Jwk: {
     102        JsonWebKey key = WTFMove(WTF::get<JsonWebKey>(data));
     103
     104        if ((key.d && (usages ^ CryptoKeyUsageSign)) || (!key.d && (usages ^ CryptoKeyUsageVerify))) {
     105            exceptionCallback(SYNTAX_ERR);
     106            return;
     107        }
     108        if (usages && key.use && key.use.value() != "sig") {
     109            exceptionCallback(DataError);
     110            return;
     111        }
     112
     113        bool isMatched = false;
     114        switch (rsaParameters.hashIdentifier) {
     115        case CryptoAlgorithmIdentifier::SHA_1:
     116            isMatched = !key.alg || key.alg.value() == "RS1";
     117            break;
     118        case CryptoAlgorithmIdentifier::SHA_224:
     119            isMatched = !key.alg || key.alg.value() == "RS224";
     120            break;
     121        case CryptoAlgorithmIdentifier::SHA_256:
     122            isMatched = !key.alg || key.alg.value() == "RS256";
     123            break;
     124        case CryptoAlgorithmIdentifier::SHA_384:
     125            isMatched = !key.alg || key.alg.value() == "RS384";
     126            break;
     127        case CryptoAlgorithmIdentifier::SHA_512:
     128            isMatched = !key.alg || key.alg.value() == "RS512";
     129            break;
     130        default:
     131            break;
     132        }
     133        if (!isMatched) {
     134            exceptionCallback(DataError);
     135            return;
     136        }
     137
     138        result = CryptoKeyRSA::importJwk(rsaParameters.identifier, rsaParameters.hashIdentifier, WTFMove(key), extractable, usages);
     139        break;
     140    }
     141    default:
     142        exceptionCallback(NOT_SUPPORTED_ERR);
     143        return;
     144    }
     145    if (!result) {
     146        exceptionCallback(DataError);
     147        return;
     148    }
     149
     150    callback(*result);
     151}
     152
    94153void CryptoAlgorithmRSASSA_PKCS1_v1_5::sign(const CryptoAlgorithmParametersDeprecated& parameters, const CryptoKey& key, const CryptoOperationData& data, VectorCallback&& callback, VoidCallback&& failureCallback, ExceptionCode& ec)
    95154{
  • trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h

    r207809 r208548  
    4646
    4747    void generateKey(const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsage, KeyOrKeyPairCallback&&, ExceptionCallback&&, ScriptExecutionContext*) final;
     48    void importKey(SubtleCrypto::KeyFormat, KeyData&&, const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsage, KeyCallback&&, ExceptionCallback&&) final;
    4849
    4950    // The following will be deprecated.
  • trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp

    r207809 r208548  
    2929#if ENABLE(SUBTLE_CRYPTO)
    3030
     31#include "CryptoAlgorithmRsaHashedImportParams.h"
    3132#include "CryptoAlgorithmRsaHashedKeyGenParams.h"
    3233#include "CryptoAlgorithmRsaKeyGenParamsDeprecated.h"
     
    9293}
    9394
     95void CryptoAlgorithmRSA_OAEP::importKey(SubtleCrypto::KeyFormat format, KeyData&& data, const std::unique_ptr<CryptoAlgorithmParameters>&& parameters, bool extractable, CryptoKeyUsage usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
     96{
     97    const auto& rsaParameters = downcast<CryptoAlgorithmRsaHashedImportParams>(*parameters);
     98
     99    RefPtr<CryptoKeyRSA> result;
     100    switch (format) {
     101    case SubtleCrypto::KeyFormat::Jwk: {
     102        JsonWebKey key = WTFMove(WTF::get<JsonWebKey>(data));
     103
     104        bool isUsagesAllowed = false;
     105        if (key.d) {
     106            isUsagesAllowed = isUsagesAllowed || !(usages ^ CryptoKeyUsageDecrypt);
     107            isUsagesAllowed = isUsagesAllowed || !(usages ^ CryptoKeyUsageUnwrapKey);
     108            isUsagesAllowed = isUsagesAllowed || !(usages ^ (CryptoKeyUsageDecrypt | CryptoKeyUsageUnwrapKey));
     109        } else {
     110            isUsagesAllowed = isUsagesAllowed || !(usages ^ CryptoKeyUsageEncrypt);
     111            isUsagesAllowed = isUsagesAllowed || !(usages ^ CryptoKeyUsageWrapKey);
     112            isUsagesAllowed = isUsagesAllowed || !(usages ^ (CryptoKeyUsageEncrypt | CryptoKeyUsageWrapKey));
     113        }
     114        if (!isUsagesAllowed) {
     115            exceptionCallback(SYNTAX_ERR);
     116            return;
     117        }
     118
     119        if (usages && key.use && key.use.value() != "enc") {
     120            exceptionCallback(DataError);
     121            return;
     122        }
     123
     124        bool isMatched = false;
     125        switch (rsaParameters.hashIdentifier) {
     126        case CryptoAlgorithmIdentifier::SHA_1:
     127            isMatched = !key.alg || key.alg.value() == "RSA-OAEP";
     128            break;
     129        case CryptoAlgorithmIdentifier::SHA_224:
     130            isMatched = !key.alg || key.alg.value() == "RSA-OAEP-224";
     131            break;
     132        case CryptoAlgorithmIdentifier::SHA_256:
     133            isMatched = !key.alg || key.alg.value() == "RSA-OAEP-256";
     134            break;
     135        case CryptoAlgorithmIdentifier::SHA_384:
     136            isMatched = !key.alg || key.alg.value() == "RSA-OAEP-384";
     137            break;
     138        case CryptoAlgorithmIdentifier::SHA_512:
     139            isMatched = !key.alg || key.alg.value() == "RSA-OAEP-512";
     140            break;
     141        default:
     142            break;
     143        }
     144        if (!isMatched) {
     145            exceptionCallback(DataError);
     146            return;
     147        }
     148
     149        result = CryptoKeyRSA::importJwk(rsaParameters.identifier, rsaParameters.hashIdentifier, WTFMove(key), extractable, usages);
     150        break;
     151    }
     152    default:
     153        exceptionCallback(NOT_SUPPORTED_ERR);
     154        return;
     155    }
     156    if (!result) {
     157        exceptionCallback(DataError);
     158        return;
     159    }
     160
     161    callback(*result);
     162}
     163
    94164void CryptoAlgorithmRSA_OAEP::encrypt(const CryptoAlgorithmParametersDeprecated& parameters, const CryptoKey& key, const CryptoOperationData& data, VectorCallback&& callback, VoidCallback&& failureCallback, ExceptionCode& ec)
    95165{
  • trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.h

    r207809 r208548  
    4646
    4747    void generateKey(const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsage, KeyOrKeyPairCallback&&, ExceptionCallback&&, ScriptExecutionContext*) final;
     48    void importKey(SubtleCrypto::KeyFormat, KeyData&&, const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsage, KeyCallback&&, ExceptionCallback&&) final;
    4849
    4950    // The following will be deprecated.
  • trunk/Source/WebCore/crypto/keys/CryptoKeyAES.cpp

    r207809 r208548  
    3131#include "CryptoAlgorithmRegistry.h"
    3232#include "CryptoKeyDataOctetSequence.h"
     33#include "JsonWebKey.h"
     34#include <wtf/text/Base64.h>
    3335#include <wtf/text/WTFString.h>
    3436
    3537namespace WebCore {
    3638
     39static inline bool lengthIsValid(size_t length)
     40{
     41    return (length == CryptoKeyAES::s_length128) || (length == CryptoKeyAES::s_length192) || (length == CryptoKeyAES::s_length256);
     42}
     43
    3744CryptoKeyAES::CryptoKeyAES(CryptoAlgorithmIdentifier algorithm, const Vector<uint8_t>& key, bool extractable, CryptoKeyUsage usage)
    3845    : CryptoKey(algorithm, CryptoKeyType::Secret, extractable, usage)
    3946    , m_key(key)
     47{
     48    ASSERT(isValidAESAlgorithm(algorithm));
     49}
     50
     51CryptoKeyAES::CryptoKeyAES(CryptoAlgorithmIdentifier algorithm, Vector<uint8_t>&& key, bool extractable, CryptoKeyUsage usage)
     52    : CryptoKey(algorithm, CryptoKeyType::Secret, extractable, usage)
     53    , m_key(WTFMove(key))
    4054{
    4155    ASSERT(isValidAESAlgorithm(algorithm));
     
    5872RefPtr<CryptoKeyAES> CryptoKeyAES::generate(CryptoAlgorithmIdentifier algorithm, size_t lengthBits, bool extractable, CryptoKeyUsage usages)
    5973{
    60     if ((lengthBits != 128) && (lengthBits != 192) && (lengthBits != 256))
     74    if (!lengthIsValid(lengthBits))
    6175        return nullptr;
    6276    return adoptRef(new CryptoKeyAES(algorithm, randomData(lengthBits / 8), extractable, usages));
     77}
     78
     79RefPtr<CryptoKeyAES> CryptoKeyAES::importRaw(CryptoAlgorithmIdentifier algorithm, Vector<uint8_t>&& keyData, bool extractable, CryptoKeyUsage usages)
     80{
     81    if (!lengthIsValid(keyData.size() * 8))
     82        return nullptr;
     83    return adoptRef(new CryptoKeyAES(algorithm, WTFMove(keyData), extractable, usages));
     84}
     85
     86RefPtr<CryptoKeyAES> CryptoKeyAES::importJwk(CryptoAlgorithmIdentifier algorithm, JsonWebKey&& keyData, bool extractable, CryptoKeyUsage usages, CheckAlgCallback&& callback)
     87{
     88    if (keyData.kty != "oct")
     89        return nullptr;
     90    if (!keyData.k)
     91        return nullptr;
     92    Vector<uint8_t> octetSequence;
     93    if (!base64URLDecode(keyData.k.value(), octetSequence))
     94        return nullptr;
     95    if (!callback(octetSequence.size() * 8, keyData.alg))
     96        return nullptr;
     97    if (usages && keyData.use && keyData.use.value() != "enc")
     98        return nullptr;
     99    if (keyData.usages && ((keyData.usages & usages) != usages))
     100        return nullptr;
     101    if (keyData.ext && !keyData.ext.value() && extractable)
     102        return nullptr;
     103
     104    return adoptRef(new CryptoKeyAES(algorithm, WTFMove(octetSequence), extractable, usages));
    63105}
    64106
  • trunk/Source/WebCore/crypto/keys/CryptoKeyAES.h

    r205941 r208548  
    2929#include "CryptoAlgorithmIdentifier.h"
    3030#include "CryptoKey.h"
     31#include <wtf/Function.h>
    3132#include <wtf/Vector.h>
    3233
     
    3435
    3536namespace WebCore {
     37
     38struct JsonWebKey;
    3639
    3740class AesKeyAlgorithm final : public KeyAlgorithm {
     
    5356class CryptoKeyAES final : public CryptoKey {
    5457public:
     58    static const int s_length128 = 128;
     59    static const int s_length192 = 192;
     60    static const int s_length256 = 256;
     61
    5562    static Ref<CryptoKeyAES> create(CryptoAlgorithmIdentifier algorithm, const Vector<uint8_t>& key, bool extractable, CryptoKeyUsage usage)
    5663    {
     
    6269
    6370    static RefPtr<CryptoKeyAES> generate(CryptoAlgorithmIdentifier, size_t lengthBits, bool extractable, CryptoKeyUsage);
     71    static RefPtr<CryptoKeyAES> importRaw(CryptoAlgorithmIdentifier, Vector<uint8_t>&& keyData, bool extractable, CryptoKeyUsage);
     72    using CheckAlgCallback = WTF::Function<bool(size_t, const Optional<String>&)>;
     73    static RefPtr<CryptoKeyAES> importJwk(CryptoAlgorithmIdentifier, JsonWebKey&&, bool extractable, CryptoKeyUsage, CheckAlgCallback&&);
    6474
    6575    CryptoKeyClass keyClass() const final { return CryptoKeyClass::AES; }
     
    6979private:
    7080    CryptoKeyAES(CryptoAlgorithmIdentifier, const Vector<uint8_t>& key, bool extractable, CryptoKeyUsage);
     81    CryptoKeyAES(CryptoAlgorithmIdentifier, Vector<uint8_t>&& key, bool extractable, CryptoKeyUsage);
    7182
    7283    std::unique_ptr<KeyAlgorithm> buildAlgorithm() const final;
  • trunk/Source/WebCore/crypto/keys/CryptoKeyDataRSAComponents.cpp

    r159390 r208548  
    3939}
    4040
     41CryptoKeyDataRSAComponents::CryptoKeyDataRSAComponents(Vector<uint8_t>&& modulus, Vector<uint8_t>&& exponent)
     42    : CryptoKeyData(CryptoKeyData::Format::RSAComponents)
     43    , m_type(Type::Public)
     44    , m_modulus(WTFMove(modulus))
     45    , m_exponent(WTFMove(exponent))
     46{
     47}
     48
    4149CryptoKeyDataRSAComponents::CryptoKeyDataRSAComponents(const Vector<uint8_t>& modulus, const Vector<uint8_t>& exponent, const Vector<uint8_t>& privateExponent)
    4250    : CryptoKeyData(CryptoKeyData::Format::RSAComponents)
     
    4553    , m_exponent(exponent)
    4654    , m_privateExponent(privateExponent)
     55    , m_hasAdditionalPrivateKeyParameters(false)
     56{
     57}
     58
     59CryptoKeyDataRSAComponents::CryptoKeyDataRSAComponents(Vector<uint8_t>&& modulus, Vector<uint8_t>&& exponent, Vector<uint8_t>&& privateExponent)
     60    : CryptoKeyData(CryptoKeyData::Format::RSAComponents)
     61    , m_type(Type::Private)
     62    , m_modulus(WTFMove(modulus))
     63    , m_exponent(WTFMove(exponent))
     64    , m_privateExponent(WTFMove(privateExponent))
    4765    , m_hasAdditionalPrivateKeyParameters(false)
    4866{
     
    6280}
    6381
     82CryptoKeyDataRSAComponents::CryptoKeyDataRSAComponents(Vector<uint8_t>&& modulus, Vector<uint8_t>&& exponent, Vector<uint8_t>&& privateExponent, PrimeInfo&& firstPrimeInfo, PrimeInfo&& secondPrimeInfo, Vector<PrimeInfo>&& otherPrimeInfos)
     83    : CryptoKeyData(CryptoKeyData::Format::RSAComponents)
     84    , m_type(Type::Private)
     85    , m_modulus(WTFMove(modulus))
     86    , m_exponent(WTFMove(exponent))
     87    , m_privateExponent(WTFMove(privateExponent))
     88    , m_hasAdditionalPrivateKeyParameters(true)
     89    , m_firstPrimeInfo(WTFMove(firstPrimeInfo))
     90    , m_secondPrimeInfo(WTFMove(secondPrimeInfo))
     91    , m_otherPrimeInfos(WTFMove(otherPrimeInfos))
     92{
     93}
     94
    6495CryptoKeyDataRSAComponents::~CryptoKeyDataRSAComponents()
    6596{
  • trunk/Source/WebCore/crypto/keys/CryptoKeyDataRSAComponents.h

    r174337 r208548  
    5151        return std::unique_ptr<CryptoKeyDataRSAComponents>(new CryptoKeyDataRSAComponents(modulus, exponent));
    5252    }
     53    static std::unique_ptr<CryptoKeyDataRSAComponents> createPublic(Vector<uint8_t>&& modulus, Vector<uint8_t>&& exponent)
     54    {
     55        return std::unique_ptr<CryptoKeyDataRSAComponents>(new CryptoKeyDataRSAComponents(WTFMove(modulus), WTFMove(exponent)));
     56    }
    5357
    5458    static std::unique_ptr<CryptoKeyDataRSAComponents> createPrivate(const Vector<uint8_t>& modulus, const Vector<uint8_t>& exponent, const Vector<uint8_t>& privateExponent)
     
    5660        return std::unique_ptr<CryptoKeyDataRSAComponents>(new CryptoKeyDataRSAComponents(modulus, exponent, privateExponent));
    5761    }
     62    static std::unique_ptr<CryptoKeyDataRSAComponents> createPrivate(Vector<uint8_t>&& modulus, Vector<uint8_t>&& exponent, Vector<uint8_t>&& privateExponent)
     63    {
     64        return std::unique_ptr<CryptoKeyDataRSAComponents>(new CryptoKeyDataRSAComponents(WTFMove(modulus), WTFMove(exponent), WTFMove(privateExponent)));
     65    }
    5866
    5967    static std::unique_ptr<CryptoKeyDataRSAComponents> createPrivateWithAdditionalData(const Vector<uint8_t>& modulus, const Vector<uint8_t>& exponent, const Vector<uint8_t>& privateExponent, const PrimeInfo& firstPrimeInfo, const PrimeInfo& secondPrimeInfo, const Vector<PrimeInfo>& otherPrimeInfos)
    6068    {
    6169        return std::unique_ptr<CryptoKeyDataRSAComponents>(new CryptoKeyDataRSAComponents(modulus, exponent, privateExponent, firstPrimeInfo, secondPrimeInfo, otherPrimeInfos));
     70    }
     71    static std::unique_ptr<CryptoKeyDataRSAComponents> createPrivateWithAdditionalData(Vector<uint8_t>&& modulus, Vector<uint8_t>&& exponent, Vector<uint8_t>&& privateExponent, PrimeInfo&& firstPrimeInfo, PrimeInfo&& secondPrimeInfo, Vector<PrimeInfo>&& otherPrimeInfos)
     72    {
     73        return std::unique_ptr<CryptoKeyDataRSAComponents>(new CryptoKeyDataRSAComponents(WTFMove(modulus), WTFMove(exponent), WTFMove(privateExponent), WTFMove(firstPrimeInfo), WTFMove(secondPrimeInfo), WTFMove(otherPrimeInfos)));
    6274    }
    6375
     
    7991private:
    8092    CryptoKeyDataRSAComponents(const Vector<uint8_t>& modulus, const Vector<uint8_t>& exponent);
     93    CryptoKeyDataRSAComponents(Vector<uint8_t>&& modulus, Vector<uint8_t>&& exponent);
     94
    8195    CryptoKeyDataRSAComponents(const Vector<uint8_t>& modulus, const Vector<uint8_t>& exponent, const Vector<uint8_t>& privateExponent);
     96    CryptoKeyDataRSAComponents(Vector<uint8_t>&& modulus, Vector<uint8_t>&& exponent, Vector<uint8_t>&& privateExponent);
     97
    8298    CryptoKeyDataRSAComponents(const Vector<uint8_t>& modulus, const Vector<uint8_t>& exponent, const Vector<uint8_t>& privateExponent, const PrimeInfo& firstPrimeInfo, const PrimeInfo& secondPrimeInfo, const Vector<PrimeInfo>& otherPrimeInfos);
     99    CryptoKeyDataRSAComponents(Vector<uint8_t>&& modulus, Vector<uint8_t>&& exponent, Vector<uint8_t>&& privateExponent, PrimeInfo&& firstPrimeInfo, PrimeInfo&& secondPrimeInfo, Vector<PrimeInfo>&& otherPrimeInfos);
    83100
    84101    Type m_type;
  • trunk/Source/WebCore/crypto/keys/CryptoKeyHMAC.cpp

    r207809 r208548  
    2929#if ENABLE(SUBTLE_CRYPTO)
    3030
     31#include "CryptoAlgorithmHmacKeyParams.h"
    3132#include "CryptoAlgorithmRegistry.h"
    3233#include "CryptoKeyDataOctetSequence.h"
     34#include "JsonWebKey.h"
     35#include <wtf/text/Base64.h>
    3336#include <wtf/text/WTFString.h>
    3437
     
    3942    , m_hash(hash)
    4043    , m_key(key)
     44{
     45}
     46
     47CryptoKeyHMAC::CryptoKeyHMAC(Vector<uint8_t>&& key, CryptoAlgorithmIdentifier hash, bool extractable, CryptoKeyUsage usage)
     48    : CryptoKey(CryptoAlgorithmIdentifier::HMAC, CryptoKeyType::Secret, extractable, usage)
     49    , m_hash(hash)
     50    , m_key(WTFMove(key))
    4151{
    4252}
     
    6373        }
    6474    }
     75    // CommonHMAC only supports key length that is a multiple of 8. Therefore, here we are a little bit different
     76    // from the spec as of 11 December 2014: https://www.w3.org/TR/WebCryptoAPI/#hmac-operations
     77    if (lengthBits % 8)
     78        return nullptr;
    6579
    66     return adoptRef(new CryptoKeyHMAC(randomData(lengthBits), hash, extractable, usages));
     80    return adoptRef(new CryptoKeyHMAC(randomData(lengthBits / 8), hash, extractable, usages));
     81}
     82
     83RefPtr<CryptoKeyHMAC> CryptoKeyHMAC::importRaw(size_t lengthBits, CryptoAlgorithmIdentifier hash, Vector<uint8_t>&& keyData, bool extractable, CryptoKeyUsage usages)
     84{
     85    size_t length = keyData.size() * 8;
     86    if (!length)
     87        return nullptr;
     88    // CommonHMAC only supports key length that is a multiple of 8. Therefore, here we are a little bit different
     89    // from the spec as of 11 December 2014: https://www.w3.org/TR/WebCryptoAPI/#hmac-operations
     90    if (lengthBits && lengthBits != length)
     91        return nullptr;
     92
     93    return adoptRef(new CryptoKeyHMAC(WTFMove(keyData), hash, extractable, usages));
     94}
     95
     96RefPtr<CryptoKeyHMAC> CryptoKeyHMAC::importJwk(size_t lengthBits, CryptoAlgorithmIdentifier hash, JsonWebKey&& keyData, bool extractable, CryptoKeyUsage usages, CheckAlgCallback&& callback)
     97{
     98    if (keyData.kty != "oct")
     99        return nullptr;
     100    if (!keyData.k)
     101        return nullptr;
     102    Vector<uint8_t> octetSequence;
     103    if (!base64URLDecode(keyData.k.value(), octetSequence))
     104        return nullptr;
     105    if (!callback(hash, keyData.alg))
     106        return nullptr;
     107    if (usages && keyData.use && keyData.use.value() != "sig")
     108        return nullptr;
     109    if (keyData.usages && ((keyData.usages & usages) != usages))
     110        return nullptr;
     111    if (keyData.ext && !keyData.ext.value() && extractable)
     112        return nullptr;
     113
     114    return CryptoKeyHMAC::importRaw(lengthBits, hash, WTFMove(octetSequence), extractable, usages);
    67115}
    68116
     
    70118{
    71119    return std::make_unique<HmacKeyAlgorithm>(CryptoAlgorithmRegistry::singleton().nameForIdentifier(algorithmIdentifier()),
    72         CryptoAlgorithmRegistry::singleton().nameForIdentifier(m_hash), m_key.size());
     120        CryptoAlgorithmRegistry::singleton().nameForIdentifier(m_hash), m_key.size() * 8);
    73121}
    74122
  • trunk/Source/WebCore/crypto/keys/CryptoKeyHMAC.h

    r205941 r208548  
    2828
    2929#include "CryptoKey.h"
     30#include <wtf/Function.h>
    3031#include <wtf/Vector.h>
    3132
     
    3334
    3435namespace WebCore {
     36
     37struct JsonWebKey;
    3538
    3639class HmacKeyAlgorithm final : public KeyAlgorithm {
     
    6164    virtual ~CryptoKeyHMAC();
    6265
    63     // If lengthBytes is 0, a recommended length is used, which is the size of the associated hash function's block size.
    64     static RefPtr<CryptoKeyHMAC> generate(size_t lengthBytes, CryptoAlgorithmIdentifier hash, bool extractable, CryptoKeyUsage);
     66    static RefPtr<CryptoKeyHMAC> generate(size_t lengthBits, CryptoAlgorithmIdentifier hash, bool extractable, CryptoKeyUsage);
     67    static RefPtr<CryptoKeyHMAC> importRaw(size_t lengthBits, CryptoAlgorithmIdentifier hash, Vector<uint8_t>&& keyData, bool extractable, CryptoKeyUsage);
     68    using CheckAlgCallback = WTF::Function<bool(CryptoAlgorithmIdentifier, const Optional<String>&)>;
     69    static RefPtr<CryptoKeyHMAC> importJwk(size_t lengthBits, CryptoAlgorithmIdentifier hash, JsonWebKey&&, bool extractable, CryptoKeyUsage, CheckAlgCallback&&);
    6570
    6671    CryptoKeyClass keyClass() const final { return CryptoKeyClass::HMAC; }
     
    7277private:
    7378    CryptoKeyHMAC(const Vector<uint8_t>& key, CryptoAlgorithmIdentifier hash, bool extractable, CryptoKeyUsage);
     79    CryptoKeyHMAC(Vector<uint8_t>&& key, CryptoAlgorithmIdentifier hash, bool extractable, CryptoKeyUsage);
    7480
    7581    std::unique_ptr<KeyAlgorithm> buildAlgorithm() const final;
  • trunk/Source/WebCore/crypto/keys/CryptoKeyRSA.h

    r207809 r208548  
    4848class PromiseWrapper;
    4949class ScriptExecutionContext;
     50
     51struct JsonWebKey;
    5052
    5153class RsaKeyAlgorithm : public KeyAlgorithm {
     
    100102    using VoidCallback = WTF::Function<void()>;
    101103    static void generatePair(CryptoAlgorithmIdentifier, CryptoAlgorithmIdentifier hash, bool hasHash, unsigned modulusLength, const Vector<uint8_t>& publicExponent, bool extractable, CryptoKeyUsage, KeyPairCallback, VoidCallback failureCallback, ScriptExecutionContext*);
     104    static RefPtr<CryptoKeyRSA> importJwk(CryptoAlgorithmIdentifier, Optional<CryptoAlgorithmIdentifier> hash, JsonWebKey&&, bool extractable, CryptoKeyUsage);
    102105
    103106    PlatformRSAKey platformKey() const { return m_platformKey; }
  • trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmHmacKeyParams.h

    r208547 r208548  
    3333namespace WebCore {
    3434
    35 class CryptoAlgorithmHmacKeyGenParams final : public CryptoAlgorithmParameters {
     35class CryptoAlgorithmHmacKeyParams final : public CryptoAlgorithmParameters {
    3636public:
    3737    // FIXME: Consider merging hash and hashIdentifier.
     
    4040    Optional<unsigned long> length;
    4141
    42     Class parametersClass() const final { return Class::HmacKeyGenParams; }
     42    Class parametersClass() const final { return Class::HmacKeyParams; }
    4343};
    4444
    4545} // namespace WebCore
    4646
    47 SPECIALIZE_TYPE_TRAITS_CRYPTO_ALGORITHM_PARAMETERS(HmacKeyGenParams)
     47SPECIALIZE_TYPE_TRAITS_CRYPTO_ALGORITHM_PARAMETERS(HmacKeyParams)
    4848
    4949#endif // ENABLE(SUBTLE_CRYPTO)
  • trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h

    r208547 r208548  
    3333namespace WebCore {
    3434
    35 class CryptoAlgorithmHmacKeyGenParams final : public CryptoAlgorithmParameters {
     35class CryptoAlgorithmRsaHashedImportParams final : public CryptoAlgorithmParameters {
    3636public:
    3737    // FIXME: Consider merging hash and hashIdentifier.
    3838    JSC::JSValue hash;
    3939    CryptoAlgorithmIdentifier hashIdentifier;
    40     Optional<unsigned long> length;
    4140
    42     Class parametersClass() const final { return Class::HmacKeyGenParams; }
     41    Class parametersClass() const final { return Class::RsaHashedImportParams; }
    4342};
    4443
    4544} // namespace WebCore
    4645
    47 SPECIALIZE_TYPE_TRAITS_CRYPTO_ALGORITHM_PARAMETERS(HmacKeyGenParams)
     46SPECIALIZE_TYPE_TRAITS_CRYPTO_ALGORITHM_PARAMETERS(RsaHashedImportParams)
    4847
    4948#endif // ENABLE(SUBTLE_CRYPTO)
  • trunk/Source/WebCore/crypto/parameters/HmacKeyParams.idl

    r208547 r208548  
    2424 */
    2525
     26// This is a unified dictionary for HmacImportParams and HmacKeyGenParams.
     27// https://www.w3.org/TR/WebCryptoAPI/#hmac-importparams, and
     28// https://www.w3.org/TR/WebCryptoAPI/#hmac-keygen-params
    2629[
    2730    Conditional=SUBTLE_CRYPTO,
    28     ImplementedAs=CryptoAlgorithmHmacKeyGenParams
    29 ] dictionary HmacKeyGenParams : CryptoAlgorithmParameters {
     31    ImplementedAs=CryptoAlgorithmHmacKeyParams
     32] dictionary HmacKeyParams : CryptoAlgorithmParameters {
    3033    // The inner hash function to use.
    3134    required any hash;
  • trunk/Source/WebCore/crypto/parameters/RsaHashedImportParams.idl

    r208547 r208548  
    66 * are met:
    77 * 1. Redistributions of source code must retain the above copyright
    8  *    notice, this list of conditions and the following disclaimer.
     8 *     notice, this list of conditions and the following disclaimer.
    99 * 2. Redistributions in binary form must reproduce the above copyright
    1010 *    notice, this list of conditions and the following disclaimer in the
     
    2626[
    2727    Conditional=SUBTLE_CRYPTO,
    28     Exposed=(Window,Worker),
    29     GenerateIsReachable=ImplScriptExecutionContext,
    30     NoInterfaceObject,
    31 ] interface SubtleCrypto {
    32     // FIXME: Should this return a Promise<(CryptoKey or CryptoKeyPair)>?
    33     [Custom] Promise<any> generateKey(AlgorithmIdentifier algorithm, boolean extractable, sequence<KeyUsage> keyUsages);
     28    ImplementedAs=CryptoAlgorithmRsaHashedImportParams
     29] dictionary RsaHashedImportParams : CryptoAlgorithmParameters {
     30    // The hash algorithm to use
     31    required any hash;
    3432};
Note: See TracChangeset for help on using the changeset viewer.