<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[212465] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/212465">212465</a></dd>
<dt>Author</dt> <dd>jiewen_tan@apple.com</dd>
<dt>Date</dt> <dd>2017-02-16 14:31:14 -0800 (Thu, 16 Feb 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>[WebCrypto] remove toJSValueFromJsonWebKey from custom SubtleCrypto binding codes
https://bugs.webkit.org/show_bug.cgi?id=167026

Reviewed by Chris Dumez.

Source/WebCore:

Covered by existing tests.

* bindings/js/JSSubtleCryptoCustom.cpp:
(WebCore::jsSubtleCryptoFunctionExportKeyPromise):
(WebCore::jsSubtleCryptoFunctionWrapKeyPromise):
(WebCore::toJSValueFromJsonWebKey): Deleted.
* crypto/JsonWebKey.h:
* crypto/JsonWebKey.idl:
* crypto/RsaOtherPrimesInfo.idl:
Change std::optional&lt;String&gt; to String in order to use toJS&lt;IDLDictionary&lt;JsonWebKey&gt;&gt;.
* crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
(WebCore::CryptoAlgorithmAES_CBC::importKey):
* crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
(WebCore::CryptoAlgorithmAES_KW::importKey):
* crypto/algorithms/CryptoAlgorithmHMAC.cpp:
(WebCore::CryptoAlgorithmHMAC::importKey):
* crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):
* crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
* crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
(WebCore::CryptoAlgorithmRSA_OAEP::importKey):
* crypto/keys/CryptoKeyAES.cpp:
(WebCore::CryptoKeyAES::importJwk):
Only check if key_ops contains all of the specified usages when key_ops field of jwk is present,
as per the specification: https://www.w3.org/TR/WebCryptoAPI/#aes-cbc-operations
* crypto/keys/CryptoKeyAES.h:
* crypto/keys/CryptoKeyHMAC.cpp:
(WebCore::CryptoKeyHMAC::importJwk):
* crypto/keys/CryptoKeyHMAC.h:
* crypto/keys/CryptoKeyRSA.cpp:
(WebCore::CryptoKeyRSA::importJwk):
Accommodate the change from std::optional&lt;String&gt; to String.
* crypto/mac/CryptoKeyRSAMac.cpp:
(WebCore::CryptoKeyRSA::create):
Add a null check for p.

LayoutTests:

* crypto/subtle/aes-cbc-import-key-wrap-jwk-rsa-key-private.html:
* crypto/subtle/aes-cbc-import-key-wrap-jwk-rsa-key-public.html:
Order of attributes inside JWK is different after this patch.

* crypto/subtle/aes-import-key-malformed-parameters-expected.txt:
* crypto/subtle/aes-import-key-malformed-parameters.html:
* crypto/subtle/hmac-import-key-malformed-parameters-expected.txt:
* crypto/subtle/hmac-import-key-malformed-parameters.html:
* crypto/subtle/rsa-import-key-malformed-parameters-expected.txt:
* crypto/subtle/rsa-import-key-malformed-parameters.html:
* crypto/workers/subtle/resources/aes-cbc-import-key-wrap-key.js:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescbcimportkeywrapjwkrsakeyprivatehtml">trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-wrap-jwk-rsa-key-private.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescbcimportkeywrapjwkrsakeypublichtml">trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-wrap-jwk-rsa-key-public.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaesimportkeymalformedparametersexpectedtxt">trunk/LayoutTests/crypto/subtle/aes-import-key-malformed-parameters-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaesimportkeymalformedparametershtml">trunk/LayoutTests/crypto/subtle/aes-import-key-malformed-parameters.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtlehmacimportkeymalformedparametersexpectedtxt">trunk/LayoutTests/crypto/subtle/hmac-import-key-malformed-parameters-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlehmacimportkeymalformedparametershtml">trunk/LayoutTests/crypto/subtle/hmac-import-key-malformed-parameters.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersaimportkeymalformedparametersexpectedtxt">trunk/LayoutTests/crypto/subtle/rsa-import-key-malformed-parameters-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersaimportkeymalformedparametershtml">trunk/LayoutTests/crypto/subtle/rsa-import-key-malformed-parameters.html</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtleresourcesaescbcimportkeywrapkeyjs">trunk/LayoutTests/crypto/workers/subtle/resources/aes-cbc-import-key-wrap-key.js</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSSubtleCryptoCustomcpp">trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoJsonWebKeyh">trunk/Source/WebCore/crypto/JsonWebKey.h</a></li>
<li><a href="#trunkSourceWebCorecryptoJsonWebKeyidl">trunk/Source/WebCore/crypto/JsonWebKey.idl</a></li>
<li><a href="#trunkSourceWebCorecryptoRsaOtherPrimesInfoidl">trunk/Source/WebCore/crypto/RsaOtherPrimesInfo.idl</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmAES_CBCcpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmAES_KWcpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_KW.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmHMACcpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmRSAES_PKCS1_v1_5cpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmRSASSA_PKCS1_v1_5cpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmRSA_OAEPcpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptokeysCryptoKeyAEScpp">trunk/Source/WebCore/crypto/keys/CryptoKeyAES.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptokeysCryptoKeyAESh">trunk/Source/WebCore/crypto/keys/CryptoKeyAES.h</a></li>
<li><a href="#trunkSourceWebCorecryptokeysCryptoKeyHMACcpp">trunk/Source/WebCore/crypto/keys/CryptoKeyHMAC.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptokeysCryptoKeyHMACh">trunk/Source/WebCore/crypto/keys/CryptoKeyHMAC.h</a></li>
<li><a href="#trunkSourceWebCorecryptokeysCryptoKeyRSAcpp">trunk/Source/WebCore/crypto/keys/CryptoKeyRSA.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptomacCryptoKeyRSAMaccpp">trunk/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (212464 => 212465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-02-16 22:28:54 UTC (rev 212464)
+++ trunk/LayoutTests/ChangeLog        2017-02-16 22:31:14 UTC (rev 212465)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2017-02-16  Jiewen Tan  &lt;jiewen_tan@apple.com&gt;
+
+        [WebCrypto] remove toJSValueFromJsonWebKey from custom SubtleCrypto binding codes
+        https://bugs.webkit.org/show_bug.cgi?id=167026
+
+        Reviewed by Chris Dumez.
+
+        * crypto/subtle/aes-cbc-import-key-wrap-jwk-rsa-key-private.html:
+        * crypto/subtle/aes-cbc-import-key-wrap-jwk-rsa-key-public.html:
+        Order of attributes inside JWK is different after this patch.
+
+        * crypto/subtle/aes-import-key-malformed-parameters-expected.txt:
+        * crypto/subtle/aes-import-key-malformed-parameters.html:
+        * crypto/subtle/hmac-import-key-malformed-parameters-expected.txt:
+        * crypto/subtle/hmac-import-key-malformed-parameters.html:
+        * crypto/subtle/rsa-import-key-malformed-parameters-expected.txt:
+        * crypto/subtle/rsa-import-key-malformed-parameters.html:
+        * crypto/workers/subtle/resources/aes-cbc-import-key-wrap-key.js:
+
</ins><span class="cx"> 2017-02-16  Ryan Haddad  &lt;ryanhaddad@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Skip imported/w3c/web-platform-tests/resource-timing/rt-resource-errors.html.
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescbcimportkeywrapjwkrsakeyprivatehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-wrap-jwk-rsa-key-private.html (212464 => 212465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-wrap-jwk-rsa-key-private.html        2017-02-16 22:28:54 UTC (rev 212464)
+++ trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-wrap-jwk-rsa-key-private.html        2017-02-16 22:31:14 UTC (rev 212465)
</span><span class="lines">@@ -34,7 +34,7 @@
</span><span class="cx">     name: &quot;aes-cbc&quot;,
</span><span class="cx">     iv: asciiToUint8Array(&quot;jnOw99oOZFLIEPMr&quot;),
</span><span class="cx"> }
</span><del>-var expectWrappedKey = &quot;848aa2f70ee18e2953520132a79cf479b03a8732a3cc73f8c51c68456d3c2557e8be9d5911b2a74267e282a87ffeed88dfbac38a22c26ba621f83915d7539420a4dc0b2329c585b442967367c1ea6c1126f98c4f13b7c8cb7402b86a5844c19420ea333dc33d908be89172f8bac59b403fe202f32c8eed19f431cedfc3383f536f3557163b1311ae42ee5486c6dafee968640d6b6999c687f37fba8d65cc662f1c84f16245665e4af41c98e8b63632cc1d19e2bece2154c7eab1905f3f6ab17b495cefec3508e9b451f2ea1422b97f275dfdc118f46af02040250d0e55d8d8d172b969bbcf7314a257f10b98d2c47c6c72a727acaf4c96340d590ebcebc61f73b7a868b490f3c1e17c59ea479a3b8db5574153de46cfdbb07cfc5e95ebcf7ad3d5fa057ba946d6da872c4bef3af6d7013e222c227650d0022c94d306cb14e203aad378d171c7c24f824c31b81fd18265e0de2f4b415584ebc4adeb5880c4eddbc88b854699f7aa74d6a10ca5df8978f27b5d1372b31ea67a9c4841ae101ea6ad78df0580b70358e6933ac92f7faee5320af329d8349a7b98690708a388737604be0affaa0669410d8d93dc4e4f57e14583253f11e5b27c89b84f1f3038bae6d9b37e3eb64b63ad1880627aef3b19e3e851cfae639ec46dd06fd1
 31b51f530b37260b836d9013d8ad7c8640096070f96984c528ee5e20b69f3cd98a269621cd886ccb16d9c526a87cd5c458541309bb7fa4f3337305d76fc050d39ca8b1fdb0675a11a40ffde9cebb33ddc485e5dc5e7667b08c2a3e0136d063a447aee5a8f650429c5e422a706c4c240a4d11f4a9b5782f2cba2575f0c32cb477a9f0cef97fa993977104181315ff90e46f3b12b8b00f4a7611c42b1bb53d0e6021ab21ee8ae606d9f06dfedb891763007e020977c28b46d5f33bc35c12061d90ebbe02cab58783c0cac0c6f14ed735204f23d0eb6a9fe9edea2aecb1ac213f58b42d5d96374ec70ca288a31016ba02adef43250d717e9fab8982a1a180b1f3944d450c159010fd23f354d88502ec702882ae3edd567c6a6edf3cb2e34edc13f410a25d97298ab9062ddb566576fa8b6599bba205bab55aa5f3f37edaf7733cf249e69c74da975ef249ca673da749d86babebdf55410a389720ac943f1e9d921f5d69c5789636cb904fb9263744236eade9acae889a01c237ab3436101463dfa9d92f936c1b652c80f3abba76023ebe5b9bfdd54735e3a3494de18a456967f58758e546021feef3fa3e6c239981aa06f1f7ddc415d957ff9919bbec5f36af092a81ba6c14fe644d2ee98a2fcdee2ed70b87a53ffa327b25b4569c5886b15f2bd583d6f5bd7e951a915142baa08c6a9
 c343c200678a005fad22a337d2c5627f8c816db2525a7e121849b9da756eee68a240452849ffdb9651f998257c62e8fdcdc48dadfc3ebb18f7eb5461442008846a629ec8149c052f357bf5889095047b272bce0ff505953e7cd525b24c838ba6e9ed91922a30eeb858de8556f19f761d0287d768876346a5dcac3dbadd7a30072c9338162be5812166d961f4031f962ef668781d39d0fc69fe5f4494e31ec082d4a0140e368b69975beeba120ef9b651ead531b4d44296bd3cfe2ce7f97bb5bb4921061b12c2e1c4c10928c0980ff8d488a2282d0c056a40260167410e39664f75ff1f1249820e174eed978318a05e654b8aa6c60b70001a7a04f0aff17597dd9ab3ccc34f5ba2e352b7244dd3dccb462d7175b95ae3970ec5858e2312aac7c2c79a37b53d089f988720a4c04df6328a384004d0d51eafb9486623099a98e69be5169201c88824acc2bb0e1790889014a1797c168e98d19f0787c2935cfbc3bf24c4adad69a81e0e6adf8c21e3c4789064aa31a025dff5cc6eaba3f3e43f10a9d531f47963372120e2366b84c281ed968d9d11c1d103826c9362741e1267d1a3e8d2188761fa876b7b09617df14130c07209f1f1188ff40971b86607dee14d556a880447901c69d29cb16c027c3aae316ff00132bdfcd0e39c5e201252c9771483ccb275b0c67b3cb4dcd19198c77
 18634460254dfd6f8df4374b8bedee7dd20ce411b5f987cac2ce17492aa78f919c6d5e555000f47f7b8a9896d448bc4fc13e40a9e5c02258d509a7289f44d7250e89260233bf96702bb3d350451f03d802e0e37d9f01cce4c78869403493eb9890c2c09109d1f427f59cf091cd1c836e25a9bb065041407c2183f643bce2e72db1e7caeac42e2d8379f8b84df2cc7b1d055f42d6f62e0cb5771a14ae8872792350e5f770115a86564f60a785c53325c8c084afe214da3cac1783e2be9099d96ddbe9cc3ea3dd1d3ae50526b4afe24397420a3e4fa697613421&quot;;
</del><ins>+var expectWrappedKey = &quot;995a93379575a0c677a7d48dbe7d496f64a53769eafae1e6a1d0f6a57d2c7f69748cdaeeff1fe7e13eb9c6d4597458ed22d369d5c6043b6ab30c79f1e7082cb3a57e19e53e607a0b26090317f45b24266c662923bb3b8c0fd7447860c52b3052da1bddda729a8bc19c447e4acd2b7da6b13fad0c4e022f7d76cb804c8aaebaed4566e2e14b02e81689f47314bf49c599c9b3700f2e23df498816bbe3ffe139cc0ed0500e762b4f3341b159950abd362ada4158e21b8ba0ed0f01a441d6a730e6a5717fd939b2e8b418d86f632ed2f3c7fea57d1ad67914afc41e4153c5b799f91c49f4db257d06477c748f7405c1394fbc8523c0a6fd31bf8368573defb47353d55c3bd5a7adfa5d9a54412823a5cfed93e632af8bdb929f0113d5ff021c0cf40d98e0f8dbaadf2c8c3878196a616e607fb5f7db4420a587cac87771c2ee6028d7f5036e1ffcb88b7f4c72a155890e8bb99c74a02aa80d4ed22ad27d4a60e9d532ab4c461a776a16e6b88ae8365b3987eab6fd2d02f9de9febc28d6f4a5467a3ef8e92c36d4e971d8c0801526393260f11eed75b6fb70ed3822c60bf7dcc6c8d4ef21ce74449365019033dfb9b8f9793198d68d406ca5dce366fb7b515c85c4ff47f6b5b3692397632d22eb6026f05a9e39f2be3be75d8aa1876a
 a4bac108d3ce67914c95cba31c5c072d9ddcbbbb90e34bc16c60ce812bfbb34cb76e4e7f68c0e5d6eb7647853731cab8ef4b8e3a557c84ca2b6aae9eec06bef30edf1280ef534c8698baa265d08b75ca3a29a4fbed50afdaa48e8cfebff211e9d64e63c0e3ba077f9a9c6f77a5b865a25850334d42df4f55cb7d0e1fb59590fea96d757eac310be056427b55b10342a3dd522a712d86e589183fa278dbc3c6654c12d777e9fa2a030aba5747aa345a46e7754bda59f530e5e8dfdedfc343bb789fdfc138210d5ab587f581c006760ba3d6b5875e2a34ae16f9cbded2882f5e6ffd9904518b789123ca6d19eeda979dab4ba8437b8d660354a28dac7e917cdf061cd7748d624e0af4ab9c2a5c18389e71accc495945dc83e7ea7c7724434ab375551c6fd2b0070229ec791aa680be539799aa168cf5a955721d249e676ee434141f93d1977fd8d635e387496cac6c3509a71df4fac016ca7885ae7fa7fe601c6ed62a83d0313b7d07476501e5e8b3821a1fedfa91e842cffa3cc255db1a50091aa6b391d1014cc1e59c3f36425102a03acabf06525f44c87422a889ed78c1e78a2a4d9ab244a30155005e954111d4c3384f63153adc276861021a76289f266fb7d6eda300d39102bee7d7047e32b0ced7a90e0b27f201ad8960ecb83a8003ef1e3de97b2ddf00f5b8344f1f103c6b0
 c5a90804201f9ac26c544e7f3cca7d4d10a7388b2460a83dfbc9c7544b9e7ce2488907f2da06b48ec209c8e9a4688261c1a1b63c940b07c2053b60b06b20421810ffbef6a4d482d7ba7d80cb6ea04222797e4ee40564612bfb15b57b34afcab259efb03e2f7a7a1622b06df5825d6cf2fd0bf63749e2c6e89b358cfe0167f0577c571953dba4b4bb3591c922b2605ccc4ccb5a3ba1a38a8983d885d867713be90d2e796fd7cb8d465925927feaeae45ef931dc7806a6ecc94810a7a39a87c6158e85866a8c2bdd3b88522c23fc4a969f60994e3cfb1be584c3f418b1e19009ac53b38d9d015af213acd5f0e9d65ee78d59c10e94973eb08b79403483591662cc9b45ac13360e262c77bb3f71f32f0f3fa35ce75daf7ca39c4c81abbabc478d6c51ffdadee0787bc98617e3ef85d87a2447103e43f910019ee95d829a4dda87339fb1437aabf4bdc884ac470853622835e825229299b838ed75024ed28050ac858aa5ba9df18ff072e878c7f1fb2da444a8eb92de07e77fd1cf7c19e589646cdbce436de837b44b78420ee9ed1bc74b5b49d98758b1b80bf17f1a2836a2a9958990a6205bd20e969c91ed56b196b0dd64fc3545e5d9278a75f0368bd4ec1a88f396e374d19a3e622f65709a522b2b1ffc70aac843f879e4507cc675a513eb868e1116fa2c8e0215afa1ddaaa99d269
 8879944180a4da38873c512998a7a0c51b44c8655302b703a9251a9f3acd9465d9f3eab1b7555317fdd97ccf0305a56e32a34daa62a8a4d16f280db7fd54bff1ed916d04c3e346b5de79b833d9ba42789be91a42fdad20c239eaa51f411fde79f0d6274a055fa98fabbc583714ed4baa168660493a55a7fdf5b66dc4d6afb05224da3b3f81ca8274b1be0d31da40b80ee9f0a56448bcbc6f8142aea8ab0169764dac201c7c8733e3f9b7212be22a39c12e30cde9ed5fe3042db4a51a1b85e0d23fc7b237224473be41ef6a8db014cda53969b1acdd0b732a5&quot;;
</ins><span class="cx"> 
</span><span class="cx"> crypto.subtle.importKey(&quot;raw&quot;, rawKey, &quot;aes-cbc&quot;, extractable, [&quot;wrapKey&quot;]).then(function(result) {
</span><span class="cx">     wrappingKey = result;
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescbcimportkeywrapjwkrsakeypublichtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-wrap-jwk-rsa-key-public.html (212464 => 212465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-wrap-jwk-rsa-key-public.html        2017-02-16 22:28:54 UTC (rev 212464)
+++ trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-wrap-jwk-rsa-key-public.html        2017-02-16 22:31:14 UTC (rev 212465)
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx">     name: &quot;aes-cbc&quot;,
</span><span class="cx">     iv: asciiToUint8Array(&quot;jnOw99oOZFLIEPMr&quot;),
</span><span class="cx"> }
</span><del>-var expectWrappedKey = &quot;848aa2f70ee18e2953520132a79cf47946e00c99362340bb690edc9ab5315757462c128278c6232e770e7437c56ed722a8e1703855f7f3e565394e1a6a0305c4ef1b30fa4c7f72d1a239cc6c6ba067898798a36a75132c66b4a2d3fb942886affd3ea3b2756b0ddc886c01e3b93107469b82124468408ef8ab548b85aa8f206c312d74ce4f2c679eb147a275cefda64d5bdc4a2b5b90a4ac9ad3eb5f2cf19f5f87653211f59b4731ba61125582a233951097dea65db05899d587d1dcfccab9ab7410ab3010b89066506dbacbc6b73e4b564792751388fa0f58d55c59c14a08c9dfb0f78100b0f5cc29d62328822636d30a6a153ec5cd4727ad5e47b419c48544565637ac5789863d43b7da78cf4383d09d66e9d458e436dbfbee75e382b2bab49eec2c7491ff93cf099fe92feaf4658e30889fd12d3ae61cd5e8c8e1e56a079b662f90cd10cdbdbb4d12eefb36d825e1a043e82f5a98f8960d655d3f9ed5af31e581fa846cc582f6cee5c25e0b3c32050534ae957ce27860d470ba26da2c7d6fa621b0faa8becad58e9e55bb2a9d984b042f25df21482529870d271cbf5508a0edfc3cb37316c11f16b342bc1f1f98aa&quot;;
</del><ins>+var expectWrappedKey = &quot;995a93379575a0c677a7d48dbe7d496fe4d8c9be49cdaf48e88398a769c2825d94396edb75683ed54e3ca0ac1f352f6b92486ef68186ef37d2b6be27ddd4bdaafbea98ec8c0dfc62353714f11219d4c69271a06507909f6dc50fd136f06265e5bfe9b2de09a704db4b4acd1d2834eefaab814484b70d77984455a1bad47e94cedc467939ea7495387087aff0eec9dfa4bf6c5baa6df37328a7068128930adc129a1874c323f315e993a27c667f1e02ffab5cc235bb7d270696875f43bb198f453cdef134ffe171c855c4641678527819dce552e4cd97fb30404075869aba085634327774cd7b71e7d0ea306f2d92d64658778897489fff205645e1a1b57832349ef1e6abef7c6780aa085b7d55c55693d69cf439497925dc8239791130d4387387188f2dea13d2825b2690456df80f6f1694351c8f33eb37bc44f2ad3f8f6d0a0e98c1510c6a5f64209288516aec0b30f85ed0b129a5ffc4840a9b5f0374c37304ad4f3d81572417813172929dd08f8a853ab57d3bc5d72eeeca932d8a05d3eb74d2ceba39b87cd7113abb30de3d05448162b50b17de8603fa4b5e7f8ab267cc6b8fdc830d76a35eb4078597b6301176&quot;;
</ins><span class="cx"> 
</span><span class="cx"> crypto.subtle.importKey(&quot;raw&quot;, rawKey, &quot;aes-cbc&quot;, extractable, [&quot;wrapKey&quot;]).then(function(result) {
</span><span class="cx">     wrappingKey = result;
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaesimportkeymalformedparametersexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/crypto/subtle/aes-import-key-malformed-parameters-expected.txt (212464 => 212465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-import-key-malformed-parameters-expected.txt        2017-02-16 22:28:54 UTC (rev 212464)
+++ trunk/LayoutTests/crypto/subtle/aes-import-key-malformed-parameters-expected.txt        2017-02-16 22:31:14 UTC (rev 212465)
</span><span class="lines">@@ -9,13 +9,23 @@
</span><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k128, alg: &quot;A192CBC&quot;}, &quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;, &quot;wrapKey&quot;, &quot;unwrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k192, alg: &quot;A256CBC&quot;}, &quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;, &quot;wrapKey&quot;, &quot;unwrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k256, alg: &quot;A128CBC&quot;}, &quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;, &quot;wrapKey&quot;, &quot;unwrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><ins>+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: &quot;A72F&quot;, alg: &quot;foo&quot;}, &quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;, &quot;wrapKey&quot;, &quot;unwrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k128, alg: &quot;&quot;}, &quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;, &quot;wrapKey&quot;, &quot;unwrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k192, alg: &quot;&quot;}, &quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;, &quot;wrapKey&quot;, &quot;unwrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k256, alg: &quot;&quot;}, &quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;, &quot;wrapKey&quot;, &quot;unwrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</ins><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k128, alg: &quot;A192KW&quot;}, &quot;aes-kw&quot;, extractable, [&quot;wrapKey&quot;, &quot;unwrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k192, alg: &quot;A256KW&quot;}, &quot;aes-kw&quot;, extractable, [&quot;wrapKey&quot;, &quot;unwrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k256, alg: &quot;A128KW&quot;}, &quot;aes-kw&quot;, extractable, [&quot;wrapKey&quot;, &quot;unwrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><del>-PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: &quot;A72F&quot;, alg: &quot;foo&quot;}, &quot;aes-cbc&quot;, extractable, [&quot;wrapKey&quot;, &quot;unwrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</del><ins>+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: &quot;A72F&quot;, alg: &quot;foo&quot;}, &quot;aes-kw&quot;, extractable, [&quot;wrapKey&quot;, &quot;unwrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k128, alg: &quot;&quot;}, &quot;aes-kw&quot;, extractable, [&quot;wrapKey&quot;, &quot;unwrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k192, alg: &quot;&quot;}, &quot;aes-kw&quot;, extractable, [&quot;wrapKey&quot;, &quot;unwrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k256, alg: &quot;&quot;}, &quot;aes-kw&quot;, extractable, [&quot;wrapKey&quot;, &quot;unwrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</ins><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: &quot;!!!&quot;, alg: &quot;foo&quot;}, &quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;, &quot;wrapKey&quot;, &quot;unwrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><ins>+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: &quot;&quot;, alg: &quot;foo&quot;}, &quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;, &quot;wrapKey&quot;, &quot;unwrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</ins><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k128, alg: &quot;A128CBC&quot;, use: &quot;sig&quot;}, &quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;, &quot;wrapKey&quot;, &quot;unwrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><ins>+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k128, alg: &quot;A128CBC&quot;, use: &quot;&quot;}, &quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;, &quot;wrapKey&quot;, &quot;unwrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</ins><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k128, alg: &quot;A128CBC&quot;, key_ops: [&quot;encrypt&quot;, &quot;decrypt&quot;]}, &quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;, &quot;wrapKey&quot;, &quot;unwrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><ins>+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k128, alg: &quot;A128CBC&quot;, key_ops: [ ]}, &quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;, &quot;wrapKey&quot;, &quot;unwrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</ins><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k128, alg: &quot;A128CBC&quot;, ext: false}, &quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;, &quot;wrapKey&quot;, &quot;unwrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaesimportkeymalformedparametershtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/crypto/subtle/aes-import-key-malformed-parameters.html (212464 => 212465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-import-key-malformed-parameters.html        2017-02-16 22:28:54 UTC (rev 212464)
+++ trunk/LayoutTests/crypto/subtle/aes-import-key-malformed-parameters.html        2017-02-16 22:31:14 UTC (rev 212465)
</span><span class="lines">@@ -26,16 +26,26 @@
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k128, alg: &quot;A192CBC&quot;}, &quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;, &quot;wrapKey&quot;, &quot;unwrapKey&quot;])');
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k192, alg: &quot;A256CBC&quot;}, &quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;, &quot;wrapKey&quot;, &quot;unwrapKey&quot;])');
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k256, alg: &quot;A128CBC&quot;}, &quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;, &quot;wrapKey&quot;, &quot;unwrapKey&quot;])');
</span><ins>+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: &quot;A72F&quot;, alg: &quot;foo&quot;}, &quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;, &quot;wrapKey&quot;, &quot;unwrapKey&quot;])');
+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k128, alg: &quot;&quot;}, &quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;, &quot;wrapKey&quot;, &quot;unwrapKey&quot;])');
+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k192, alg: &quot;&quot;}, &quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;, &quot;wrapKey&quot;, &quot;unwrapKey&quot;])');
+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k256, alg: &quot;&quot;}, &quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;, &quot;wrapKey&quot;, &quot;unwrapKey&quot;])');
</ins><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k128, alg: &quot;A192KW&quot;}, &quot;aes-kw&quot;, extractable, [&quot;wrapKey&quot;, &quot;unwrapKey&quot;])');
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k192, alg: &quot;A256KW&quot;}, &quot;aes-kw&quot;, extractable, [&quot;wrapKey&quot;, &quot;unwrapKey&quot;])');
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k256, alg: &quot;A128KW&quot;}, &quot;aes-kw&quot;, extractable, [&quot;wrapKey&quot;, &quot;unwrapKey&quot;])');
</span><del>-shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: &quot;A72F&quot;, alg: &quot;foo&quot;}, &quot;aes-cbc&quot;, extractable, [&quot;wrapKey&quot;, &quot;unwrapKey&quot;])');
</del><ins>+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: &quot;A72F&quot;, alg: &quot;foo&quot;}, &quot;aes-kw&quot;, extractable, [&quot;wrapKey&quot;, &quot;unwrapKey&quot;])');
+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k128, alg: &quot;&quot;}, &quot;aes-kw&quot;, extractable, [&quot;wrapKey&quot;, &quot;unwrapKey&quot;])');
+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k192, alg: &quot;&quot;}, &quot;aes-kw&quot;, extractable, [&quot;wrapKey&quot;, &quot;unwrapKey&quot;])');
+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k256, alg: &quot;&quot;}, &quot;aes-kw&quot;, extractable, [&quot;wrapKey&quot;, &quot;unwrapKey&quot;])');
</ins><span class="cx"> // Jwk: wrong k format
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: &quot;!!!&quot;, alg: &quot;foo&quot;}, &quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;, &quot;wrapKey&quot;, &quot;unwrapKey&quot;])');
</span><ins>+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: &quot;&quot;, alg: &quot;foo&quot;}, &quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;, &quot;wrapKey&quot;, &quot;unwrapKey&quot;])');
</ins><span class="cx"> // Jwk: wrong use
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k128, alg: &quot;A128CBC&quot;, use: &quot;sig&quot;}, &quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;, &quot;wrapKey&quot;, &quot;unwrapKey&quot;])');
</span><ins>+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k128, alg: &quot;A128CBC&quot;, use: &quot;&quot;}, &quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;, &quot;wrapKey&quot;, &quot;unwrapKey&quot;])');
</ins><span class="cx"> // Jwk: wrong key_ops
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k128, alg: &quot;A128CBC&quot;, key_ops: [&quot;encrypt&quot;, &quot;decrypt&quot;]}, &quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;, &quot;wrapKey&quot;, &quot;unwrapKey&quot;])');
</span><ins>+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k128, alg: &quot;A128CBC&quot;, key_ops: [ ]}, &quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;, &quot;wrapKey&quot;, &quot;unwrapKey&quot;])');
</ins><span class="cx"> // Jwk: wrong ext
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k128, alg: &quot;A128CBC&quot;, ext: false}, &quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;, &quot;wrapKey&quot;, &quot;unwrapKey&quot;])');
</span><span class="cx"> &lt;/script&gt;
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtlehmacimportkeymalformedparametersexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/crypto/subtle/hmac-import-key-malformed-parameters-expected.txt (212464 => 212465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/hmac-import-key-malformed-parameters-expected.txt        2017-02-16 22:28:54 UTC (rev 212464)
+++ trunk/LayoutTests/crypto/subtle/hmac-import-key-malformed-parameters-expected.txt        2017-02-16 22:31:14 UTC (rev 212465)
</span><span class="lines">@@ -13,8 +13,15 @@
</span><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k, alg: &quot;HS384&quot;}, {name: &quot;hmac&quot;, hash: &quot;sha-256&quot;}, extractable, [&quot;sign&quot;, &quot;verify&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k, alg: &quot;HS512&quot;}, {name: &quot;hmac&quot;, hash: &quot;sha-384&quot;}, extractable, [&quot;sign&quot;, &quot;verify&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k, alg: &quot;HS1&quot;}, {name: &quot;hmac&quot;, hash: &quot;sha-512&quot;}, extractable, [&quot;sign&quot;, &quot;verify&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><ins>+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k, alg: &quot;&quot;}, {name: &quot;hmac&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;sign&quot;, &quot;verify&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k, alg: &quot;&quot;}, {name: &quot;hmac&quot;, hash: &quot;sha-224&quot;}, extractable, [&quot;sign&quot;, &quot;verify&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k, alg: &quot;&quot;}, {name: &quot;hmac&quot;, hash: &quot;sha-256&quot;}, extractable, [&quot;sign&quot;, &quot;verify&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k, alg: &quot;&quot;}, {name: &quot;hmac&quot;, hash: &quot;sha-384&quot;}, extractable, [&quot;sign&quot;, &quot;verify&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k, alg: &quot;&quot;}, {name: &quot;hmac&quot;, hash: &quot;sha-512&quot;}, extractable, [&quot;sign&quot;, &quot;verify&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</ins><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: &quot;!!!&quot;, alg: &quot;foo&quot;}, {name: &quot;hmac&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;sign&quot;, &quot;verify&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><ins>+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: &quot;&quot;, alg: &quot;foo&quot;}, {name: &quot;hmac&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;sign&quot;, &quot;verify&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</ins><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k, alg: &quot;HS1&quot;, use: &quot;enc&quot;}, {name: &quot;hmac&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;sign&quot;, &quot;verify&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><ins>+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k, alg: &quot;HS1&quot;, use: &quot;&quot;}, {name: &quot;hmac&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;sign&quot;, &quot;verify&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</ins><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k, alg: &quot;HS1&quot;, key_ops: [&quot;sign&quot;]}, {name: &quot;hmac&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;sign&quot;, &quot;verify&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k, alg: &quot;HS1&quot;, ext: false}, {name: &quot;hmac&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;sign&quot;, &quot;verify&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><span class="cx"> PASS successfullyParsed is true
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtlehmacimportkeymalformedparametershtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/crypto/subtle/hmac-import-key-malformed-parameters.html (212464 => 212465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/hmac-import-key-malformed-parameters.html        2017-02-16 22:28:54 UTC (rev 212464)
+++ trunk/LayoutTests/crypto/subtle/hmac-import-key-malformed-parameters.html        2017-02-16 22:31:14 UTC (rev 212465)
</span><span class="lines">@@ -30,10 +30,17 @@
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k, alg: &quot;HS384&quot;}, {name: &quot;hmac&quot;, hash: &quot;sha-256&quot;}, extractable, [&quot;sign&quot;, &quot;verify&quot;])');
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k, alg: &quot;HS512&quot;}, {name: &quot;hmac&quot;, hash: &quot;sha-384&quot;}, extractable, [&quot;sign&quot;, &quot;verify&quot;])');
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k, alg: &quot;HS1&quot;}, {name: &quot;hmac&quot;, hash: &quot;sha-512&quot;}, extractable, [&quot;sign&quot;, &quot;verify&quot;])');
</span><ins>+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k, alg: &quot;&quot;}, {name: &quot;hmac&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;sign&quot;, &quot;verify&quot;])');
+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k, alg: &quot;&quot;}, {name: &quot;hmac&quot;, hash: &quot;sha-224&quot;}, extractable, [&quot;sign&quot;, &quot;verify&quot;])');
+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k, alg: &quot;&quot;}, {name: &quot;hmac&quot;, hash: &quot;sha-256&quot;}, extractable, [&quot;sign&quot;, &quot;verify&quot;])');
+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k, alg: &quot;&quot;}, {name: &quot;hmac&quot;, hash: &quot;sha-384&quot;}, extractable, [&quot;sign&quot;, &quot;verify&quot;])');
+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k, alg: &quot;&quot;}, {name: &quot;hmac&quot;, hash: &quot;sha-512&quot;}, extractable, [&quot;sign&quot;, &quot;verify&quot;])');
</ins><span class="cx"> // Jwk: wrong k format
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: &quot;!!!&quot;, alg: &quot;foo&quot;}, {name: &quot;hmac&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;sign&quot;, &quot;verify&quot;])');
</span><ins>+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: &quot;&quot;, alg: &quot;foo&quot;}, {name: &quot;hmac&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;sign&quot;, &quot;verify&quot;])');
</ins><span class="cx"> // Jwk: wrong use
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k, alg: &quot;HS1&quot;, use: &quot;enc&quot;}, {name: &quot;hmac&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;sign&quot;, &quot;verify&quot;])');
</span><ins>+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k, alg: &quot;HS1&quot;, use: &quot;&quot;}, {name: &quot;hmac&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;sign&quot;, &quot;verify&quot;])');
</ins><span class="cx"> // Jwk: wrong key_ops
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, k: k, alg: &quot;HS1&quot;, key_ops: [&quot;sign&quot;]}, {name: &quot;hmac&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;sign&quot;, &quot;verify&quot;])');
</span><span class="cx"> // Jwk: wrong ext
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersaimportkeymalformedparametersexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/crypto/subtle/rsa-import-key-malformed-parameters-expected.txt (212464 => 212465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsa-import-key-malformed-parameters-expected.txt        2017-02-16 22:28:54 UTC (rev 212464)
+++ trunk/LayoutTests/crypto/subtle/rsa-import-key-malformed-parameters-expected.txt        2017-02-16 22:31:14 UTC (rev 212465)
</span><span class="lines">@@ -5,24 +5,41 @@
</span><span class="cx"> 
</span><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e}, &quot;RSAES-PKCS1-v1_5&quot;, extractable, [&quot;decrypt&quot;]) rejected promise  with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
</span><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, d: d}, &quot;RSAES-PKCS1-v1_5&quot;, extractable, [&quot;encrypt&quot;]) rejected promise  with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
</span><ins>+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, d: &quot;&quot;}, &quot;RSAES-PKCS1-v1_5&quot;, extractable, [&quot;encrypt&quot;]) rejected promise  with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
</ins><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e}, {name: &quot;RSASSA-PKCS1-v1_5&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;sign&quot;]) rejected promise  with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
</span><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, d: d}, {name: &quot;RSASSA-PKCS1-v1_5&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;verify&quot;]) rejected promise  with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
</span><ins>+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, d: &quot;&quot;}, {name: &quot;RSASSA-PKCS1-v1_5&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;verify&quot;]) rejected promise  with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
</ins><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e}, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;decrypt&quot;, &quot;unwrapKey&quot;]) rejected promise  with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
</span><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, d: d}, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;encrypt&quot;, &quot;wrapKey&quot;]) rejected promise  with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
</span><ins>+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, d: &quot;&quot;}, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;encrypt&quot;, &quot;wrapKey&quot;]) rejected promise  with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
</ins><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, use: &quot;sig&quot;}, &quot;RSAES-PKCS1-v1_5&quot;, extractable, [&quot;encrypt&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><ins>+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, use: &quot;&quot;}, &quot;RSAES-PKCS1-v1_5&quot;, extractable, [&quot;encrypt&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</ins><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, use: &quot;enc&quot;}, {name: &quot;RSASSA-PKCS1-v1_5&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;verify&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><ins>+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, use: &quot;&quot;}, {name: &quot;RSASSA-PKCS1-v1_5&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;verify&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</ins><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, use: &quot;sig&quot;}, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;encrypt&quot;, &quot;wrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><ins>+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, use: &quot;&quot;}, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;encrypt&quot;, &quot;wrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</ins><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;foo&quot;}, &quot;RSAES-PKCS1-v1_5&quot;, extractable, [&quot;encrypt&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><ins>+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;&quot;}, &quot;RSAES-PKCS1-v1_5&quot;, extractable, [&quot;encrypt&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</ins><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;RS224&quot;}, {name: &quot;RSASSA-PKCS1-v1_5&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;verify&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;RS256&quot;}, {name: &quot;RSASSA-PKCS1-v1_5&quot;, hash: &quot;sha-224&quot;}, extractable, [&quot;verify&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;RS384&quot;}, {name: &quot;RSASSA-PKCS1-v1_5&quot;, hash: &quot;sha-256&quot;}, extractable, [&quot;verify&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;RS512&quot;}, {name: &quot;RSASSA-PKCS1-v1_5&quot;, hash: &quot;sha-384&quot;}, extractable, [&quot;verify&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;RS1&quot;}, {name: &quot;RSASSA-PKCS1-v1_5&quot;, hash: &quot;sha-512&quot;}, extractable, [&quot;verify&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><ins>+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;&quot;}, {name: &quot;RSASSA-PKCS1-v1_5&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;verify&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;&quot;}, {name: &quot;RSASSA-PKCS1-v1_5&quot;, hash: &quot;sha-224&quot;}, extractable, [&quot;verify&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;&quot;}, {name: &quot;RSASSA-PKCS1-v1_5&quot;, hash: &quot;sha-256&quot;}, extractable, [&quot;verify&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;&quot;}, {name: &quot;RSASSA-PKCS1-v1_5&quot;, hash: &quot;sha-384&quot;}, extractable, [&quot;verify&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;&quot;}, {name: &quot;RSASSA-PKCS1-v1_5&quot;, hash: &quot;sha-512&quot;}, extractable, [&quot;verify&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</ins><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;RSA-OAEP-224&quot;}, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;encrypt&quot;, &quot;wrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;RSA-OAEP-256&quot;}, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-224&quot;}, extractable, [&quot;encrypt&quot;, &quot;wrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;RSA-OAEP-384&quot;}, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-256&quot;}, extractable, [&quot;encrypt&quot;, &quot;wrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;RSA-OAEP-512&quot;}, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-384&quot;}, extractable, [&quot;encrypt&quot;, &quot;wrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;RSA-OAEP&quot;}, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-512&quot;}, extractable, [&quot;encrypt&quot;, &quot;wrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><ins>+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;&quot;}, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;encrypt&quot;, &quot;wrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;&quot;}, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-224&quot;}, extractable, [&quot;encrypt&quot;, &quot;wrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;&quot;}, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-256&quot;}, extractable, [&quot;encrypt&quot;, &quot;wrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;&quot;}, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-384&quot;}, extractable, [&quot;encrypt&quot;, &quot;wrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;&quot;}, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-512&quot;}, extractable, [&quot;encrypt&quot;, &quot;wrapKey&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</ins><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, n: n, e: e}, &quot;RSAES-PKCS1-v1_5&quot;, extractable, [&quot;encrypt&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, key_ops: [&quot;sign&quot;, &quot;verify&quot;]}, &quot;RSAES-PKCS1-v1_5&quot;, extractable, [&quot;encrypt&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, ext: false}, &quot;RSAES-PKCS1-v1_5&quot;, extractable, [&quot;encrypt&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><span class="lines">@@ -36,6 +53,8 @@
</span><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, d: d, p: p, q: q, dq: dq, qi: qi}, &quot;RSAES-PKCS1-v1_5&quot;, extractable, [&quot;decrypt&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, d: d, p: p, q: q, dp: dp, qi: qi}, &quot;RSAES-PKCS1-v1_5&quot;, extractable, [&quot;decrypt&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><span class="cx"> PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, d: d, p: p, q: q, dp: dp, dq: dq}, &quot;RSAES-PKCS1-v1_5&quot;, extractable, [&quot;decrypt&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><ins>+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: &quot;&quot;, e: e, d: d, p: p, q: q, dp: dp, dq: dq, qi: qi}, &quot;RSAES-PKCS1-v1_5&quot;, extractable, [&quot;decrypt&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
+PASS crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, d: d, p: &quot;&quot;, q: q, dp: dp, dq: dq, qi: qi}, &quot;RSAES-PKCS1-v1_5&quot;, extractable, [&quot;decrypt&quot;]) rejected promise  with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</ins><span class="cx"> PASS crypto.subtle.importKey(&quot;spki&quot;, spkiKey, &quot;RSAES-PKCS1-v1_5&quot;, extractable, [&quot;decrypt&quot;]) rejected promise  with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
</span><span class="cx"> PASS crypto.subtle.importKey(&quot;spki&quot;, spkiKey, {name: &quot;RSASSA-PKCS1-v1_5&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;sign&quot;]) rejected promise  with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
</span><span class="cx"> PASS crypto.subtle.importKey(&quot;spki&quot;, spkiKey, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;decrypt&quot;, &quot;unwrapKey&quot;]) rejected promise  with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersaimportkeymalformedparametershtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/crypto/subtle/rsa-import-key-malformed-parameters.html (212464 => 212465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsa-import-key-malformed-parameters.html        2017-02-16 22:28:54 UTC (rev 212464)
+++ trunk/LayoutTests/crypto/subtle/rsa-import-key-malformed-parameters.html        2017-02-16 22:31:14 UTC (rev 212465)
</span><span class="lines">@@ -35,26 +35,43 @@
</span><span class="cx"> // Jwk: Wrong usages
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e}, &quot;RSAES-PKCS1-v1_5&quot;, extractable, [&quot;decrypt&quot;])');
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, d: d}, &quot;RSAES-PKCS1-v1_5&quot;, extractable, [&quot;encrypt&quot;])');
</span><ins>+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, d: &quot;&quot;}, &quot;RSAES-PKCS1-v1_5&quot;, extractable, [&quot;encrypt&quot;])');
</ins><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e}, {name: &quot;RSASSA-PKCS1-v1_5&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;sign&quot;])');
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, d: d}, {name: &quot;RSASSA-PKCS1-v1_5&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;verify&quot;])');
</span><ins>+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, d: &quot;&quot;}, {name: &quot;RSASSA-PKCS1-v1_5&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;verify&quot;])');
</ins><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e}, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;decrypt&quot;, &quot;unwrapKey&quot;])');
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, d: d}, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;encrypt&quot;, &quot;wrapKey&quot;])');
</span><ins>+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, d: &quot;&quot;}, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;encrypt&quot;, &quot;wrapKey&quot;])');
</ins><span class="cx"> // Jwk: Wrong use
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, use: &quot;sig&quot;}, &quot;RSAES-PKCS1-v1_5&quot;, extractable, [&quot;encrypt&quot;])');
</span><ins>+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, use: &quot;&quot;}, &quot;RSAES-PKCS1-v1_5&quot;, extractable, [&quot;encrypt&quot;])');
</ins><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, use: &quot;enc&quot;}, {name: &quot;RSASSA-PKCS1-v1_5&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;verify&quot;])');
</span><ins>+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, use: &quot;&quot;}, {name: &quot;RSASSA-PKCS1-v1_5&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;verify&quot;])');
</ins><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, use: &quot;sig&quot;}, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;encrypt&quot;, &quot;wrapKey&quot;])');
</span><ins>+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, use: &quot;&quot;}, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;encrypt&quot;, &quot;wrapKey&quot;])');
</ins><span class="cx"> // Jwk: Wrong alg
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;foo&quot;}, &quot;RSAES-PKCS1-v1_5&quot;, extractable, [&quot;encrypt&quot;])');
</span><ins>+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;&quot;}, &quot;RSAES-PKCS1-v1_5&quot;, extractable, [&quot;encrypt&quot;])');
</ins><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;RS224&quot;}, {name: &quot;RSASSA-PKCS1-v1_5&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;verify&quot;])');
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;RS256&quot;}, {name: &quot;RSASSA-PKCS1-v1_5&quot;, hash: &quot;sha-224&quot;}, extractable, [&quot;verify&quot;])');
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;RS384&quot;}, {name: &quot;RSASSA-PKCS1-v1_5&quot;, hash: &quot;sha-256&quot;}, extractable, [&quot;verify&quot;])');
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;RS512&quot;}, {name: &quot;RSASSA-PKCS1-v1_5&quot;, hash: &quot;sha-384&quot;}, extractable, [&quot;verify&quot;])');
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;RS1&quot;}, {name: &quot;RSASSA-PKCS1-v1_5&quot;, hash: &quot;sha-512&quot;}, extractable, [&quot;verify&quot;])');
</span><ins>+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;&quot;}, {name: &quot;RSASSA-PKCS1-v1_5&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;verify&quot;])');
+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;&quot;}, {name: &quot;RSASSA-PKCS1-v1_5&quot;, hash: &quot;sha-224&quot;}, extractable, [&quot;verify&quot;])');
+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;&quot;}, {name: &quot;RSASSA-PKCS1-v1_5&quot;, hash: &quot;sha-256&quot;}, extractable, [&quot;verify&quot;])');
+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;&quot;}, {name: &quot;RSASSA-PKCS1-v1_5&quot;, hash: &quot;sha-384&quot;}, extractable, [&quot;verify&quot;])');
+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;&quot;}, {name: &quot;RSASSA-PKCS1-v1_5&quot;, hash: &quot;sha-512&quot;}, extractable, [&quot;verify&quot;])');
</ins><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;RSA-OAEP-224&quot;}, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;encrypt&quot;, &quot;wrapKey&quot;])');
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;RSA-OAEP-256&quot;}, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-224&quot;}, extractable, [&quot;encrypt&quot;, &quot;wrapKey&quot;])');
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;RSA-OAEP-384&quot;}, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-256&quot;}, extractable, [&quot;encrypt&quot;, &quot;wrapKey&quot;])');
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;RSA-OAEP-512&quot;}, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-384&quot;}, extractable, [&quot;encrypt&quot;, &quot;wrapKey&quot;])');
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;RSA-OAEP&quot;}, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-512&quot;}, extractable, [&quot;encrypt&quot;, &quot;wrapKey&quot;])');
</span><ins>+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;&quot;}, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;encrypt&quot;, &quot;wrapKey&quot;])');
+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;&quot;}, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-224&quot;}, extractable, [&quot;encrypt&quot;, &quot;wrapKey&quot;])');
+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;&quot;}, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-256&quot;}, extractable, [&quot;encrypt&quot;, &quot;wrapKey&quot;])');
+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;&quot;}, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-384&quot;}, extractable, [&quot;encrypt&quot;, &quot;wrapKey&quot;])');
+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, alg: &quot;&quot;}, {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-512&quot;}, extractable, [&quot;encrypt&quot;, &quot;wrapKey&quot;])');
</ins><span class="cx"> // Jwk: Wrong kty
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;oct&quot;, n: n, e: e}, &quot;RSAES-PKCS1-v1_5&quot;, extractable, [&quot;encrypt&quot;])');
</span><span class="cx"> // Jwk: Wrong key_ops
</span><span class="lines">@@ -74,6 +91,9 @@
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, d: d, p: p, q: q, dq: dq, qi: qi}, &quot;RSAES-PKCS1-v1_5&quot;, extractable, [&quot;decrypt&quot;])');
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, d: d, p: p, q: q, dp: dp, qi: qi}, &quot;RSAES-PKCS1-v1_5&quot;, extractable, [&quot;decrypt&quot;])');
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, d: d, p: p, q: q, dp: dp, dq: dq}, &quot;RSAES-PKCS1-v1_5&quot;, extractable, [&quot;decrypt&quot;])');
</span><ins>+// Empty n, p
+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: &quot;&quot;, e: e, d: d, p: p, q: q, dp: dp, dq: dq, qi: qi}, &quot;RSAES-PKCS1-v1_5&quot;, extractable, [&quot;decrypt&quot;])');
+shouldReject('crypto.subtle.importKey(&quot;jwk&quot;, {kty: &quot;RSA&quot;, n: n, e: e, d: d, p: &quot;&quot;, q: q, dp: dp, dq: dq, qi: qi}, &quot;RSAES-PKCS1-v1_5&quot;, extractable, [&quot;decrypt&quot;])');
</ins><span class="cx"> // Spki: Wrong usages
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;spki&quot;, spkiKey, &quot;RSAES-PKCS1-v1_5&quot;, extractable, [&quot;decrypt&quot;])');
</span><span class="cx"> shouldReject('crypto.subtle.importKey(&quot;spki&quot;, spkiKey, {name: &quot;RSASSA-PKCS1-v1_5&quot;, hash: &quot;sha-1&quot;}, extractable, [&quot;sign&quot;])');
</span></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtleresourcesaescbcimportkeywrapkeyjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/crypto/workers/subtle/resources/aes-cbc-import-key-wrap-key.js (212464 => 212465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/resources/aes-cbc-import-key-wrap-key.js        2017-02-16 22:28:54 UTC (rev 212464)
+++ trunk/LayoutTests/crypto/workers/subtle/resources/aes-cbc-import-key-wrap-key.js        2017-02-16 22:31:14 UTC (rev 212465)
</span><span class="lines">@@ -20,7 +20,7 @@
</span><span class="cx">     name: &quot;aes-cbc&quot;,
</span><span class="cx">     iv: asciiToUint8Array(&quot;jnOw99oOZFLIEPMr&quot;),
</span><span class="cx"> }
</span><del>-var expectWrappedKey = &quot;848aa2f70ee18e2953520132a79cf47946e00c99362340bb690edc9ab5315757462c128278c6232e770e7437c56ed722a8e1703855f7f3e565394e1a6a0305c4ef1b30fa4c7f72d1a239cc6c6ba067898798a36a75132c66b4a2d3fb942886affd3ea3b2756b0ddc886c01e3b93107469b82124468408ef8ab548b85aa8f206c312d74ce4f2c679eb147a275cefda64d5bdc4a2b5b90a4ac9ad3eb5f2cf19f5f87653211f59b4731ba61125582a233951097dea65db05899d587d1dcfccab9ab7410ab3010b89066506dbacbc6b73e4b564792751388fa0f58d55c59c14a08c9dfb0f78100b0f5cc29d62328822636d30a6a153ec5cd4727ad5e47b419c48544565637ac5789863d43b7da78cf4383d09d66e9d458e436dbfbee75e382b2bab49eec2c7491ff93cf099fe92feaf4658e30889fd12d3ae61cd5e8c8e1e56a079b662f90cd10cdbdbb4d12eefb36d825e1a043e82f5a98f8960d655d3f9ed5af31e581fa846cc582f6cee5c25e0b3c32050534ae957ce27860d470ba26da2c7d6fa621b0faa8becad58e9e55bb2a9d984b042f25df21482529870d271cbf5508a0edfc3cb37316c11f16b342bc1f1f98aa&quot;;
</del><ins>+var expectWrappedKey = &quot;995a93379575a0c677a7d48dbe7d496fe4d8c9be49cdaf48e88398a769c2825d94396edb75683ed54e3ca0ac1f352f6b92486ef68186ef37d2b6be27ddd4bdaafbea98ec8c0dfc62353714f11219d4c69271a06507909f6dc50fd136f06265e5bfe9b2de09a704db4b4acd1d2834eefaab814484b70d77984455a1bad47e94cedc467939ea7495387087aff0eec9dfa4bf6c5baa6df37328a7068128930adc129a1874c323f315e993a27c667f1e02ffab5cc235bb7d270696875f43bb198f453cdef134ffe171c855c4641678527819dce552e4cd97fb30404075869aba085634327774cd7b71e7d0ea306f2d92d64658778897489fff205645e1a1b57832349ef1e6abef7c6780aa085b7d55c55693d69cf439497925dc8239791130d4387387188f2dea13d2825b2690456df80f6f1694351c8f33eb37bc44f2ad3f8f6d0a0e98c1510c6a5f64209288516aec0b30f85ed0b129a5ffc4840a9b5f0374c37304ad4f3d81572417813172929dd08f8a853ab57d3bc5d72eeeca932d8a05d3eb74d2ceba39b87cd7113abb30de3d05448162b50b17de8603fa4b5e7f8ab267cc6b8fdc830d76a35eb4078597b6301176&quot;;
</ins><span class="cx"> 
</span><span class="cx"> crypto.subtle.importKey(&quot;raw&quot;, rawKey, &quot;aes-cbc&quot;, extractable, [&quot;wrapKey&quot;]).then(function(result) {
</span><span class="cx">     wrappingKey = result;
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (212464 => 212465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-02-16 22:28:54 UTC (rev 212464)
+++ trunk/Source/WebCore/ChangeLog        2017-02-16 22:31:14 UTC (rev 212465)
</span><span class="lines">@@ -1,3 +1,47 @@
</span><ins>+2017-02-16  Jiewen Tan  &lt;jiewen_tan@apple.com&gt;
+
+        [WebCrypto] remove toJSValueFromJsonWebKey from custom SubtleCrypto binding codes
+        https://bugs.webkit.org/show_bug.cgi?id=167026
+
+        Reviewed by Chris Dumez.
+
+        Covered by existing tests.
+
+        * bindings/js/JSSubtleCryptoCustom.cpp:
+        (WebCore::jsSubtleCryptoFunctionExportKeyPromise):
+        (WebCore::jsSubtleCryptoFunctionWrapKeyPromise):
+        (WebCore::toJSValueFromJsonWebKey): Deleted.
+        * crypto/JsonWebKey.h:
+        * crypto/JsonWebKey.idl:
+        * crypto/RsaOtherPrimesInfo.idl:
+        Change std::optional&lt;String&gt; to String in order to use toJS&lt;IDLDictionary&lt;JsonWebKey&gt;&gt;.
+        * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
+        (WebCore::CryptoAlgorithmAES_CBC::importKey):
+        * crypto/algorithms/CryptoAlgorithmAES_KW.cpp:
+        (WebCore::CryptoAlgorithmAES_KW::importKey):
+        * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
+        (WebCore::CryptoAlgorithmHMAC::importKey):
+        * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
+        (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):
+        * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
+        (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
+        * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
+        (WebCore::CryptoAlgorithmRSA_OAEP::importKey):
+        * crypto/keys/CryptoKeyAES.cpp:
+        (WebCore::CryptoKeyAES::importJwk):
+        Only check if key_ops contains all of the specified usages when key_ops field of jwk is present,
+        as per the specification: https://www.w3.org/TR/WebCryptoAPI/#aes-cbc-operations
+        * crypto/keys/CryptoKeyAES.h:
+        * crypto/keys/CryptoKeyHMAC.cpp:
+        (WebCore::CryptoKeyHMAC::importJwk):
+        * crypto/keys/CryptoKeyHMAC.h:
+        * crypto/keys/CryptoKeyRSA.cpp:
+        (WebCore::CryptoKeyRSA::importJwk):
+        Accommodate the change from std::optional&lt;String&gt; to String.
+        * crypto/mac/CryptoKeyRSAMac.cpp:
+        (WebCore::CryptoKeyRSA::create):
+        Add a null check for p.
+
</ins><span class="cx"> 2017-02-16  Antti Koivisto  &lt;antti@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Execute pending scripts asynchronously after stylesheet loads complete
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSSubtleCryptoCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp (212464 => 212465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp        2017-02-16 22:28:54 UTC (rev 212464)
+++ trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp        2017-02-16 22:31:14 UTC (rev 212465)
</span><span class="lines">@@ -359,61 +359,6 @@
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-// FIXME: We should get rid of this once https://bugs.webkit.org/show_bug.cgi?id=163711 is fixed.
-static JSValue toJSValueFromJsonWebKey(JSDOMGlobalObject&amp; globalObject, JsonWebKey&amp;&amp; key)
-{
-    ExecState&amp; state = *globalObject.globalExec();
-    VM&amp; vm = state.vm();
-
-    auto* result = constructEmptyObject(&amp;state);
-    result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;kty&quot;), toJS&lt;IDLDOMString&gt;(state, key.kty));
-    if (key.use)
-        result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;use&quot;), toJS&lt;IDLDOMString&gt;(state, key.use.value()));
-    if (key.key_ops)
-        result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;key_ops&quot;), toJS&lt;IDLSequence&lt;IDLEnumeration&lt;CryptoKeyUsage&gt;&gt;&gt;(state, globalObject, key.key_ops.value()));
-    if (key.alg)
-        result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;alg&quot;), toJS&lt;IDLDOMString&gt;(state, key.alg.value()));
-    if (key.ext)
-        result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;ext&quot;), toJS&lt;IDLBoolean&gt;(state, key.ext.value()));
-    if (key.crv)
-        result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;crv&quot;), toJS&lt;IDLDOMString&gt;(state, key.crv.value()));
-    if (key.x)
-        result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;x&quot;), toJS&lt;IDLDOMString&gt;(state, key.x.value()));
-    if (key.y)
-        result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;y&quot;), toJS&lt;IDLDOMString&gt;(state, key.y.value()));
-    if (key.d)
-        result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;d&quot;), toJS&lt;IDLDOMString&gt;(state, key.d.value()));
-    if (key.n)
-        result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;n&quot;), toJS&lt;IDLDOMString&gt;(state, key.n.value()));
-    if (key.e)
-        result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;e&quot;), toJS&lt;IDLDOMString&gt;(state, key.e.value()));
-    if (key.p)
-        result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;p&quot;), toJS&lt;IDLDOMString&gt;(state, key.p.value()));
-    if (key.q)
-        result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;q&quot;), toJS&lt;IDLDOMString&gt;(state, key.q.value()));
-    if (key.dp)
-        result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;dp&quot;), toJS&lt;IDLDOMString&gt;(state, key.dp.value()));
-    if (key.dq)
-        result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;dq&quot;), toJS&lt;IDLDOMString&gt;(state, key.dq.value()));
-    if (key.qi)
-        result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;qi&quot;), toJS&lt;IDLDOMString&gt;(state, key.qi.value()));
-    if (key.oth) {
-        MarkedArgumentBuffer list;
-        for (auto&amp; value : key.oth.value()) {
-            auto* info = constructEmptyObject(&amp;state);
-            info-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;r&quot;), toJS&lt;IDLDOMString&gt;(state, value.r));
-            info-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;d&quot;), toJS&lt;IDLDOMString&gt;(state, value.d));
-            info-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;t&quot;), toJS&lt;IDLDOMString&gt;(state, value.t));
-            list.append(info);
-        }
-        result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;oth&quot;), constructArray(&amp;state, static_cast&lt;Structure*&gt;(nullptr), list));
-    }
-    if (key.k)
-        result-&gt;putDirect(vm, Identifier::fromString(&amp;vm, &quot;k&quot;), toJS&lt;IDLDOMString&gt;(state, key.k.value()));
-
-    return result;
-}
-
</del><span class="cx"> static RefPtr&lt;CryptoKey&gt; toCryptoKey(ExecState&amp; state, JSValue value)
</span><span class="cx"> {
</span><span class="cx">     VM&amp; vm = state.vm();
</span><span class="lines">@@ -865,7 +810,7 @@
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">         case SubtleCrypto::KeyFormat::Jwk:
</span><del>-            capturedPromise-&gt;resolve&lt;IDLAny&gt;(toJSValueFromJsonWebKey(*(capturedPromise-&gt;globalObject()), WTFMove(WTF::get&lt;JsonWebKey&gt;(key))));
</del><ins>+            capturedPromise-&gt;resolve&lt;IDLDictionary&lt;JsonWebKey&gt;&gt;(WTFMove(WTF::get&lt;JsonWebKey&gt;(key)));
</ins><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">         ASSERT_NOT_REACHED();
</span><span class="lines">@@ -954,7 +899,7 @@
</span><span class="cx">             bytes = WTF::get&lt;Vector&lt;uint8_t&gt;&gt;(key);
</span><span class="cx">             break;
</span><span class="cx">         case SubtleCrypto::KeyFormat::Jwk: {
</span><del>-            auto jwk = toJSValueFromJsonWebKey(*(promise-&gt;globalObject()), WTFMove(WTF::get&lt;JsonWebKey&gt;(key)));
</del><ins>+            auto jwk = toJS&lt;IDLDictionary&lt;JsonWebKey&gt;&gt;(*(promise-&gt;globalObject()-&gt;globalExec()), *(promise-&gt;globalObject()), WTFMove(WTF::get&lt;JsonWebKey&gt;(key)));
</ins><span class="cx">             String jwkString = JSONStringify(promise-&gt;globalObject()-&gt;globalExec(), jwk, 0);
</span><span class="cx">             CString jwkUtf8String = jwkString.utf8(StrictConversion);
</span><span class="cx">             bytes.append(jwkUtf8String.data(), jwkUtf8String.length());
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoJsonWebKeyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/JsonWebKey.h (212464 => 212465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/JsonWebKey.h        2017-02-16 22:28:54 UTC (rev 212464)
+++ trunk/Source/WebCore/crypto/JsonWebKey.h        2017-02-16 22:31:14 UTC (rev 212465)
</span><span class="lines">@@ -35,27 +35,27 @@
</span><span class="cx"> 
</span><span class="cx"> struct JsonWebKey {
</span><span class="cx">     String kty;
</span><del>-    std::optional&lt;String&gt; use;
</del><ins>+    String use;
</ins><span class="cx">     // FIXME: Consider merging key_ops and usages.
</span><span class="cx">     std::optional&lt;Vector&lt;CryptoKeyUsage&gt;&gt; key_ops;
</span><span class="cx">     CryptoKeyUsageBitmap usages;
</span><del>-    std::optional&lt;String&gt; alg;
</del><ins>+    String alg;
</ins><span class="cx"> 
</span><span class="cx">     std::optional&lt;bool&gt; ext;
</span><span class="cx"> 
</span><del>-    std::optional&lt;String&gt; crv;
-    std::optional&lt;String&gt; x;
-    std::optional&lt;String&gt; y;
-    std::optional&lt;String&gt; d;
-    std::optional&lt;String&gt; n;
-    std::optional&lt;String&gt; e;
-    std::optional&lt;String&gt; p;
-    std::optional&lt;String&gt; q;
-    std::optional&lt;String&gt; dp;
-    std::optional&lt;String&gt; dq;
-    std::optional&lt;String&gt; qi;
</del><ins>+    String crv;
+    String x;
+    String y;
+    String d;
+    String n;
+    String e;
+    String p;
+    String q;
+    String dp;
+    String dq;
+    String qi;
</ins><span class="cx">     std::optional&lt;Vector&lt;RsaOtherPrimesInfo&gt;&gt; oth;
</span><del>-    std::optional&lt;String&gt; k;
</del><ins>+    String k;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoJsonWebKeyidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/JsonWebKey.idl (212464 => 212465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/JsonWebKey.idl        2017-02-16 22:28:54 UTC (rev 212464)
+++ trunk/Source/WebCore/crypto/JsonWebKey.idl        2017-02-16 22:31:14 UTC (rev 212465)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx"> 
</span><span class="cx"> [
</span><span class="cx">     Conditional=SUBTLE_CRYPTO,
</span><ins>+    JSGenerateToJSObject,
</ins><span class="cx"> ] dictionary JsonWebKey {
</span><span class="cx">     // The following fields are defined in Section 3.1 of JSON Web Key
</span><span class="cx">     required DOMString kty;
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoRsaOtherPrimesInfoidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/RsaOtherPrimesInfo.idl (212464 => 212465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/RsaOtherPrimesInfo.idl        2017-02-16 22:28:54 UTC (rev 212464)
+++ trunk/Source/WebCore/crypto/RsaOtherPrimesInfo.idl        2017-02-16 22:31:14 UTC (rev 212465)
</span><span class="lines">@@ -25,6 +25,7 @@
</span><span class="cx"> 
</span><span class="cx"> [
</span><span class="cx">     Conditional=SUBTLE_CRYPTO,
</span><ins>+    JSGenerateToJSObject,
</ins><span class="cx"> ] dictionary RsaOtherPrimesInfo {
</span><span class="cx">     // The following fields are defined in Section 6.3.2.7 of JSON Web Algorithms
</span><span class="cx">     required DOMString r;
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmAES_CBCcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.cpp (212464 => 212465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.cpp        2017-02-16 22:28:54 UTC (rev 212464)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.cpp        2017-02-16 22:31:14 UTC (rev 212465)
</span><span class="lines">@@ -120,14 +120,14 @@
</span><span class="cx">         result = CryptoKeyAES::importRaw(parameters-&gt;identifier, WTFMove(WTF::get&lt;Vector&lt;uint8_t&gt;&gt;(data)), extractable, usages);
</span><span class="cx">         break;
</span><span class="cx">     case SubtleCrypto::KeyFormat::Jwk: {
</span><del>-        auto checkAlgCallback = [](size_t length, const std::optional&lt;String&gt;&amp; alg) -&gt; bool {
</del><ins>+        auto checkAlgCallback = [](size_t length, const String&amp; alg) -&gt; bool {
</ins><span class="cx">             switch (length) {
</span><span class="cx">             case CryptoKeyAES::s_length128:
</span><del>-                return !alg || alg.value() == ALG128;
</del><ins>+                return alg.isNull() || alg == ALG128;
</ins><span class="cx">             case CryptoKeyAES::s_length192:
</span><del>-                return !alg || alg.value() == ALG192;
</del><ins>+                return alg.isNull() || alg == ALG192;
</ins><span class="cx">             case CryptoKeyAES::s_length256:
</span><del>-                return !alg || alg.value() == ALG256;
</del><ins>+                return alg.isNull() || alg == ALG256;
</ins><span class="cx">             }
</span><span class="cx">             return false;
</span><span class="cx">         };
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmAES_KWcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_KW.cpp (212464 => 212465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_KW.cpp        2017-02-16 22:28:54 UTC (rev 212464)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_KW.cpp        2017-02-16 22:31:14 UTC (rev 212465)
</span><span class="lines">@@ -94,14 +94,14 @@
</span><span class="cx">         result = CryptoKeyAES::importRaw(parameters-&gt;identifier, WTFMove(WTF::get&lt;Vector&lt;uint8_t&gt;&gt;(data)), extractable, usages);
</span><span class="cx">         break;
</span><span class="cx">     case SubtleCrypto::KeyFormat::Jwk: {
</span><del>-        result = CryptoKeyAES::importJwk(parameters-&gt;identifier, WTFMove(WTF::get&lt;JsonWebKey&gt;(data)), extractable, usages, [](size_t length, const std::optional&lt;String&gt;&amp; alg) -&gt; bool {
</del><ins>+        result = CryptoKeyAES::importJwk(parameters-&gt;identifier, WTFMove(WTF::get&lt;JsonWebKey&gt;(data)), extractable, usages, [](size_t length, const String&amp; alg) -&gt; bool {
</ins><span class="cx">             switch (length) {
</span><span class="cx">             case CryptoKeyAES::s_length128:
</span><del>-                return !alg || alg.value() == ALG128;
</del><ins>+                return alg.isNull() || alg == ALG128;
</ins><span class="cx">             case CryptoKeyAES::s_length192:
</span><del>-                return !alg || alg.value() == ALG192;
</del><ins>+                return alg.isNull() || alg == ALG192;
</ins><span class="cx">             case CryptoKeyAES::s_length256:
</span><del>-                return !alg || alg.value() == ALG256;
</del><ins>+                return alg.isNull() || alg == ALG256;
</ins><span class="cx">             }
</span><span class="cx">             return false;
</span><span class="cx">         });
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmHMACcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.cpp (212464 => 212465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.cpp        2017-02-16 22:28:54 UTC (rev 212464)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.cpp        2017-02-16 22:31:14 UTC (rev 212465)
</span><span class="lines">@@ -119,18 +119,18 @@
</span><span class="cx">         result = CryptoKeyHMAC::importRaw(hmacParameters.length.value_or(0), hmacParameters.hashIdentifier, WTFMove(WTF::get&lt;Vector&lt;uint8_t&gt;&gt;(data)), extractable, usages);
</span><span class="cx">         break;
</span><span class="cx">     case SubtleCrypto::KeyFormat::Jwk: {
</span><del>-        auto checkAlgCallback = [](CryptoAlgorithmIdentifier hash, const std::optional&lt;String&gt;&amp; alg) -&gt; bool {
</del><ins>+        auto checkAlgCallback = [](CryptoAlgorithmIdentifier hash, const String&amp; alg) -&gt; bool {
</ins><span class="cx">             switch (hash) {
</span><span class="cx">             case CryptoAlgorithmIdentifier::SHA_1:
</span><del>-                return !alg || alg.value() == ALG1;
</del><ins>+                return alg.isNull() || alg == ALG1;
</ins><span class="cx">             case CryptoAlgorithmIdentifier::SHA_224:
</span><del>-                return !alg || alg.value() == ALG224;
</del><ins>+                return alg.isNull() || alg == ALG224;
</ins><span class="cx">             case CryptoAlgorithmIdentifier::SHA_256:
</span><del>-                return !alg || alg.value() == ALG256;
</del><ins>+                return alg.isNull() || alg == ALG256;
</ins><span class="cx">             case CryptoAlgorithmIdentifier::SHA_384:
</span><del>-                return !alg || alg.value() == ALG384;
</del><ins>+                return alg.isNull() || alg == ALG384;
</ins><span class="cx">             case CryptoAlgorithmIdentifier::SHA_512:
</span><del>-                return !alg || alg.value() == ALG512;
</del><ins>+                return alg.isNull() || alg == ALG512;
</ins><span class="cx">             default:
</span><span class="cx">                 return false;
</span><span class="cx">             }
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmRSAES_PKCS1_v1_5cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp (212464 => 212465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp        2017-02-16 22:28:54 UTC (rev 212464)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp        2017-02-16 22:31:14 UTC (rev 212465)
</span><span class="lines">@@ -106,15 +106,15 @@
</span><span class="cx">     switch (format) {
</span><span class="cx">     case SubtleCrypto::KeyFormat::Jwk: {
</span><span class="cx">         JsonWebKey key = WTFMove(WTF::get&lt;JsonWebKey&gt;(data));
</span><del>-        if (usages &amp;&amp; ((key.d &amp;&amp; (usages ^ CryptoKeyUsageDecrypt)) || (!key.d &amp;&amp; (usages ^ CryptoKeyUsageEncrypt)))) {
</del><ins>+        if (usages &amp;&amp; ((!key.d.isNull() &amp;&amp; (usages ^ CryptoKeyUsageDecrypt)) || (key.d.isNull() &amp;&amp; (usages ^ CryptoKeyUsageEncrypt)))) {
</ins><span class="cx">             exceptionCallback(SYNTAX_ERR);
</span><span class="cx">             return;
</span><span class="cx">         }
</span><del>-        if (usages &amp;&amp; key.use &amp;&amp; key.use.value() != &quot;enc&quot;) {
</del><ins>+        if (usages &amp;&amp; !key.use.isNull() &amp;&amp; key.use != &quot;enc&quot;) {
</ins><span class="cx">             exceptionCallback(DataError);
</span><span class="cx">             return;
</span><span class="cx">         }
</span><del>-        if (key.alg &amp;&amp; key.alg.value() != ALG) {
</del><ins>+        if (!key.alg.isNull() &amp;&amp; key.alg != ALG) {
</ins><span class="cx">             exceptionCallback(DataError);
</span><span class="cx">             return;
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmRSASSA_PKCS1_v1_5cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp (212464 => 212465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp        2017-02-16 22:28:54 UTC (rev 212464)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp        2017-02-16 22:31:14 UTC (rev 212465)
</span><span class="lines">@@ -117,11 +117,11 @@
</span><span class="cx">     case SubtleCrypto::KeyFormat::Jwk: {
</span><span class="cx">         JsonWebKey key = WTFMove(WTF::get&lt;JsonWebKey&gt;(data));
</span><span class="cx"> 
</span><del>-        if (usages &amp;&amp; ((key.d &amp;&amp; (usages ^ CryptoKeyUsageSign)) || (!key.d &amp;&amp; (usages ^ CryptoKeyUsageVerify)))) {
</del><ins>+        if (usages &amp;&amp; ((!key.d.isNull() &amp;&amp; (usages ^ CryptoKeyUsageSign)) || (key.d.isNull() &amp;&amp; (usages ^ CryptoKeyUsageVerify)))) {
</ins><span class="cx">             exceptionCallback(SYNTAX_ERR);
</span><span class="cx">             return;
</span><span class="cx">         }
</span><del>-        if (usages &amp;&amp; key.use &amp;&amp; key.use.value() != &quot;sig&quot;) {
</del><ins>+        if (usages &amp;&amp; !key.use.isNull() &amp;&amp; key.use != &quot;sig&quot;) {
</ins><span class="cx">             exceptionCallback(DataError);
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="lines">@@ -129,19 +129,19 @@
</span><span class="cx">         bool isMatched = false;
</span><span class="cx">         switch (rsaParameters.hashIdentifier) {
</span><span class="cx">         case CryptoAlgorithmIdentifier::SHA_1:
</span><del>-            isMatched = !key.alg || key.alg.value() == ALG1;
</del><ins>+            isMatched = key.alg.isNull() || key.alg == ALG1;
</ins><span class="cx">             break;
</span><span class="cx">         case CryptoAlgorithmIdentifier::SHA_224:
</span><del>-            isMatched = !key.alg || key.alg.value() == ALG224;
</del><ins>+            isMatched = key.alg.isNull() || key.alg == ALG224;
</ins><span class="cx">             break;
</span><span class="cx">         case CryptoAlgorithmIdentifier::SHA_256:
</span><del>-            isMatched = !key.alg || key.alg.value() == ALG256;
</del><ins>+            isMatched = key.alg.isNull() || key.alg == ALG256;
</ins><span class="cx">             break;
</span><span class="cx">         case CryptoAlgorithmIdentifier::SHA_384:
</span><del>-            isMatched = !key.alg || key.alg.value() == ALG384;
</del><ins>+            isMatched = key.alg.isNull() || key.alg == ALG384;
</ins><span class="cx">             break;
</span><span class="cx">         case CryptoAlgorithmIdentifier::SHA_512:
</span><del>-            isMatched = !key.alg || key.alg.value() == ALG512;
</del><ins>+            isMatched = key.alg.isNull() || key.alg == ALG512;
</ins><span class="cx">             break;
</span><span class="cx">         default:
</span><span class="cx">             break;
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmRSA_OAEPcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp (212464 => 212465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp        2017-02-16 22:28:54 UTC (rev 212464)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp        2017-02-16 22:31:14 UTC (rev 212465)
</span><span class="lines">@@ -120,7 +120,7 @@
</span><span class="cx">         JsonWebKey key = WTFMove(WTF::get&lt;JsonWebKey&gt;(data));
</span><span class="cx"> 
</span><span class="cx">         bool isUsagesAllowed = false;
</span><del>-        if (key.d) {
</del><ins>+        if (!key.d.isNull()) {
</ins><span class="cx">             isUsagesAllowed = isUsagesAllowed || !(usages ^ CryptoKeyUsageDecrypt);
</span><span class="cx">             isUsagesAllowed = isUsagesAllowed || !(usages ^ CryptoKeyUsageUnwrapKey);
</span><span class="cx">             isUsagesAllowed = isUsagesAllowed || !(usages ^ (CryptoKeyUsageDecrypt | CryptoKeyUsageUnwrapKey));
</span><span class="lines">@@ -135,7 +135,7 @@
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if (usages &amp;&amp; key.use &amp;&amp; key.use.value() != &quot;enc&quot;) {
</del><ins>+        if (usages &amp;&amp; !key.use.isNull() &amp;&amp; key.use != &quot;enc&quot;) {
</ins><span class="cx">             exceptionCallback(DataError);
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="lines">@@ -143,19 +143,19 @@
</span><span class="cx">         bool isMatched = false;
</span><span class="cx">         switch (rsaParameters.hashIdentifier) {
</span><span class="cx">         case CryptoAlgorithmIdentifier::SHA_1:
</span><del>-            isMatched = !key.alg || key.alg.value() == ALG1;
</del><ins>+            isMatched = key.alg.isNull() || key.alg == ALG1;
</ins><span class="cx">             break;
</span><span class="cx">         case CryptoAlgorithmIdentifier::SHA_224:
</span><del>-            isMatched = !key.alg || key.alg.value() == ALG224;
</del><ins>+            isMatched = key.alg.isNull() || key.alg == ALG224;
</ins><span class="cx">             break;
</span><span class="cx">         case CryptoAlgorithmIdentifier::SHA_256:
</span><del>-            isMatched = !key.alg || key.alg.value() == ALG256;
</del><ins>+            isMatched = key.alg.isNull() || key.alg == ALG256;
</ins><span class="cx">             break;
</span><span class="cx">         case CryptoAlgorithmIdentifier::SHA_384:
</span><del>-            isMatched = !key.alg || key.alg.value() == ALG384;
</del><ins>+            isMatched = key.alg.isNull() || key.alg == ALG384;
</ins><span class="cx">             break;
</span><span class="cx">         case CryptoAlgorithmIdentifier::SHA_512:
</span><del>-            isMatched = !key.alg || key.alg.value() == ALG512;
</del><ins>+            isMatched = key.alg.isNull() || key.alg == ALG512;
</ins><span class="cx">             break;
</span><span class="cx">         default:
</span><span class="cx">             break;
</span></span></pre></div>
<a id="trunkSourceWebCorecryptokeysCryptoKeyAEScpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/keys/CryptoKeyAES.cpp (212464 => 212465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/keys/CryptoKeyAES.cpp        2017-02-16 22:28:54 UTC (rev 212464)
+++ trunk/Source/WebCore/crypto/keys/CryptoKeyAES.cpp        2017-02-16 22:31:14 UTC (rev 212465)
</span><span class="lines">@@ -87,16 +87,16 @@
</span><span class="cx"> {
</span><span class="cx">     if (keyData.kty != &quot;oct&quot;)
</span><span class="cx">         return nullptr;
</span><del>-    if (!keyData.k)
</del><ins>+    if (keyData.k.isNull())
</ins><span class="cx">         return nullptr;
</span><span class="cx">     Vector&lt;uint8_t&gt; octetSequence;
</span><del>-    if (!base64URLDecode(keyData.k.value(), octetSequence))
</del><ins>+    if (!base64URLDecode(keyData.k, octetSequence))
</ins><span class="cx">         return nullptr;
</span><span class="cx">     if (!callback(octetSequence.size() * 8, keyData.alg))
</span><span class="cx">         return nullptr;
</span><del>-    if (usages &amp;&amp; keyData.use &amp;&amp; keyData.use.value() != &quot;enc&quot;)
</del><ins>+    if (usages &amp;&amp; !keyData.use.isNull() &amp;&amp; keyData.use != &quot;enc&quot;)
</ins><span class="cx">         return nullptr;
</span><del>-    if (keyData.usages &amp;&amp; ((keyData.usages &amp; usages) != usages))
</del><ins>+    if (keyData.key_ops &amp;&amp; ((keyData.usages &amp; usages) != usages))
</ins><span class="cx">         return nullptr;
</span><span class="cx">     if (keyData.ext &amp;&amp; !keyData.ext.value() &amp;&amp; extractable)
</span><span class="cx">         return nullptr;
</span></span></pre></div>
<a id="trunkSourceWebCorecryptokeysCryptoKeyAESh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/keys/CryptoKeyAES.h (212464 => 212465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/keys/CryptoKeyAES.h        2017-02-16 22:28:54 UTC (rev 212464)
+++ trunk/Source/WebCore/crypto/keys/CryptoKeyAES.h        2017-02-16 22:31:14 UTC (rev 212465)
</span><span class="lines">@@ -68,7 +68,7 @@
</span><span class="cx"> 
</span><span class="cx">     static RefPtr&lt;CryptoKeyAES&gt; generate(CryptoAlgorithmIdentifier, size_t lengthBits, bool extractable, CryptoKeyUsageBitmap);
</span><span class="cx">     static RefPtr&lt;CryptoKeyAES&gt; importRaw(CryptoAlgorithmIdentifier, Vector&lt;uint8_t&gt;&amp;&amp; keyData, bool extractable, CryptoKeyUsageBitmap);
</span><del>-    using CheckAlgCallback = WTF::Function&lt;bool(size_t, const std::optional&lt;String&gt;&amp;)&gt;;
</del><ins>+    using CheckAlgCallback = Function&lt;bool(size_t, const String&amp;)&gt;;
</ins><span class="cx">     static RefPtr&lt;CryptoKeyAES&gt; importJwk(CryptoAlgorithmIdentifier, JsonWebKey&amp;&amp;, bool extractable, CryptoKeyUsageBitmap, CheckAlgCallback&amp;&amp;);
</span><span class="cx"> 
</span><span class="cx">     CryptoKeyClass keyClass() const final { return CryptoKeyClass::AES; }
</span></span></pre></div>
<a id="trunkSourceWebCorecryptokeysCryptoKeyHMACcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/keys/CryptoKeyHMAC.cpp (212464 => 212465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/keys/CryptoKeyHMAC.cpp        2017-02-16 22:28:54 UTC (rev 212464)
+++ trunk/Source/WebCore/crypto/keys/CryptoKeyHMAC.cpp        2017-02-16 22:31:14 UTC (rev 212465)
</span><span class="lines">@@ -97,14 +97,14 @@
</span><span class="cx"> {
</span><span class="cx">     if (keyData.kty != &quot;oct&quot;)
</span><span class="cx">         return nullptr;
</span><del>-    if (!keyData.k)
</del><ins>+    if (keyData.k.isNull())
</ins><span class="cx">         return nullptr;
</span><span class="cx">     Vector&lt;uint8_t&gt; octetSequence;
</span><del>-    if (!base64URLDecode(keyData.k.value(), octetSequence))
</del><ins>+    if (!base64URLDecode(keyData.k, octetSequence))
</ins><span class="cx">         return nullptr;
</span><span class="cx">     if (!callback(hash, keyData.alg))
</span><span class="cx">         return nullptr;
</span><del>-    if (usages &amp;&amp; keyData.use &amp;&amp; keyData.use.value() != &quot;sig&quot;)
</del><ins>+    if (usages &amp;&amp; !keyData.use.isNull() &amp;&amp; keyData.use != &quot;sig&quot;)
</ins><span class="cx">         return nullptr;
</span><span class="cx">     if (keyData.usages &amp;&amp; ((keyData.usages &amp; usages) != usages))
</span><span class="cx">         return nullptr;
</span></span></pre></div>
<a id="trunkSourceWebCorecryptokeysCryptoKeyHMACh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/keys/CryptoKeyHMAC.h (212464 => 212465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/keys/CryptoKeyHMAC.h        2017-02-16 22:28:54 UTC (rev 212464)
+++ trunk/Source/WebCore/crypto/keys/CryptoKeyHMAC.h        2017-02-16 22:31:14 UTC (rev 212465)
</span><span class="lines">@@ -64,7 +64,7 @@
</span><span class="cx"> 
</span><span class="cx">     static RefPtr&lt;CryptoKeyHMAC&gt; generate(size_t lengthBits, CryptoAlgorithmIdentifier hash, bool extractable, CryptoKeyUsageBitmap);
</span><span class="cx">     static RefPtr&lt;CryptoKeyHMAC&gt; importRaw(size_t lengthBits, CryptoAlgorithmIdentifier hash, Vector&lt;uint8_t&gt;&amp;&amp; keyData, bool extractable, CryptoKeyUsageBitmap);
</span><del>-    using CheckAlgCallback = WTF::Function&lt;bool(CryptoAlgorithmIdentifier, const std::optional&lt;String&gt;&amp;)&gt;;
</del><ins>+    using CheckAlgCallback = Function&lt;bool(CryptoAlgorithmIdentifier, const String&amp;)&gt;;
</ins><span class="cx">     static RefPtr&lt;CryptoKeyHMAC&gt; importJwk(size_t lengthBits, CryptoAlgorithmIdentifier hash, JsonWebKey&amp;&amp;, bool extractable, CryptoKeyUsageBitmap, CheckAlgCallback&amp;&amp;);
</span><span class="cx"> 
</span><span class="cx">     CryptoKeyClass keyClass() const final { return CryptoKeyClass::HMAC; }
</span></span></pre></div>
<a id="trunkSourceWebCorecryptokeysCryptoKeyRSAcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/keys/CryptoKeyRSA.cpp (212464 => 212465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/keys/CryptoKeyRSA.cpp        2017-02-16 22:28:54 UTC (rev 212464)
+++ trunk/Source/WebCore/crypto/keys/CryptoKeyRSA.cpp        2017-02-16 22:31:14 UTC (rev 212465)
</span><span class="lines">@@ -43,18 +43,18 @@
</span><span class="cx">     if (keyData.ext &amp;&amp; !keyData.ext.value() &amp;&amp; extractable)
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><del>-    if (!keyData.n || !keyData.e)
</del><ins>+    if (keyData.n.isNull() || keyData.e.isNull())
</ins><span class="cx">         return nullptr;
</span><span class="cx">     Vector&lt;uint8_t&gt; modulus;
</span><del>-    if (!WTF::base64URLDecode(keyData.n.value(), modulus))
</del><ins>+    if (!WTF::base64URLDecode(keyData.n, modulus))
</ins><span class="cx">         return nullptr;
</span><span class="cx">     // Per RFC 7518 Section 6.3.1.1: https://tools.ietf.org/html/rfc7518#section-6.3.1.1
</span><del>-    if (!modulus[0])
</del><ins>+    if (!modulus.isEmpty() &amp;&amp; !modulus[0])
</ins><span class="cx">         modulus.remove(0);
</span><span class="cx">     Vector&lt;uint8_t&gt; exponent;
</span><del>-    if (!WTF::base64URLDecode(keyData.e.value(), exponent))
</del><ins>+    if (!WTF::base64URLDecode(keyData.e, exponent))
</ins><span class="cx">         return nullptr;
</span><del>-    if (!keyData.d) {
</del><ins>+    if (keyData.d.isNull()) {
</ins><span class="cx">         // import public key
</span><span class="cx">         auto publicKeyComponents = CryptoKeyDataRSAComponents::createPublic(WTFMove(modulus), WTFMove(exponent));
</span><span class="cx">         // Notice: CryptoAlgorithmIdentifier::SHA_1 is just a placeholder. It should not have any effect if hash is std::nullopt.
</span><span class="lines">@@ -63,27 +63,27 @@
</span><span class="cx"> 
</span><span class="cx">     // import private key
</span><span class="cx">     Vector&lt;uint8_t&gt; privateExponent;
</span><del>-    if (!WTF::base64URLDecode(keyData.d.value(), privateExponent))
</del><ins>+    if (!WTF::base64URLDecode(keyData.d, privateExponent))
</ins><span class="cx">         return nullptr;
</span><del>-    if (!keyData.p &amp;&amp; !keyData.q &amp;&amp; !keyData.dp &amp;&amp; !keyData.dp &amp;&amp; !keyData.qi) {
</del><ins>+    if (keyData.p.isNull() &amp;&amp; keyData.q.isNull() &amp;&amp; keyData.dp.isNull() &amp;&amp; keyData.dp.isNull() &amp;&amp; keyData.qi.isNull()) {
</ins><span class="cx">         auto privateKeyComponents = CryptoKeyDataRSAComponents::createPrivate(WTFMove(modulus), WTFMove(exponent), WTFMove(privateExponent));
</span><span class="cx">         // Notice: CryptoAlgorithmIdentifier::SHA_1 is just a placeholder. It should not have any effect if hash is std::nullopt.
</span><span class="cx">         return CryptoKeyRSA::create(algorithm, hash.value_or(CryptoAlgorithmIdentifier::SHA_1), !!hash, *privateKeyComponents, extractable, usages);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (!keyData.p || !keyData.q || !keyData.dp || !keyData.dq || !keyData.qi)
</del><ins>+    if (keyData.p.isNull() || keyData.q.isNull() || keyData.dp.isNull() || keyData.dq.isNull() || keyData.qi.isNull())
</ins><span class="cx">         return nullptr;
</span><span class="cx">     CryptoKeyDataRSAComponents::PrimeInfo firstPrimeInfo;
</span><span class="cx">     CryptoKeyDataRSAComponents::PrimeInfo secondPrimeInfo;
</span><del>-    if (!WTF::base64URLDecode(keyData.p.value(), firstPrimeInfo.primeFactor))
</del><ins>+    if (!WTF::base64URLDecode(keyData.p, firstPrimeInfo.primeFactor))
</ins><span class="cx">         return nullptr;
</span><del>-    if (!WTF::base64URLDecode(keyData.dp.value(), firstPrimeInfo.factorCRTExponent))
</del><ins>+    if (!WTF::base64URLDecode(keyData.dp, firstPrimeInfo.factorCRTExponent))
</ins><span class="cx">         return nullptr;
</span><del>-    if (!WTF::base64URLDecode(keyData.q.value(), secondPrimeInfo.primeFactor))
</del><ins>+    if (!WTF::base64URLDecode(keyData.q, secondPrimeInfo.primeFactor))
</ins><span class="cx">         return nullptr;
</span><del>-    if (!WTF::base64URLDecode(keyData.dq.value(), secondPrimeInfo.factorCRTExponent))
</del><ins>+    if (!WTF::base64URLDecode(keyData.dq, secondPrimeInfo.factorCRTExponent))
</ins><span class="cx">         return nullptr;
</span><del>-    if (!WTF::base64URLDecode(keyData.qi.value(), secondPrimeInfo.factorCRTCoefficient))
</del><ins>+    if (!WTF::base64URLDecode(keyData.qi, secondPrimeInfo.factorCRTCoefficient))
</ins><span class="cx">         return nullptr;
</span><span class="cx">     if (!keyData.oth) {
</span><span class="cx">         auto privateKeyComponents = CryptoKeyDataRSAComponents::createPrivateWithAdditionalData(WTFMove(modulus), WTFMove(exponent), WTFMove(privateExponent), WTFMove(firstPrimeInfo), WTFMove(secondPrimeInfo), { });
</span></span></pre></div>
<a id="trunkSourceWebCorecryptomacCryptoKeyRSAMaccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp (212464 => 212465)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp        2017-02-16 22:28:54 UTC (rev 212464)
+++ trunk/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp        2017-02-16 22:31:14 UTC (rev 212465)
</span><span class="lines">@@ -131,6 +131,11 @@
</span><span class="cx">         WTFLogAlways(&quot;Keys with more than two primes are not supported&quot;);
</span><span class="cx">         return nullptr;
</span><span class="cx">     }
</span><ins>+    // When an empty vector p is provided to CCRSACryptorCreateFromData to create a private key, it crashes.
+    // &lt;rdar://problem/30550228&gt; tracks the issue.
+    if (keyData.type() == CryptoKeyDataRSAComponents::Type::Private &amp;&amp; keyData.firstPrimeInfo().primeFactor.isEmpty())
+        return nullptr;
+
</ins><span class="cx">     CCRSACryptorRef cryptor;
</span><span class="cx">     // FIXME: It is so weired that we recaculate the private exponent from first prime factor and second prime factor,
</span><span class="cx">     // given the fact that we have already had it. Also, the re-caculated private exponent may not match the given one.
</span></span></pre>
</div>
</div>

</body>
</html>