<!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>[209092] 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/209092">209092</a></dd>
<dt>Author</dt> <dd>jiewen_tan@apple.com</dd>
<dt>Date</dt> <dd>2016-11-29 14:52:03 -0800 (Tue, 29 Nov 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Update SubtleCrypto::sign to match the latest spec
https://bugs.webkit.org/show_bug.cgi?id=164740
<rdar://problem/29257864>
Reviewed by Brent Fulgham.
LayoutTests/imported/w3c:
* WebCryptoAPI/idlharness-expected.txt:
Source/WebCore:
This patch does following few things:
1. It updates the SubtleCrypto::sign method to match the latest spec:
https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-sign.
It also refers to the latest Editor's Draft to a certain degree:
https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-sign.
2. It implements sign operations of the following algorithms: HMAC, and
RSASSA-PKCS1-V1_5.
3. It also replaces promise.copyRef() with WTFMove(promise) for all the
capture lists of exception callbacks in promise functions.
Tests: crypto/subtle/hmac-import-key-sign-sha1.html
crypto/subtle/hmac-import-key-sign-sha224.html
crypto/subtle/hmac-import-key-sign-sha256.html
crypto/subtle/hmac-import-key-sign-sha384.html
crypto/subtle/hmac-import-key-sign-sha512.html
crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha1.html
crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha224.html
crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha256.html
crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha384.html
crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha512.html
crypto/subtle/sign-malformed-parameters.html
crypto/workers/subtle/hmac-import-key-sign.html
crypto/workers/subtle/rsassa-pkcs1-v1_5-import-key-sign.html
* bindings/js/JSSubtleCryptoCustom.cpp:
(WebCore::normalizeCryptoAlgorithmParameters):
(WebCore::jsSubtleCryptoFunctionDecryptPromise):
Fix a minor bug.
(WebCore::jsSubtleCryptoFunctionEncryptPromise):
(WebCore::jsSubtleCryptoFunctionDecryptPromise):
(WebCore::jsSubtleCryptoFunctionSignPromise):
(WebCore::jsSubtleCryptoFunctionGenerateKeyPromise):
(WebCore::jsSubtleCryptoFunctionImportKeyPromise):
(WebCore::jsSubtleCryptoFunctionExportKeyPromise):
(WebCore::JSSubtleCrypto::sign):
* crypto/CryptoAlgorithm.cpp:
(WebCore::CryptoAlgorithm::sign):
* crypto/CryptoAlgorithm.h:
* crypto/SubtleCrypto.idl:
* crypto/algorithms/CryptoAlgorithmHMAC.cpp:
(WebCore::CryptoAlgorithmHMAC::sign):
* crypto/algorithms/CryptoAlgorithmHMAC.h:
* crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign):
* crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
* crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp:
(WebCore::CryptoAlgorithmHMAC::platformSign):
* crypto/gnutls/CryptoAlgorithmHMACGnuTLS.cpp:
(WebCore::CryptoAlgorithmHMAC::platformSign):
* crypto/gnutls/CryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLS.cpp:
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign):
* crypto/mac/CryptoAlgorithmHMACMac.cpp:
(WebCore::commonCryptoHMACAlgorithm):
(WebCore::calculateSignature):
Remove a null guardance since the depending bug is resolved.
(WebCore::CryptoAlgorithmHMAC::platformSign):
(WebCore::CryptoAlgorithmHMAC::platformVerify):
* crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
(WebCore::signRSASSA_PKCS1_v1_5):
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign):
LayoutTests:
* crypto/subtle/hmac-import-key-sign-sha1-expected.txt: Added.
* crypto/subtle/hmac-import-key-sign-sha1.html: Added.
* crypto/subtle/hmac-import-key-sign-sha224-expected.txt: Added.
* crypto/subtle/hmac-import-key-sign-sha224.html: Added.
* crypto/subtle/hmac-import-key-sign-sha256-expected.txt: Added.
* crypto/subtle/hmac-import-key-sign-sha256.html: Added.
* crypto/subtle/hmac-import-key-sign-sha384-expected.txt: Added.
* crypto/subtle/hmac-import-key-sign-sha384.html: Added.
* crypto/subtle/hmac-import-key-sign-sha512-expected.txt: Added.
* crypto/subtle/hmac-import-key-sign-sha512.html: Added.
* crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha1-expected.txt: Added.
* crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha1.html: Added.
* crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha224-expected.txt: Added.
* crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha224.html: Added.
* crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha256-expected.txt: Added.
* crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha256.html: Added.
* crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha384-expected.txt: Added.
* crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha384.html: Added.
* crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha512-expected.txt: Added.
* crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha512.html: Added.
* crypto/subtle/sign-malformed-parameters-expected.txt: Added.
* crypto/subtle/sign-malformed-parameters.html: Added.
* crypto/workers/subtle/hmac-import-key-sign-expected.txt: Added.
* crypto/workers/subtle/hmac-import-key-sign.html: Added.
* crypto/workers/subtle/resources/hmac-import-key-sign.js: Added.
* crypto/workers/subtle/resources/rsassa-pkcs1-v1_5-import-key-sign.js: Added.
* crypto/workers/subtle/rsassa-pkcs1-v1_5-import-key-sign-expected.txt: Added.
* crypto/workers/subtle/rsassa-pkcs1-v1_5-import-key-sign.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cWebCryptoAPIidlharnessexpectedtxt">trunk/LayoutTests/imported/w3c/WebCryptoAPI/idlharness-expected.txt</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="#trunkSourceWebCorecryptoCryptoAlgorithmcpp">trunk/Source/WebCore/crypto/CryptoAlgorithm.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoCryptoAlgorithmh">trunk/Source/WebCore/crypto/CryptoAlgorithm.h</a></li>
<li><a href="#trunkSourceWebCorecryptoSubtleCryptoidl">trunk/Source/WebCore/crypto/SubtleCrypto.idl</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmHMACcpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmHMACh">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.h</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmRSASSA_PKCS1_v1_5cpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmRSASSA_PKCS1_v1_5h">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h</a></li>
<li><a href="#trunkSourceWebCorecryptogcryptCryptoAlgorithmHMACGCryptcpp">trunk/Source/WebCore/crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptognutlsCryptoAlgorithmHMACGnuTLScpp">trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmHMACGnuTLS.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptognutlsCryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLScpp">trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLS.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptomacCryptoAlgorithmHMACMaccpp">trunk/Source/WebCore/crypto/mac/CryptoAlgorithmHMACMac.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptomacCryptoAlgorithmRSASSA_PKCS1_v1_5Maccpp">trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestscryptosubtlehmacimportkeysignsha1expectedtxt">trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha1-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlehmacimportkeysignsha1html">trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha1.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtlehmacimportkeysignsha224expectedtxt">trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha224-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlehmacimportkeysignsha224html">trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha224.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtlehmacimportkeysignsha256expectedtxt">trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha256-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlehmacimportkeysignsha256html">trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha256.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtlehmacimportkeysignsha384expectedtxt">trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha384-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlehmacimportkeysignsha384html">trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha384.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtlehmacimportkeysignsha512expectedtxt">trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha512-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlehmacimportkeysignsha512html">trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha512.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersassapkcs1v1_5importkeysignsha1expectedtxt">trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha1-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersassapkcs1v1_5importkeysignsha1html">trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha1.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersassapkcs1v1_5importkeysignsha224expectedtxt">trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha224-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersassapkcs1v1_5importkeysignsha224html">trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha224.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersassapkcs1v1_5importkeysignsha256expectedtxt">trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha256-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersassapkcs1v1_5importkeysignsha256html">trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha256.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersassapkcs1v1_5importkeysignsha384expectedtxt">trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha384-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersassapkcs1v1_5importkeysignsha384html">trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha384.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersassapkcs1v1_5importkeysignsha512expectedtxt">trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha512-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersassapkcs1v1_5importkeysignsha512html">trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha512.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtlesignmalformedparametersexpectedtxt">trunk/LayoutTests/crypto/subtle/sign-malformed-parameters-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlesignmalformedparametershtml">trunk/LayoutTests/crypto/subtle/sign-malformed-parameters.html</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtlehmacimportkeysignexpectedtxt">trunk/LayoutTests/crypto/workers/subtle/hmac-import-key-sign-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtlehmacimportkeysignhtml">trunk/LayoutTests/crypto/workers/subtle/hmac-import-key-sign.html</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtleresourceshmacimportkeysignjs">trunk/LayoutTests/crypto/workers/subtle/resources/hmac-import-key-sign.js</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtleresourcesrsassapkcs1v1_5importkeysignjs">trunk/LayoutTests/crypto/workers/subtle/resources/rsassa-pkcs1-v1_5-import-key-sign.js</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtlersassapkcs1v1_5importkeysignexpectedtxt">trunk/LayoutTests/crypto/workers/subtle/rsassa-pkcs1-v1_5-import-key-sign-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtlersassapkcs1v1_5importkeysignhtml">trunk/LayoutTests/crypto/workers/subtle/rsassa-pkcs1-v1_5-import-key-sign.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (209091 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-11-29 22:38:26 UTC (rev 209091)
+++ trunk/LayoutTests/ChangeLog        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -1,3 +1,40 @@
</span><ins>+2016-11-22 Jiewen Tan <jiewen_tan@apple.com>
+
+ Update SubtleCrypto::sign to match the latest spec
+ https://bugs.webkit.org/show_bug.cgi?id=164740
+ <rdar://problem/29257864>
+
+ Reviewed by Brent Fulgham.
+
+ * crypto/subtle/hmac-import-key-sign-sha1-expected.txt: Added.
+ * crypto/subtle/hmac-import-key-sign-sha1.html: Added.
+ * crypto/subtle/hmac-import-key-sign-sha224-expected.txt: Added.
+ * crypto/subtle/hmac-import-key-sign-sha224.html: Added.
+ * crypto/subtle/hmac-import-key-sign-sha256-expected.txt: Added.
+ * crypto/subtle/hmac-import-key-sign-sha256.html: Added.
+ * crypto/subtle/hmac-import-key-sign-sha384-expected.txt: Added.
+ * crypto/subtle/hmac-import-key-sign-sha384.html: Added.
+ * crypto/subtle/hmac-import-key-sign-sha512-expected.txt: Added.
+ * crypto/subtle/hmac-import-key-sign-sha512.html: Added.
+ * crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha1-expected.txt: Added.
+ * crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha1.html: Added.
+ * crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha224-expected.txt: Added.
+ * crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha224.html: Added.
+ * crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha256-expected.txt: Added.
+ * crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha256.html: Added.
+ * crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha384-expected.txt: Added.
+ * crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha384.html: Added.
+ * crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha512-expected.txt: Added.
+ * crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha512.html: Added.
+ * crypto/subtle/sign-malformed-parameters-expected.txt: Added.
+ * crypto/subtle/sign-malformed-parameters.html: Added.
+ * crypto/workers/subtle/hmac-import-key-sign-expected.txt: Added.
+ * crypto/workers/subtle/hmac-import-key-sign.html: Added.
+ * crypto/workers/subtle/resources/hmac-import-key-sign.js: Added.
+ * crypto/workers/subtle/resources/rsassa-pkcs1-v1_5-import-key-sign.js: Added.
+ * crypto/workers/subtle/rsassa-pkcs1-v1_5-import-key-sign-expected.txt: Added.
+ * crypto/workers/subtle/rsassa-pkcs1-v1_5-import-key-sign.html: Added.
+
</ins><span class="cx"> 2016-11-29 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> Can't download move.simple.com direct deposit transition PDF: Non user-triggered activations of anchors that have a download attribute are ignored
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtlehmacimportkeysignsha1expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha1-expected.txt (0 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha1-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha1-expected.txt        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test signing with HMAC SHA-1 using an imported key
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS bytesToHexString(signature) is expectedSignature
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlehmacimportkeysignsha1html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha1.html (0 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha1.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha1.html        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test signing with HMAC SHA-1 using an imported key");
+
+jsTestIsAsync = true;
+
+var extractable = false;
+var text = asciiToUint8Array("Hello, World!");
+var hmacImportParams = {
+ name: "hmac",
+ hash: "sha-1",
+}
+var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
+var expectedSignature = "6e8e66ff128606f52b8c589196ef5e0f7ca04816";
+
+crypto.subtle.importKey("raw", rawKey, hmacImportParams, extractable, ["sign", "verify"]).then(function(key) {
+ return crypto.subtle.sign("hmac", key, text);
+}).then(function(result) {
+ signature = result;
+
+ shouldBe("bytesToHexString(signature)", "expectedSignature");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlehmacimportkeysignsha224expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha224-expected.txt (0 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha224-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha224-expected.txt        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test signing with HMAC SHA-224 using an imported key
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS bytesToHexString(signature) is expectedSignature
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlehmacimportkeysignsha224html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha224.html (0 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha224.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha224.html        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test signing with HMAC SHA-224 using an imported key");
+
+jsTestIsAsync = true;
+
+var extractable = false;
+var text = asciiToUint8Array("Hello, World!");
+var hmacImportParams = {
+ name: "hmac",
+ hash: "sha-224",
+}
+var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
+var expectedSignature = "70b638e082fabc3bf391a1935c4b6a74168401214f4fb5c31e0cebf4";
+
+crypto.subtle.importKey("raw", rawKey, hmacImportParams, extractable, ["sign", "verify"]).then(function(key) {
+ return crypto.subtle.sign("hmac", key, text);
+}).then(function(result) {
+ signature = result;
+
+ shouldBe("bytesToHexString(signature)", "expectedSignature");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlehmacimportkeysignsha256expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha256-expected.txt (0 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha256-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha256-expected.txt        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test signing with HMAC SHA-256 using an imported key
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS bytesToHexString(signature) is expectedSignature
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlehmacimportkeysignsha256html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha256.html (0 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha256.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha256.html        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test signing with HMAC SHA-256 using an imported key");
+
+jsTestIsAsync = true;
+
+var extractable = false;
+var text = asciiToUint8Array("Hello, World!");
+var hmacImportParams = {
+ name: "hmac",
+ hash: "sha-256",
+}
+var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
+var expectedSignature = "d6b92f34723a8de7ba53dceea8c821f5d21757ddb478c27d564b356c38f583db";
+
+crypto.subtle.importKey("raw", rawKey, hmacImportParams, extractable, ["sign", "verify"]).then(function(key) {
+ return crypto.subtle.sign("hmac", key, text);
+}).then(function(result) {
+ signature = result;
+
+ shouldBe("bytesToHexString(signature)", "expectedSignature");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlehmacimportkeysignsha384expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha384-expected.txt (0 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha384-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha384-expected.txt        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test signing with HMAC SHA-384 using an imported key
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS bytesToHexString(signature) is expectedSignature
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlehmacimportkeysignsha384html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha384.html (0 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha384.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha384.html        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test signing with HMAC SHA-384 using an imported key");
+
+jsTestIsAsync = true;
+
+var extractable = false;
+var text = asciiToUint8Array("Hello, World!");
+var hmacImportParams = {
+ name: "hmac",
+ hash: "sha-384",
+}
+var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
+var expectedSignature = "5cfc6cba3135c99cb426d5d59bd33c5e212aac082f5ba57a1f70def2b3e987e3f3078be80f142221b6a8e23768dd994f";
+
+crypto.subtle.importKey("raw", rawKey, hmacImportParams, extractable, ["sign", "verify"]).then(function(key) {
+ return crypto.subtle.sign("hmac", key, text);
+}).then(function(result) {
+ signature = result;
+
+ shouldBe("bytesToHexString(signature)", "expectedSignature");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlehmacimportkeysignsha512expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha512-expected.txt (0 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha512-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha512-expected.txt        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test signing with HMAC SHA-512 using an imported key
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS bytesToHexString(signature) is expectedSignature
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlehmacimportkeysignsha512html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha512.html (0 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha512.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/hmac-import-key-sign-sha512.html        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test signing with HMAC SHA-512 using an imported key");
+
+jsTestIsAsync = true;
+
+var extractable = false;
+var text = asciiToUint8Array("Hello, World!");
+var hmacImportParams = {
+ name: "hmac",
+ hash: "sha-512",
+}
+var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
+var expectedSignature = "74b22e7422bd3d8562294040b8e9ff08849cf694d3f7729e02a111647b290058af5e1ca8321e5d0f512b5a55a287b39762fae85bef73611d0bddd0b3ddf252ec";
+
+crypto.subtle.importKey("raw", rawKey, hmacImportParams, extractable, ["sign", "verify"]).then(function(key) {
+ return crypto.subtle.sign("hmac", key, text);
+}).then(function(result) {
+ signature = result;
+
+ shouldBe("bytesToHexString(signature)", "expectedSignature");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersassapkcs1v1_5importkeysignsha1expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha1-expected.txt (0 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha1-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha1-expected.txt        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test signing with RSASSA-PKCS1-v1_5 SHA-1 using an imported key
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS bytesToHexString(signature) is expectedSignature
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersassapkcs1v1_5importkeysignsha1html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha1.html (0 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha1.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha1.html        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test signing with RSASSA-PKCS1-v1_5 SHA-1 using an imported key");
+
+jsTestIsAsync = true;
+
+var extractable = false;
+var text = asciiToUint8Array("Hello, World!");
+var rsaImportParams = {
+ name: "RSASSA-PKCS1-v1_5",
+ hash: "SHA-1",
+}
+var jwkKey = {
+ kty: "RSA",
+ alg: "RS1",
+ use: "sig",
+ key_ops: ["sign"],
+ ext: true,
+ n: "rcCUCv7Oc1HVam1DIhCzqknThWawOp8QLk8Ziy2p10ByjQFCajoFiyuAWl-R1WXZaf4xitLRracT9agpzIzc-MbLSHIGgWQGO21lGiImy5ftZ-D8bHAqRz2y15pzD4c4CEou7XSSLDoRnR0QG5MsDhD6s2gV9mwHkrtkCxtMWdBi-77as8wGmlNRldcOSgZDLK8UnCSgA1OguZ989bFyc8tOOEIb0xUSfPSz3LPSCnyYz68aDjmKVeNH-ig857OScyWbGyEy3Biw64qun3juUlNWsJ3zngkOdteYWytx5Qr4XKNs6R-Myyq72KUp02mJDZiiyiglxML_i3-_CeecCw",
+ e: "AQAB",
+ d: "eNLS37aCz7RXSNPD_DtLBJ6j5T8cSxdzRBCjPaI6WcGqJp16lq3UTwuoDLAqlA9oGYm238dsIWpuucP_lQtbWe-7SpxoI6_vmYGf7YVUHv1-DF9qiOmSrMmdxMnVOzYXY8RaT6thPjn_J5cfLV2xI_LwsrMtmpdSyNlgX0zTUhwtuahgAKMEChYjH2EnjHdHw6sY2-wApdcQI7ULE0oo5RzbQZpmuhcN9hiBc0L3hhF0qo50mbl02_65_GQ7DpVkXBxNgRBLzlPabmzzG2oAhfefLgYmSC1opaCkXE6vRWQNWNL45RZNZFYM3uoJghOMqGeocM0BpjdChHrPOlFvSQ",
+ p: "4miTuAjKMeH5uJ5KB397QUwhbkYEgSbcA2mifmSkvE2018gb55qkBHK1eVryf1_m43LNlc6O_ak6gfzdZIZvS5NCGjPl0q09plUpu8qFOSspBwA67qGH76lFlZLn_d4yglS7wfLru4_5Ys8qLLs-DqVLviwposOnyyWqwM5AXp0",
+ q: "xHYrzkivtmnz_sGchnWGc0q-pDOkKicptRpv2pMFIIXxnFX5aMeEXIZjVujXtwUy1UlFIN2GZJSvy5KJ79mu_XyNnFHMzedH-A3ee3u8h1UUrZF-vUu1_e4U_x67NN1dedzUSKynN7pFl3OkuShMBWGV-cwzOPdcVAfVuZlxUMc",
+ dp: "fBzDzYDUBmBQGop7Hn0dvf_T27V6RqpctWo074CQZcFbP2atFVtKSj3viWT3xid2VHzcgiDHdfpM3nEVlEO1wwIonGCSvdjGEOZiiFVOjrZAOVxA8guOjyyFvqbXke06VwPIIVvfKeSU2zuhbP__1tt6F_fxow4Kb2xonGT0GGk",
+ dq: "jmE2DiIPdhwDgLXAQpIaBqQ81bO3XfVT_LRULAwwwwlPuQV148H04zlh9TJ6Y2GZHYokV1U0eOBpJxfkb7dLYtpJpuiBjRf4yIUEoGlkkI_QlJnFSFr-YjGRdfNHqWBkxlSMZL770R9mIATndGkH7z5x-r9KwBZFC4FCG2hg_zE",
+ qi: "YCX_pLwbMBA1ThVH0WcwmnytqNcrMCEwTm7ByA2eU6nWbQrULvf7m9_kzfLUcjsnpAVlBQG5JMXMy0Sq4ptwbywsa5-G8KAOOOR2L3v4hC-Eys9ftgFM_3i0o40eeQH4b3haPbntrIeMg8IzlOuVYKf9-2QuKDoWeRdd7NsdxTk",
+};
+var expectedSignature = "08b83a4a58aff1db76529fe97f6dc2b58914a56f08ebc73aebf740680fc524e721c30842759acacab8acdf6e31e7cc83dbe8a48ace80b6a6558a9df892e4c2a9276c154cd605e632c8b857855a064aea68550b660a15044a0917026e494a71e4fee99fa57941268545f338c8601baa9c4f2116f0eb5432cfee5e3ed9978876fed201647921e599101930a99a2b645a9a879bce8c24592729f1f62a3b83fe21475871273cdbbe8efa7be314cabd087fbe1931ddf3fb86cbff5176a27554726b54c43208200725c6ad71d335ee5e09f3bbff7164ddf5bc857a41c5961e6f9581459db0fd0f09ee251d63b7a01bd716f6f72632b5c0f9a2c4dc2257d1e342138c13";
+
+crypto.subtle.importKey("jwk", jwkKey, rsaImportParams, extractable, ["sign"]).then(function(key) {
+ return crypto.subtle.sign("RSASSA-PKCS1-v1_5", key, text);
+}).then(function(result) {
+ signature = result;
+
+ shouldBe("bytesToHexString(signature)", "expectedSignature");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersassapkcs1v1_5importkeysignsha224expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha224-expected.txt (0 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha224-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha224-expected.txt        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test signing with RSASSA-PKCS1-v1_5 SHA-224 using an imported key
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS bytesToHexString(signature) is expectedSignature
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersassapkcs1v1_5importkeysignsha224html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha224.html (0 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha224.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha224.html        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test signing with RSASSA-PKCS1-v1_5 SHA-224 using an imported key");
+
+jsTestIsAsync = true;
+
+var extractable = false;
+var text = asciiToUint8Array("Hello, World!");
+var rsaImportParams = {
+ name: "RSASSA-PKCS1-v1_5",
+ hash: "SHA-224",
+}
+var jwkKey = {
+ kty: "RSA",
+ alg: "RS224",
+ use: "sig",
+ key_ops: ["sign"],
+ ext: true,
+ n: "rcCUCv7Oc1HVam1DIhCzqknThWawOp8QLk8Ziy2p10ByjQFCajoFiyuAWl-R1WXZaf4xitLRracT9agpzIzc-MbLSHIGgWQGO21lGiImy5ftZ-D8bHAqRz2y15pzD4c4CEou7XSSLDoRnR0QG5MsDhD6s2gV9mwHkrtkCxtMWdBi-77as8wGmlNRldcOSgZDLK8UnCSgA1OguZ989bFyc8tOOEIb0xUSfPSz3LPSCnyYz68aDjmKVeNH-ig857OScyWbGyEy3Biw64qun3juUlNWsJ3zngkOdteYWytx5Qr4XKNs6R-Myyq72KUp02mJDZiiyiglxML_i3-_CeecCw",
+ e: "AQAB",
+ d: "eNLS37aCz7RXSNPD_DtLBJ6j5T8cSxdzRBCjPaI6WcGqJp16lq3UTwuoDLAqlA9oGYm238dsIWpuucP_lQtbWe-7SpxoI6_vmYGf7YVUHv1-DF9qiOmSrMmdxMnVOzYXY8RaT6thPjn_J5cfLV2xI_LwsrMtmpdSyNlgX0zTUhwtuahgAKMEChYjH2EnjHdHw6sY2-wApdcQI7ULE0oo5RzbQZpmuhcN9hiBc0L3hhF0qo50mbl02_65_GQ7DpVkXBxNgRBLzlPabmzzG2oAhfefLgYmSC1opaCkXE6vRWQNWNL45RZNZFYM3uoJghOMqGeocM0BpjdChHrPOlFvSQ",
+ p: "4miTuAjKMeH5uJ5KB397QUwhbkYEgSbcA2mifmSkvE2018gb55qkBHK1eVryf1_m43LNlc6O_ak6gfzdZIZvS5NCGjPl0q09plUpu8qFOSspBwA67qGH76lFlZLn_d4yglS7wfLru4_5Ys8qLLs-DqVLviwposOnyyWqwM5AXp0",
+ q: "xHYrzkivtmnz_sGchnWGc0q-pDOkKicptRpv2pMFIIXxnFX5aMeEXIZjVujXtwUy1UlFIN2GZJSvy5KJ79mu_XyNnFHMzedH-A3ee3u8h1UUrZF-vUu1_e4U_x67NN1dedzUSKynN7pFl3OkuShMBWGV-cwzOPdcVAfVuZlxUMc",
+ dp: "fBzDzYDUBmBQGop7Hn0dvf_T27V6RqpctWo074CQZcFbP2atFVtKSj3viWT3xid2VHzcgiDHdfpM3nEVlEO1wwIonGCSvdjGEOZiiFVOjrZAOVxA8guOjyyFvqbXke06VwPIIVvfKeSU2zuhbP__1tt6F_fxow4Kb2xonGT0GGk",
+ dq: "jmE2DiIPdhwDgLXAQpIaBqQ81bO3XfVT_LRULAwwwwlPuQV148H04zlh9TJ6Y2GZHYokV1U0eOBpJxfkb7dLYtpJpuiBjRf4yIUEoGlkkI_QlJnFSFr-YjGRdfNHqWBkxlSMZL770R9mIATndGkH7z5x-r9KwBZFC4FCG2hg_zE",
+ qi: "YCX_pLwbMBA1ThVH0WcwmnytqNcrMCEwTm7ByA2eU6nWbQrULvf7m9_kzfLUcjsnpAVlBQG5JMXMy0Sq4ptwbywsa5-G8KAOOOR2L3v4hC-Eys9ftgFM_3i0o40eeQH4b3haPbntrIeMg8IzlOuVYKf9-2QuKDoWeRdd7NsdxTk",
+};
+var expectedSignature = "3cb10634bbb4022b64e0af31d0c0533837e14c8a9a4d7b9ef8c6816133843ef58603887fb05f7215bf39e803326367d95ea8894dda321b753a62dcc3214c7e85a134bf741c883f1ee0037dde6334d62b8efe54dcb59c8510e4d733b35466ad5a064686616898d73e25138cc6fd572d52df5e80f70d3d803ae9100516b4bde58cafc068c655f0cdbd2249ae61eb1a952d49df493b3c3c4a15ffb900d4f489df797498a0e7333c58cb953c2f3b169290ae7dd51e3c53bdb0bdf4311ae3fd5d7a1c3de038f696c05190db1c60056f664c6421580385b9fe54e1b2f41eef9eb83d18c6d28745d9c0eb2c15b45f5949b78762558488ae09877f4305f8c9068576e6e5";
+
+crypto.subtle.importKey("jwk", jwkKey, rsaImportParams, extractable, ["sign"]).then(function(key) {
+ return crypto.subtle.sign("RSASSA-PKCS1-v1_5", key, text);
+}).then(function(result) {
+ signature = result;
+
+ shouldBe("bytesToHexString(signature)", "expectedSignature");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersassapkcs1v1_5importkeysignsha256expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha256-expected.txt (0 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha256-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha256-expected.txt        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test signing with RSASSA-PKCS1-v1_5 SHA-256 using an imported key
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS bytesToHexString(signature) is expectedSignature
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersassapkcs1v1_5importkeysignsha256html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha256.html (0 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha256.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha256.html        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test signing with RSASSA-PKCS1-v1_5 SHA-256 using an imported key");
+
+jsTestIsAsync = true;
+
+var extractable = false;
+var text = asciiToUint8Array("Hello, World!");
+var rsaImportParams = {
+ name: "RSASSA-PKCS1-v1_5",
+ hash: "SHA-256",
+}
+var jwkKey = {
+ kty: "RSA",
+ alg: "RS256",
+ use: "sig",
+ key_ops: ["sign"],
+ ext: true,
+ n: "rcCUCv7Oc1HVam1DIhCzqknThWawOp8QLk8Ziy2p10ByjQFCajoFiyuAWl-R1WXZaf4xitLRracT9agpzIzc-MbLSHIGgWQGO21lGiImy5ftZ-D8bHAqRz2y15pzD4c4CEou7XSSLDoRnR0QG5MsDhD6s2gV9mwHkrtkCxtMWdBi-77as8wGmlNRldcOSgZDLK8UnCSgA1OguZ989bFyc8tOOEIb0xUSfPSz3LPSCnyYz68aDjmKVeNH-ig857OScyWbGyEy3Biw64qun3juUlNWsJ3zngkOdteYWytx5Qr4XKNs6R-Myyq72KUp02mJDZiiyiglxML_i3-_CeecCw",
+ e: "AQAB",
+ d: "eNLS37aCz7RXSNPD_DtLBJ6j5T8cSxdzRBCjPaI6WcGqJp16lq3UTwuoDLAqlA9oGYm238dsIWpuucP_lQtbWe-7SpxoI6_vmYGf7YVUHv1-DF9qiOmSrMmdxMnVOzYXY8RaT6thPjn_J5cfLV2xI_LwsrMtmpdSyNlgX0zTUhwtuahgAKMEChYjH2EnjHdHw6sY2-wApdcQI7ULE0oo5RzbQZpmuhcN9hiBc0L3hhF0qo50mbl02_65_GQ7DpVkXBxNgRBLzlPabmzzG2oAhfefLgYmSC1opaCkXE6vRWQNWNL45RZNZFYM3uoJghOMqGeocM0BpjdChHrPOlFvSQ",
+ p: "4miTuAjKMeH5uJ5KB397QUwhbkYEgSbcA2mifmSkvE2018gb55qkBHK1eVryf1_m43LNlc6O_ak6gfzdZIZvS5NCGjPl0q09plUpu8qFOSspBwA67qGH76lFlZLn_d4yglS7wfLru4_5Ys8qLLs-DqVLviwposOnyyWqwM5AXp0",
+ q: "xHYrzkivtmnz_sGchnWGc0q-pDOkKicptRpv2pMFIIXxnFX5aMeEXIZjVujXtwUy1UlFIN2GZJSvy5KJ79mu_XyNnFHMzedH-A3ee3u8h1UUrZF-vUu1_e4U_x67NN1dedzUSKynN7pFl3OkuShMBWGV-cwzOPdcVAfVuZlxUMc",
+ dp: "fBzDzYDUBmBQGop7Hn0dvf_T27V6RqpctWo074CQZcFbP2atFVtKSj3viWT3xid2VHzcgiDHdfpM3nEVlEO1wwIonGCSvdjGEOZiiFVOjrZAOVxA8guOjyyFvqbXke06VwPIIVvfKeSU2zuhbP__1tt6F_fxow4Kb2xonGT0GGk",
+ dq: "jmE2DiIPdhwDgLXAQpIaBqQ81bO3XfVT_LRULAwwwwlPuQV148H04zlh9TJ6Y2GZHYokV1U0eOBpJxfkb7dLYtpJpuiBjRf4yIUEoGlkkI_QlJnFSFr-YjGRdfNHqWBkxlSMZL770R9mIATndGkH7z5x-r9KwBZFC4FCG2hg_zE",
+ qi: "YCX_pLwbMBA1ThVH0WcwmnytqNcrMCEwTm7ByA2eU6nWbQrULvf7m9_kzfLUcjsnpAVlBQG5JMXMy0Sq4ptwbywsa5-G8KAOOOR2L3v4hC-Eys9ftgFM_3i0o40eeQH4b3haPbntrIeMg8IzlOuVYKf9-2QuKDoWeRdd7NsdxTk",
+};
+var expectedSignature = "6dd6df5884c84e8494794f5104559fd2966b266b7d6f3f9b8080adfb36e7c63d8f9b3b1d26084028735030749e829da0d22e3ba39454c07db7c104a19b9f509f0e4c0908c16cd604b5771bdf06507dec95d6545b896f56684016777675c16d852bb6d6ff98e1dbfc27a11d06fa028d4b8c8d2ac6790406f89283674e3f3d200aa17feb4332cbd6a6dca6b73008f5996297ac572f943037950da37b25420b24c51e76918f3e4aedeb70a0d026c75f6ae20f7fa3185f34914fc0ffd682e514d84fb73c1ce33bd1c19e4ec4b96536004af0a6206d0114196863a11d0ea575e14aedaceac6e08f1d1f9e2fab1f0cd49a0c840a8c94f9c30a2483d770cb8f9867ba6d";
+
+crypto.subtle.importKey("jwk", jwkKey, rsaImportParams, extractable, ["sign"]).then(function(key) {
+ return crypto.subtle.sign("RSASSA-PKCS1-v1_5", key, text);
+}).then(function(result) {
+ signature = result;
+
+ shouldBe("bytesToHexString(signature)", "expectedSignature");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersassapkcs1v1_5importkeysignsha384expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha384-expected.txt (0 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha384-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha384-expected.txt        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test signing with RSASSA-PKCS1-v1_5 SHA-384 using an imported key
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS bytesToHexString(signature) is expectedSignature
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersassapkcs1v1_5importkeysignsha384html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha384.html (0 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha384.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha384.html        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test signing with RSASSA-PKCS1-v1_5 SHA-384 using an imported key");
+
+jsTestIsAsync = true;
+
+var extractable = false;
+var text = asciiToUint8Array("Hello, World!");
+var rsaImportParams = {
+ name: "RSASSA-PKCS1-v1_5",
+ hash: "SHA-384",
+}
+var jwkKey = {
+ kty: "RSA",
+ alg: "RS384",
+ use: "sig",
+ key_ops: ["sign"],
+ ext: true,
+ n: "rcCUCv7Oc1HVam1DIhCzqknThWawOp8QLk8Ziy2p10ByjQFCajoFiyuAWl-R1WXZaf4xitLRracT9agpzIzc-MbLSHIGgWQGO21lGiImy5ftZ-D8bHAqRz2y15pzD4c4CEou7XSSLDoRnR0QG5MsDhD6s2gV9mwHkrtkCxtMWdBi-77as8wGmlNRldcOSgZDLK8UnCSgA1OguZ989bFyc8tOOEIb0xUSfPSz3LPSCnyYz68aDjmKVeNH-ig857OScyWbGyEy3Biw64qun3juUlNWsJ3zngkOdteYWytx5Qr4XKNs6R-Myyq72KUp02mJDZiiyiglxML_i3-_CeecCw",
+ e: "AQAB",
+ d: "eNLS37aCz7RXSNPD_DtLBJ6j5T8cSxdzRBCjPaI6WcGqJp16lq3UTwuoDLAqlA9oGYm238dsIWpuucP_lQtbWe-7SpxoI6_vmYGf7YVUHv1-DF9qiOmSrMmdxMnVOzYXY8RaT6thPjn_J5cfLV2xI_LwsrMtmpdSyNlgX0zTUhwtuahgAKMEChYjH2EnjHdHw6sY2-wApdcQI7ULE0oo5RzbQZpmuhcN9hiBc0L3hhF0qo50mbl02_65_GQ7DpVkXBxNgRBLzlPabmzzG2oAhfefLgYmSC1opaCkXE6vRWQNWNL45RZNZFYM3uoJghOMqGeocM0BpjdChHrPOlFvSQ",
+ p: "4miTuAjKMeH5uJ5KB397QUwhbkYEgSbcA2mifmSkvE2018gb55qkBHK1eVryf1_m43LNlc6O_ak6gfzdZIZvS5NCGjPl0q09plUpu8qFOSspBwA67qGH76lFlZLn_d4yglS7wfLru4_5Ys8qLLs-DqVLviwposOnyyWqwM5AXp0",
+ q: "xHYrzkivtmnz_sGchnWGc0q-pDOkKicptRpv2pMFIIXxnFX5aMeEXIZjVujXtwUy1UlFIN2GZJSvy5KJ79mu_XyNnFHMzedH-A3ee3u8h1UUrZF-vUu1_e4U_x67NN1dedzUSKynN7pFl3OkuShMBWGV-cwzOPdcVAfVuZlxUMc",
+ dp: "fBzDzYDUBmBQGop7Hn0dvf_T27V6RqpctWo074CQZcFbP2atFVtKSj3viWT3xid2VHzcgiDHdfpM3nEVlEO1wwIonGCSvdjGEOZiiFVOjrZAOVxA8guOjyyFvqbXke06VwPIIVvfKeSU2zuhbP__1tt6F_fxow4Kb2xonGT0GGk",
+ dq: "jmE2DiIPdhwDgLXAQpIaBqQ81bO3XfVT_LRULAwwwwlPuQV148H04zlh9TJ6Y2GZHYokV1U0eOBpJxfkb7dLYtpJpuiBjRf4yIUEoGlkkI_QlJnFSFr-YjGRdfNHqWBkxlSMZL770R9mIATndGkH7z5x-r9KwBZFC4FCG2hg_zE",
+ qi: "YCX_pLwbMBA1ThVH0WcwmnytqNcrMCEwTm7ByA2eU6nWbQrULvf7m9_kzfLUcjsnpAVlBQG5JMXMy0Sq4ptwbywsa5-G8KAOOOR2L3v4hC-Eys9ftgFM_3i0o40eeQH4b3haPbntrIeMg8IzlOuVYKf9-2QuKDoWeRdd7NsdxTk",
+};
+var expectedSignature = "8517104ae42b39e958e01a78158f90077b7711a60634873c3ae62565900dc1c7a3e75626b30e1281fa396594bbab742a5fc3be39dee3d981b9e4e83248bf69ed3671dee86a8f03c6a9b4465bf7b3dcd1dd04c3446e77aa340f20f9bd203966dd3dec2d4d135ea1c916f218a711ccaa167332f021ed7163ba61ffed6c0c48c4097ff979eea349011febf10398c3abcec9b4540ff0767fa9a29e7b119b8fdb8eb55786d311058dc509ce58da8abf50fe0ab2f1b092a24d3f8ae2f1f533a1ef0b7e191a43bb710acb376f4f5e620ffff602d9865a93e90f5d264309559a6acd4071058abb3ce0935a06df59b6c7c273cb033bc6d6a18b32559a8d4b14da2bfa2b15";
+
+crypto.subtle.importKey("jwk", jwkKey, rsaImportParams, extractable, ["sign"]).then(function(key) {
+ return crypto.subtle.sign("RSASSA-PKCS1-v1_5", key, text);
+}).then(function(result) {
+ signature = result;
+
+ shouldBe("bytesToHexString(signature)", "expectedSignature");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersassapkcs1v1_5importkeysignsha512expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha512-expected.txt (0 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha512-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha512-expected.txt        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test signing with RSASSA-PKCS1-v1_5 SHA-512 using an imported key
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS bytesToHexString(signature) is expectedSignature
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersassapkcs1v1_5importkeysignsha512html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha512.html (0 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha512.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha512.html        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test signing with RSASSA-PKCS1-v1_5 SHA-512 using an imported key");
+
+jsTestIsAsync = true;
+
+var extractable = false;
+var text = asciiToUint8Array("Hello, World!");
+var rsaImportParams = {
+ name: "RSASSA-PKCS1-v1_5",
+ hash: "SHA-512",
+}
+var jwkKey = {
+ kty: "RSA",
+ alg: "RS512",
+ use: "sig",
+ key_ops: ["sign"],
+ ext: true,
+ n: "rcCUCv7Oc1HVam1DIhCzqknThWawOp8QLk8Ziy2p10ByjQFCajoFiyuAWl-R1WXZaf4xitLRracT9agpzIzc-MbLSHIGgWQGO21lGiImy5ftZ-D8bHAqRz2y15pzD4c4CEou7XSSLDoRnR0QG5MsDhD6s2gV9mwHkrtkCxtMWdBi-77as8wGmlNRldcOSgZDLK8UnCSgA1OguZ989bFyc8tOOEIb0xUSfPSz3LPSCnyYz68aDjmKVeNH-ig857OScyWbGyEy3Biw64qun3juUlNWsJ3zngkOdteYWytx5Qr4XKNs6R-Myyq72KUp02mJDZiiyiglxML_i3-_CeecCw",
+ e: "AQAB",
+ d: "eNLS37aCz7RXSNPD_DtLBJ6j5T8cSxdzRBCjPaI6WcGqJp16lq3UTwuoDLAqlA9oGYm238dsIWpuucP_lQtbWe-7SpxoI6_vmYGf7YVUHv1-DF9qiOmSrMmdxMnVOzYXY8RaT6thPjn_J5cfLV2xI_LwsrMtmpdSyNlgX0zTUhwtuahgAKMEChYjH2EnjHdHw6sY2-wApdcQI7ULE0oo5RzbQZpmuhcN9hiBc0L3hhF0qo50mbl02_65_GQ7DpVkXBxNgRBLzlPabmzzG2oAhfefLgYmSC1opaCkXE6vRWQNWNL45RZNZFYM3uoJghOMqGeocM0BpjdChHrPOlFvSQ",
+ p: "4miTuAjKMeH5uJ5KB397QUwhbkYEgSbcA2mifmSkvE2018gb55qkBHK1eVryf1_m43LNlc6O_ak6gfzdZIZvS5NCGjPl0q09plUpu8qFOSspBwA67qGH76lFlZLn_d4yglS7wfLru4_5Ys8qLLs-DqVLviwposOnyyWqwM5AXp0",
+ q: "xHYrzkivtmnz_sGchnWGc0q-pDOkKicptRpv2pMFIIXxnFX5aMeEXIZjVujXtwUy1UlFIN2GZJSvy5KJ79mu_XyNnFHMzedH-A3ee3u8h1UUrZF-vUu1_e4U_x67NN1dedzUSKynN7pFl3OkuShMBWGV-cwzOPdcVAfVuZlxUMc",
+ dp: "fBzDzYDUBmBQGop7Hn0dvf_T27V6RqpctWo074CQZcFbP2atFVtKSj3viWT3xid2VHzcgiDHdfpM3nEVlEO1wwIonGCSvdjGEOZiiFVOjrZAOVxA8guOjyyFvqbXke06VwPIIVvfKeSU2zuhbP__1tt6F_fxow4Kb2xonGT0GGk",
+ dq: "jmE2DiIPdhwDgLXAQpIaBqQ81bO3XfVT_LRULAwwwwlPuQV148H04zlh9TJ6Y2GZHYokV1U0eOBpJxfkb7dLYtpJpuiBjRf4yIUEoGlkkI_QlJnFSFr-YjGRdfNHqWBkxlSMZL770R9mIATndGkH7z5x-r9KwBZFC4FCG2hg_zE",
+ qi: "YCX_pLwbMBA1ThVH0WcwmnytqNcrMCEwTm7ByA2eU6nWbQrULvf7m9_kzfLUcjsnpAVlBQG5JMXMy0Sq4ptwbywsa5-G8KAOOOR2L3v4hC-Eys9ftgFM_3i0o40eeQH4b3haPbntrIeMg8IzlOuVYKf9-2QuKDoWeRdd7NsdxTk",
+};
+var expectedSignature = "04dfcced9635d2208ea05c73ce76745678db57b7575a7ffa9770615a9ef9c68455bb49e9c70a99d053eb91c9dd2ecf09dba2a1334325318a2e75b78f4c4eb63c0d05a2a9418d6aefc5cb97ffbfb8cd06b39f8adaa545ea6b95e09934b0e2ef8e05734dcb1f1a72877f891637a99cd80b2f8a5ad419aebe18fa354bff95141b207f986e60ae16f192011b7f9c97137820a7af77be59d771ad35f51a895a2c5e0aafc96ba8f1f2dfcfbe5257b7b603d37e25670996c6c05f3db940c973f561bac8582659701fad4b4c84faa56af2dfeab450c40714f46bdd1bc6e24a3efc10bf3767ad452a79fb7de5fff282b2302e3f3f98bfdbb4037780e793343358b51cead1";
+
+crypto.subtle.importKey("jwk", jwkKey, rsaImportParams, extractable, ["sign"]).then(function(key) {
+ return crypto.subtle.sign("RSASSA-PKCS1-v1_5", key, text);
+}).then(function(result) {
+ signature = result;
+
+ shouldBe("bytesToHexString(signature)", "expectedSignature");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlesignmalformedparametersexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/sign-malformed-parameters-expected.txt (0 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/sign-malformed-parameters-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/sign-malformed-parameters-expected.txt        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+Test signing with malformed parameters
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS crypto.subtle.sign() rejected promise with TypeError: Not enough arguments.
+PASS crypto.subtle.sign(1) rejected promise with TypeError: Not enough arguments.
+PASS crypto.subtle.sign(1, 2) rejected promise with TypeError: Not enough arguments.
+PASS crypto.subtle.sign("rsassa-pkcs1-v1_5", wrongKey, text) rejected promise with InvalidAccessError (DOM Exception 15): CryptoKey doesn't match AlgorithmIdentifier.
+PASS crypto.subtle.sign("hmac", wrongKey, text) rejected promise with InvalidAccessError (DOM Exception 15): CryptoKey doesn't support signing.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlesignmalformedparametershtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/sign-malformed-parameters.html (0 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/sign-malformed-parameters.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/sign-malformed-parameters.html        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test signing with malformed parameters");
+
+jsTestIsAsync = true;
+
+var extractable = false;
+var text = asciiToUint8Array("Hello, World!");
+var hmacImportParams = {
+ name: "hmac",
+ hash: "sha-1",
+}
+var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
+
+// Not enough arguments.
+shouldReject('crypto.subtle.sign()');
+shouldReject('crypto.subtle.sign(1)');
+shouldReject('crypto.subtle.sign(1, 2)');
+
+crypto.subtle.importKey("raw", rawKey, hmacImportParams, extractable, ["sign", "verify"]).then(function(result) {
+ wrongKey = result;
+ // Wrong algorithm identifier.
+ shouldReject('crypto.subtle.sign("rsassa-pkcs1-v1_5", wrongKey, text)');
+
+ return crypto.subtle.importKey("raw", rawKey, hmacImportParams, extractable, ["verify"]);
+}).then(function(result) {
+ wrongKey = result;
+ // Wrong usage.
+ return shouldReject('crypto.subtle.sign("hmac", wrongKey, text)');
+}).then(finishJSTest);
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtlehmacimportkeysignexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/hmac-import-key-sign-expected.txt (0 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/hmac-import-key-sign-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/hmac-import-key-sign-expected.txt        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+[Worker] Test signing with HMAC SHA-1 using an imported key in workers
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Starting worker: resources/hmac-import-key-sign.js
+PASS [Worker] bytesToHexString(signature) is expectedSignature
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtlehmacimportkeysignhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/hmac-import-key-sign.html (0 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/hmac-import-key-sign.html         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/hmac-import-key-sign.html        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+ <script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+ <script>
+ worker = startWorker('resources/hmac-import-key-sign.js');
+ </script>
+ <script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtleresourceshmacimportkeysignjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/resources/hmac-import-key-sign.js (0 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/resources/hmac-import-key-sign.js         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/resources/hmac-import-key-sign.js        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+importScripts('../../../../resources/js-test-pre.js');
+importScripts('../../../resources/common.js');
+
+description("Test signing with HMAC SHA-1 using an imported key in workers");
+
+jsTestIsAsync = true;
+
+var extractable = false;
+var text = asciiToUint8Array("Hello, World!");
+var hmacImportParams = {
+ name: "hmac",
+ hash: "sha-1",
+}
+var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
+var expectedSignature = "6e8e66ff128606f52b8c589196ef5e0f7ca04816";
+
+crypto.subtle.importKey("raw", rawKey, hmacImportParams, extractable, ["sign", "verify"]).then(function(key) {
+ return crypto.subtle.sign("hmac", key, text);
+}).then(function(result) {
+ signature = result;
+
+ shouldBe("bytesToHexString(signature)", "expectedSignature");
+
+ finishJSTest();
+});
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtleresourcesrsassapkcs1v1_5importkeysignjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/resources/rsassa-pkcs1-v1_5-import-key-sign.js (0 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/resources/rsassa-pkcs1-v1_5-import-key-sign.js         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/resources/rsassa-pkcs1-v1_5-import-key-sign.js        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+importScripts('../../../../resources/js-test-pre.js');
+importScripts('../../../resources/common.js');
+
+description("Test signing with RSASSA-PKCS1-v1_5 SHA-1 using an imported key in workers");
+
+jsTestIsAsync = true;
+
+var extractable = false;
+var text = asciiToUint8Array("Hello, World!");
+var rsaImportParams = {
+ name: "RSASSA-PKCS1-v1_5",
+ hash: "SHA-1",
+}
+var jwkKey = {
+ kty: "RSA",
+ alg: "RS1",
+ use: "sig",
+ key_ops: ["sign"],
+ ext: true,
+ n: "rcCUCv7Oc1HVam1DIhCzqknThWawOp8QLk8Ziy2p10ByjQFCajoFiyuAWl-R1WXZaf4xitLRracT9agpzIzc-MbLSHIGgWQGO21lGiImy5ftZ-D8bHAqRz2y15pzD4c4CEou7XSSLDoRnR0QG5MsDhD6s2gV9mwHkrtkCxtMWdBi-77as8wGmlNRldcOSgZDLK8UnCSgA1OguZ989bFyc8tOOEIb0xUSfPSz3LPSCnyYz68aDjmKVeNH-ig857OScyWbGyEy3Biw64qun3juUlNWsJ3zngkOdteYWytx5Qr4XKNs6R-Myyq72KUp02mJDZiiyiglxML_i3-_CeecCw",
+ e: "AQAB",
+ d: "eNLS37aCz7RXSNPD_DtLBJ6j5T8cSxdzRBCjPaI6WcGqJp16lq3UTwuoDLAqlA9oGYm238dsIWpuucP_lQtbWe-7SpxoI6_vmYGf7YVUHv1-DF9qiOmSrMmdxMnVOzYXY8RaT6thPjn_J5cfLV2xI_LwsrMtmpdSyNlgX0zTUhwtuahgAKMEChYjH2EnjHdHw6sY2-wApdcQI7ULE0oo5RzbQZpmuhcN9hiBc0L3hhF0qo50mbl02_65_GQ7DpVkXBxNgRBLzlPabmzzG2oAhfefLgYmSC1opaCkXE6vRWQNWNL45RZNZFYM3uoJghOMqGeocM0BpjdChHrPOlFvSQ",
+ p: "4miTuAjKMeH5uJ5KB397QUwhbkYEgSbcA2mifmSkvE2018gb55qkBHK1eVryf1_m43LNlc6O_ak6gfzdZIZvS5NCGjPl0q09plUpu8qFOSspBwA67qGH76lFlZLn_d4yglS7wfLru4_5Ys8qLLs-DqVLviwposOnyyWqwM5AXp0",
+ q: "xHYrzkivtmnz_sGchnWGc0q-pDOkKicptRpv2pMFIIXxnFX5aMeEXIZjVujXtwUy1UlFIN2GZJSvy5KJ79mu_XyNnFHMzedH-A3ee3u8h1UUrZF-vUu1_e4U_x67NN1dedzUSKynN7pFl3OkuShMBWGV-cwzOPdcVAfVuZlxUMc",
+ dp: "fBzDzYDUBmBQGop7Hn0dvf_T27V6RqpctWo074CQZcFbP2atFVtKSj3viWT3xid2VHzcgiDHdfpM3nEVlEO1wwIonGCSvdjGEOZiiFVOjrZAOVxA8guOjyyFvqbXke06VwPIIVvfKeSU2zuhbP__1tt6F_fxow4Kb2xonGT0GGk",
+ dq: "jmE2DiIPdhwDgLXAQpIaBqQ81bO3XfVT_LRULAwwwwlPuQV148H04zlh9TJ6Y2GZHYokV1U0eOBpJxfkb7dLYtpJpuiBjRf4yIUEoGlkkI_QlJnFSFr-YjGRdfNHqWBkxlSMZL770R9mIATndGkH7z5x-r9KwBZFC4FCG2hg_zE",
+ qi: "YCX_pLwbMBA1ThVH0WcwmnytqNcrMCEwTm7ByA2eU6nWbQrULvf7m9_kzfLUcjsnpAVlBQG5JMXMy0Sq4ptwbywsa5-G8KAOOOR2L3v4hC-Eys9ftgFM_3i0o40eeQH4b3haPbntrIeMg8IzlOuVYKf9-2QuKDoWeRdd7NsdxTk",
+};
+var expectedSignature = "08b83a4a58aff1db76529fe97f6dc2b58914a56f08ebc73aebf740680fc524e721c30842759acacab8acdf6e31e7cc83dbe8a48ace80b6a6558a9df892e4c2a9276c154cd605e632c8b857855a064aea68550b660a15044a0917026e494a71e4fee99fa57941268545f338c8601baa9c4f2116f0eb5432cfee5e3ed9978876fed201647921e599101930a99a2b645a9a879bce8c24592729f1f62a3b83fe21475871273cdbbe8efa7be314cabd087fbe1931ddf3fb86cbff5176a27554726b54c43208200725c6ad71d335ee5e09f3bbff7164ddf5bc857a41c5961e6f9581459db0fd0f09ee251d63b7a01bd716f6f72632b5c0f9a2c4dc2257d1e342138c13";
+
+crypto.subtle.importKey("jwk", jwkKey, rsaImportParams, extractable, ["sign"]).then(function(key) {
+ return crypto.subtle.sign("RSASSA-PKCS1-v1_5", key, text);
+}).then(function(result) {
+ signature = result;
+
+ shouldBe("bytesToHexString(signature)", "expectedSignature");
+
+ finishJSTest();
+});
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtlersassapkcs1v1_5importkeysignexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/rsassa-pkcs1-v1_5-import-key-sign-expected.txt (0 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/rsassa-pkcs1-v1_5-import-key-sign-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/rsassa-pkcs1-v1_5-import-key-sign-expected.txt        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+[Worker] Test signing with RSASSA-PKCS1-v1_5 SHA-1 using an imported key in workers
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Starting worker: resources/rsassa-pkcs1-v1_5-import-key-sign.js
+PASS [Worker] bytesToHexString(signature) is expectedSignature
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtlersassapkcs1v1_5importkeysignhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/rsassa-pkcs1-v1_5-import-key-sign.html (0 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/rsassa-pkcs1-v1_5-import-key-sign.html         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/rsassa-pkcs1-v1_5-import-key-sign.html        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+ <script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+ <script>
+ worker = startWorker('resources/rsassa-pkcs1-v1_5-import-key-sign.js');
+ </script>
+ <script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (209091 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-11-29 22:38:26 UTC (rev 209091)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2016-11-22 Jiewen Tan <jiewen_tan@apple.com>
+
+ Update SubtleCrypto::sign to match the latest spec
+ https://bugs.webkit.org/show_bug.cgi?id=164740
+ <rdar://problem/29257864>
+
+ Reviewed by Brent Fulgham.
+
+ * WebCryptoAPI/idlharness-expected.txt:
+
</ins><span class="cx"> 2016-11-18 Jiewen Tan <jiewen_tan@apple.com>
</span><span class="cx">
</span><span class="cx"> Update SubtleCrypto::decrypt to match the latest spec
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cWebCryptoAPIidlharnessexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/WebCryptoAPI/idlharness-expected.txt (209091 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/WebCryptoAPI/idlharness-expected.txt        2016-11-29 22:38:26 UTC (rev 209091)
+++ trunk/LayoutTests/imported/w3c/WebCryptoAPI/idlharness-expected.txt        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -47,8 +47,8 @@
</span><span class="cx"> PASS SubtleCrypto interface: calling encrypt(AlgorithmIdentifier,CryptoKey,BufferSource) on crypto.subtle with too few arguments must throw TypeError
</span><span class="cx"> PASS SubtleCrypto interface: crypto.subtle must inherit property "decrypt" with the proper type (1)
</span><span class="cx"> PASS SubtleCrypto interface: calling decrypt(AlgorithmIdentifier,CryptoKey,BufferSource) on crypto.subtle with too few arguments must throw TypeError
</span><del>-FAIL SubtleCrypto interface: crypto.subtle must inherit property "sign" with the proper type (2) assert_inherits: property "sign" not found in prototype chain
-FAIL SubtleCrypto interface: calling sign(AlgorithmIdentifier,CryptoKey,BufferSource) on crypto.subtle with too few arguments must throw TypeError assert_inherits: property "sign" not found in prototype chain
</del><ins>+PASS SubtleCrypto interface: crypto.subtle must inherit property "sign" with the proper type (2)
+PASS SubtleCrypto interface: calling sign(AlgorithmIdentifier,CryptoKey,BufferSource) on crypto.subtle with too few arguments must throw TypeError
</ins><span class="cx"> FAIL SubtleCrypto interface: crypto.subtle must inherit property "verify" with the proper type (3) assert_inherits: property "verify" not found in prototype chain
</span><span class="cx"> FAIL SubtleCrypto interface: calling verify(AlgorithmIdentifier,CryptoKey,BufferSource,BufferSource) on crypto.subtle with too few arguments must throw TypeError assert_inherits: property "verify" not found in prototype chain
</span><span class="cx"> FAIL SubtleCrypto interface: crypto.subtle must inherit property "digest" with the proper type (4) assert_inherits: property "digest" not found in prototype chain
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (209091 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-11-29 22:38:26 UTC (rev 209091)
+++ trunk/Source/WebCore/ChangeLog        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -1,3 +1,72 @@
</span><ins>+2016-11-22 Jiewen Tan <jiewen_tan@apple.com>
+
+ Update SubtleCrypto::sign to match the latest spec
+ https://bugs.webkit.org/show_bug.cgi?id=164740
+ <rdar://problem/29257864>
+
+ Reviewed by Brent Fulgham.
+
+ This patch does following few things:
+ 1. It updates the SubtleCrypto::sign method to match the latest spec:
+ https://www.w3.org/TR/WebCryptoAPI/#SubtleCrypto-method-sign.
+ It also refers to the latest Editor's Draft to a certain degree:
+ https://w3c.github.io/webcrypto/Overview.html#SubtleCrypto-method-sign.
+ 2. It implements sign operations of the following algorithms: HMAC, and
+ RSASSA-PKCS1-V1_5.
+ 3. It also replaces promise.copyRef() with WTFMove(promise) for all the
+ capture lists of exception callbacks in promise functions.
+
+ Tests: crypto/subtle/hmac-import-key-sign-sha1.html
+ crypto/subtle/hmac-import-key-sign-sha224.html
+ crypto/subtle/hmac-import-key-sign-sha256.html
+ crypto/subtle/hmac-import-key-sign-sha384.html
+ crypto/subtle/hmac-import-key-sign-sha512.html
+ crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha1.html
+ crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha224.html
+ crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha256.html
+ crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha384.html
+ crypto/subtle/rsassa-pkcs1-v1_5-import-key-sign-sha512.html
+ crypto/subtle/sign-malformed-parameters.html
+ crypto/workers/subtle/hmac-import-key-sign.html
+ crypto/workers/subtle/rsassa-pkcs1-v1_5-import-key-sign.html
+
+ * bindings/js/JSSubtleCryptoCustom.cpp:
+ (WebCore::normalizeCryptoAlgorithmParameters):
+ (WebCore::jsSubtleCryptoFunctionDecryptPromise):
+ Fix a minor bug.
+ (WebCore::jsSubtleCryptoFunctionEncryptPromise):
+ (WebCore::jsSubtleCryptoFunctionDecryptPromise):
+ (WebCore::jsSubtleCryptoFunctionSignPromise):
+ (WebCore::jsSubtleCryptoFunctionGenerateKeyPromise):
+ (WebCore::jsSubtleCryptoFunctionImportKeyPromise):
+ (WebCore::jsSubtleCryptoFunctionExportKeyPromise):
+ (WebCore::JSSubtleCrypto::sign):
+ * crypto/CryptoAlgorithm.cpp:
+ (WebCore::CryptoAlgorithm::sign):
+ * crypto/CryptoAlgorithm.h:
+ * crypto/SubtleCrypto.idl:
+ * crypto/algorithms/CryptoAlgorithmHMAC.cpp:
+ (WebCore::CryptoAlgorithmHMAC::sign):
+ * crypto/algorithms/CryptoAlgorithmHMAC.h:
+ * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
+ (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::sign):
+ * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h:
+ * crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp:
+ (WebCore::CryptoAlgorithmHMAC::platformSign):
+ * crypto/gnutls/CryptoAlgorithmHMACGnuTLS.cpp:
+ (WebCore::CryptoAlgorithmHMAC::platformSign):
+ * crypto/gnutls/CryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLS.cpp:
+ (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign):
+ * crypto/mac/CryptoAlgorithmHMACMac.cpp:
+ (WebCore::commonCryptoHMACAlgorithm):
+ (WebCore::calculateSignature):
+ Remove a null guardance since the depending bug is resolved.
+ (WebCore::CryptoAlgorithmHMAC::platformSign):
+ (WebCore::CryptoAlgorithmHMAC::platformVerify):
+ * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
+ (WebCore::signRSASSA_PKCS1_v1_5):
+ (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign):
+
</ins><span class="cx"> 2016-11-29 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> Can't download move.simple.com direct deposit transition PDF: Non user-triggered activations of anchors that have a download attribute are ignored
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSSubtleCryptoCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp (209091 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp        2016-11-29 22:38:26 UTC (rev 209091)
+++ trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -54,6 +54,7 @@
</span><span class="cx"> enum class Operations {
</span><span class="cx"> Encrypt,
</span><span class="cx"> Decrypt,
</span><ins>+ Sign,
</ins><span class="cx"> Digest,
</span><span class="cx"> GenerateKey,
</span><span class="cx"> ImportKey,
</span><span class="lines">@@ -117,6 +118,17 @@
</span><span class="cx"> return nullptr;
</span><span class="cx"> }
</span><span class="cx"> break;
</span><ins>+ case Operations::Sign:
+ switch (*identifier) {
+ case CryptoAlgorithmIdentifier::RSASSA_PKCS1_v1_5:
+ case CryptoAlgorithmIdentifier::HMAC:
+ result = std::make_unique<CryptoAlgorithmParameters>(params);
+ break;
+ default:
+ setDOMException(&state, NOT_SUPPORTED_ERR);
+ return nullptr;
+ }
+ break;
</ins><span class="cx"> case Operations::Digest:
</span><span class="cx"> switch (*identifier) {
</span><span class="cx"> case CryptoAlgorithmIdentifier::SHA_1:
</span><span class="lines">@@ -452,7 +464,7 @@
</span><span class="cx"> fulfillPromiseWithArrayBuffer(WTFMove(capturedPromise), cipherText.data(), cipherText.size());
</span><span class="cx"> return;
</span><span class="cx"> };
</span><del>- auto exceptionCallback = [capturedPromise = promise.copyRef()](ExceptionCode ec) mutable {
</del><ins>+ auto exceptionCallback = [capturedPromise = WTFMove(promise)](ExceptionCode ec) mutable {
</ins><span class="cx"> rejectWithException(WTFMove(capturedPromise), ec);
</span><span class="cx"> };
</span><span class="cx">
</span><span class="lines">@@ -493,11 +505,11 @@
</span><span class="cx"> auto algorithm = createAlgorithm(state, key->algorithmIdentifier());
</span><span class="cx"> RETURN_IF_EXCEPTION(scope, void());
</span><span class="cx">
</span><del>- auto callback = [capturedPromise = promise.copyRef()](const Vector<uint8_t>& cipherText) mutable {
- fulfillPromiseWithArrayBuffer(WTFMove(capturedPromise), cipherText.data(), cipherText.size());
</del><ins>+ auto callback = [capturedPromise = promise.copyRef()](const Vector<uint8_t>& plainText) mutable {
+ fulfillPromiseWithArrayBuffer(WTFMove(capturedPromise), plainText.data(), plainText.size());
</ins><span class="cx"> return;
</span><span class="cx"> };
</span><del>- auto exceptionCallback = [capturedPromise = promise.copyRef()](ExceptionCode ec) mutable {
</del><ins>+ auto exceptionCallback = [capturedPromise = WTFMove(promise)](ExceptionCode ec) mutable {
</ins><span class="cx"> rejectWithException(WTFMove(capturedPromise), ec);
</span><span class="cx"> };
</span><span class="cx">
</span><span class="lines">@@ -506,6 +518,51 @@
</span><span class="cx"> algorithm->decrypt(WTFMove(params), key.releaseNonNull(), WTFMove(data), WTFMove(callback), WTFMove(exceptionCallback), *scriptExecutionContextFromExecState(&state), subtle->wrapped().workQueue());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static void jsSubtleCryptoFunctionSignPromise(ExecState& state, Ref<DeferredPromise>&& promise)
+{
+ VM& vm = state.vm();
+ auto scope = DECLARE_THROW_SCOPE(vm);
+
+ if (UNLIKELY(state.argumentCount() < 3)) {
+ promise->reject<JSValue>(createNotEnoughArgumentsError(&state));
+ return;
+ }
+
+ auto params = normalizeCryptoAlgorithmParameters(state, state.uncheckedArgument(0), Operations::Sign);
+ RETURN_IF_EXCEPTION(scope, void());
+
+ auto key = toCryptoKey(state, state.uncheckedArgument(1));
+ RETURN_IF_EXCEPTION(scope, void());
+
+ auto data = toVector(state, state.uncheckedArgument(2));
+ RETURN_IF_EXCEPTION(scope, void());
+
+ if (params->identifier != key->algorithmIdentifier()) {
+ promise->reject(INVALID_ACCESS_ERR, ASCIILiteral("CryptoKey doesn't match AlgorithmIdentifier"));
+ return;
+ }
+
+ if (!key->allows(CryptoKeyUsageSign)) {
+ promise->reject(INVALID_ACCESS_ERR, ASCIILiteral("CryptoKey doesn't support signing"));
+ return;
+ }
+
+ auto algorithm = createAlgorithm(state, key->algorithmIdentifier());
+ RETURN_IF_EXCEPTION(scope, void());
+
+ auto callback = [capturedPromise = promise.copyRef()](const Vector<uint8_t>& signature) mutable {
+ fulfillPromiseWithArrayBuffer(WTFMove(capturedPromise), signature.data(), signature.size());
+ return;
+ };
+ auto exceptionCallback = [capturedPromise = WTFMove(promise)](ExceptionCode ec) mutable {
+ rejectWithException(WTFMove(capturedPromise), ec);
+ };
+
+ JSSubtleCrypto* subtle = jsDynamicDowncast<JSSubtleCrypto*>(state.thisValue());
+ ASSERT(subtle);
+ algorithm->sign(key.releaseNonNull(), WTFMove(data), WTFMove(callback), WTFMove(exceptionCallback), *scriptExecutionContextFromExecState(&state), subtle->wrapped().workQueue());
+}
+
</ins><span class="cx"> static void jsSubtleCryptoFunctionGenerateKeyPromise(ExecState& state, Ref<DeferredPromise>&& promise)
</span><span class="cx"> {
</span><span class="cx"> VM& vm = state.vm();
</span><span class="lines">@@ -545,7 +602,7 @@
</span><span class="cx"> capturedPromise->resolve(keyPair);
</span><span class="cx"> }
</span><span class="cx"> };
</span><del>- auto exceptionCallback = [capturedPromise = promise.copyRef()](ExceptionCode ec) mutable {
</del><ins>+ auto exceptionCallback = [capturedPromise = WTFMove(promise)](ExceptionCode ec) mutable {
</ins><span class="cx"> rejectWithException(WTFMove(capturedPromise), ec);
</span><span class="cx"> };
</span><span class="cx">
</span><span class="lines">@@ -590,7 +647,7 @@
</span><span class="cx"> }
</span><span class="cx"> capturedPromise->resolve(key);
</span><span class="cx"> };
</span><del>- auto exceptionCallback = [capturedPromise = promise.copyRef()](ExceptionCode ec) mutable {
</del><ins>+ auto exceptionCallback = [capturedPromise = WTFMove(promise)](ExceptionCode ec) mutable {
</ins><span class="cx"> rejectWithException(WTFMove(capturedPromise), ec);
</span><span class="cx"> };
</span><span class="cx">
</span><span class="lines">@@ -657,7 +714,7 @@
</span><span class="cx"> }
</span><span class="cx"> ASSERT_NOT_REACHED();
</span><span class="cx"> };
</span><del>- auto exceptionCallback = [capturedPromise = promise.copyRef()](ExceptionCode ec) mutable {
</del><ins>+ auto exceptionCallback = [capturedPromise = WTFMove(promise)](ExceptionCode ec) mutable {
</ins><span class="cx"> rejectWithException(WTFMove(capturedPromise), ec);
</span><span class="cx"> };
</span><span class="cx">
</span><span class="lines">@@ -677,6 +734,11 @@
</span><span class="cx"> return callPromiseFunction<jsSubtleCryptoFunctionDecryptPromise, PromiseExecutionScope::WindowOrWorker>(state);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+JSValue JSSubtleCrypto::sign(ExecState& state)
+{
+ return callPromiseFunction<jsSubtleCryptoFunctionSignPromise, PromiseExecutionScope::WindowOrWorker>(state);
+}
+
</ins><span class="cx"> JSValue JSSubtleCrypto::generateKey(ExecState& state)
</span><span class="cx"> {
</span><span class="cx"> return callPromiseFunction<jsSubtleCryptoFunctionGenerateKeyPromise, PromiseExecutionScope::WindowOrWorker>(state);
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoCryptoAlgorithmcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/CryptoAlgorithm.cpp (209091 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/CryptoAlgorithm.cpp        2016-11-29 22:38:26 UTC (rev 209091)
+++ trunk/Source/WebCore/crypto/CryptoAlgorithm.cpp        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -42,6 +42,11 @@
</span><span class="cx"> exceptionCallback(NOT_SUPPORTED_ERR);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void CryptoAlgorithm::sign(Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&& exceptionCallback, ScriptExecutionContext&, WorkQueue&)
+{
+ exceptionCallback(NOT_SUPPORTED_ERR);
+}
+
</ins><span class="cx"> void CryptoAlgorithm::generateKey(const CryptoAlgorithmParameters&, bool, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&&, ExceptionCallback&& exceptionCallback, ScriptExecutionContext&)
</span><span class="cx"> {
</span><span class="cx"> exceptionCallback(NOT_SUPPORTED_ERR);
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoCryptoAlgorithmh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/CryptoAlgorithm.h (209091 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/CryptoAlgorithm.h        2016-11-29 22:38:26 UTC (rev 209091)
+++ trunk/Source/WebCore/crypto/CryptoAlgorithm.h        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -66,6 +66,7 @@
</span><span class="cx">
</span><span class="cx"> virtual void encrypt(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&);
</span><span class="cx"> virtual void decrypt(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&);
</span><ins>+ virtual void sign(Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&);
</ins><span class="cx"> virtual void generateKey(const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&&, ExceptionCallback&&, ScriptExecutionContext&);
</span><span class="cx"> virtual void importKey(SubtleCrypto::KeyFormat, KeyData&&, const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&);
</span><span class="cx"> virtual void exportKey(SubtleCrypto::KeyFormat, Ref<CryptoKey>&&, KeyDataCallback&&, ExceptionCallback&&);
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoSubtleCryptoidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/SubtleCrypto.idl (209091 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/SubtleCrypto.idl        2016-11-29 22:38:26 UTC (rev 209091)
+++ trunk/Source/WebCore/crypto/SubtleCrypto.idl        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> ] interface SubtleCrypto {
</span><span class="cx"> [Custom] Promise<any> encrypt(AlgorithmIdentifier algorithm, CryptoKey key, BufferSource data);
</span><span class="cx"> [Custom] Promise<any> decrypt(AlgorithmIdentifier algorithm, CryptoKey key, BufferSource data);
</span><ins>+ [Custom] Promise<any> sign(AlgorithmIdentifier algorithm, CryptoKey key, BufferSource data);
</ins><span class="cx"> // FIXME: Should this return a Promise<(CryptoKey or CryptoKeyPair)>?
</span><span class="cx"> [Custom] Promise<any> generateKey(AlgorithmIdentifier algorithm, boolean extractable, sequence<CryptoKeyUsage> keyUsages);
</span><span class="cx"> [Custom] Promise<CryptoKey> importKey(KeyFormat format, (BufferSource or JsonWebKey) keyData, AlgorithmIdentifier algorithm, boolen extractable, sequence<CryptoKeyUsage> keyUsages);
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmHMACcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.cpp (209091 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.cpp        2016-11-29 22:38:26 UTC (rev 209091)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.cpp        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -69,6 +69,11 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void CryptoAlgorithmHMAC::sign(Ref<CryptoKey>&& key, Vector<uint8_t>&& data, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+{
+ platformSign(WTFMove(key), WTFMove(data), WTFMove(callback), WTFMove(exceptionCallback), context, workQueue);
+}
+
</ins><span class="cx"> void CryptoAlgorithmHMAC::generateKey(const CryptoAlgorithmParameters& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyOrKeyPairCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext&)
</span><span class="cx"> {
</span><span class="cx"> const auto& hmacParameters = downcast<CryptoAlgorithmHmacKeyParams>(parameters);
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmHMACh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.h (209091 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.h        2016-11-29 22:38:26 UTC (rev 209091)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmHMAC.h        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx"> CryptoAlgorithmHMAC() = default;
</span><span class="cx"> CryptoAlgorithmIdentifier identifier() const final;
</span><span class="cx">
</span><ins>+ void sign(Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
</ins><span class="cx"> void generateKey(const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&&, ExceptionCallback&&, ScriptExecutionContext&) final;
</span><span class="cx"> void importKey(SubtleCrypto::KeyFormat, KeyData&&, const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final;
</span><span class="cx"> void exportKey(SubtleCrypto::KeyFormat, Ref<CryptoKey>&&, KeyDataCallback&&, ExceptionCallback&&) final;
</span><span class="lines">@@ -55,6 +56,7 @@
</span><span class="cx"> ExceptionOr<void> importKey(const CryptoAlgorithmParametersDeprecated&, const CryptoKeyData&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, VoidCallback&& failureCallback) final;
</span><span class="cx">
</span><span class="cx"> bool keyAlgorithmMatches(const CryptoAlgorithmHmacParamsDeprecated& algorithmParameters, const CryptoKey&) const;
</span><ins>+ void platformSign(Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&);
</ins><span class="cx"> ExceptionOr<void> platformSign(const CryptoAlgorithmHmacParamsDeprecated&, const CryptoKeyHMAC&, const CryptoOperationData&, VectorCallback&&, VoidCallback&& failureCallback);
</span><span class="cx"> ExceptionOr<void> platformVerify(const CryptoAlgorithmHmacParamsDeprecated&, const CryptoKeyHMAC&, const CryptoOperationData& signature, const CryptoOperationData&, BoolCallback&&, VoidCallback&& failureCallback);
</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 (209091 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp        2016-11-29 22:38:26 UTC (rev 209091)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -68,6 +68,15 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void CryptoAlgorithmRSASSA_PKCS1_v1_5::sign(Ref<CryptoKey>&& key, Vector<uint8_t>&& data, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+{
+ if (key->type() != CryptoKeyType::Private) {
+ exceptionCallback(INVALID_ACCESS_ERR);
+ return;
+ }
+ platformSign(WTFMove(key), WTFMove(data), WTFMove(callback), WTFMove(exceptionCallback), context, workQueue);
+}
+
</ins><span class="cx"> void CryptoAlgorithmRSASSA_PKCS1_v1_5::generateKey(const CryptoAlgorithmParameters& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyOrKeyPairCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context)
</span><span class="cx"> {
</span><span class="cx"> const auto& rsaParameters = downcast<CryptoAlgorithmRsaHashedKeyGenParams>(parameters);
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmRSASSA_PKCS1_v1_5h"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h (209091 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h        2016-11-29 22:38:26 UTC (rev 209091)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.h        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx"> CryptoAlgorithmRSASSA_PKCS1_v1_5() = default;
</span><span class="cx"> CryptoAlgorithmIdentifier identifier() const final;
</span><span class="cx">
</span><ins>+ void sign(Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
</ins><span class="cx"> void generateKey(const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&&, ExceptionCallback&&, ScriptExecutionContext&) final;
</span><span class="cx"> void importKey(SubtleCrypto::KeyFormat, KeyData&&, const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final;
</span><span class="cx"> void exportKey(SubtleCrypto::KeyFormat, Ref<CryptoKey>&&, KeyDataCallback&&, ExceptionCallback&&) final;
</span><span class="lines">@@ -54,6 +55,7 @@
</span><span class="cx"> ExceptionOr<void> importKey(const CryptoAlgorithmParametersDeprecated&, const CryptoKeyData&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, VoidCallback&& failureCallback) final;
</span><span class="cx">
</span><span class="cx"> bool keyAlgorithmMatches(const CryptoAlgorithmRsaSsaParamsDeprecated& algorithmParameters, const CryptoKey&) const;
</span><ins>+ void platformSign(Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&);
</ins><span class="cx"> ExceptionOr<void> platformSign(const CryptoAlgorithmRsaSsaParamsDeprecated&, const CryptoKeyRSA&, const CryptoOperationData&, VectorCallback&&, VoidCallback&& failureCallback);
</span><span class="cx"> ExceptionOr<void> platformVerify(const CryptoAlgorithmRsaSsaParamsDeprecated&, const CryptoKeyRSA&, const CryptoOperationData& signature, const CryptoOperationData&, BoolCallback&&, VoidCallback&& failureCallback);
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCorecryptogcryptCryptoAlgorithmHMACGCryptcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp (209091 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp        2016-11-29 22:38:26 UTC (rev 209091)
+++ trunk/Source/WebCore/crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #include "CryptoAlgorithmHmacParamsDeprecated.h"
</span><span class="cx"> #include "CryptoKeyHMAC.h"
</span><span class="cx"> #include "ExceptionCode.h"
</span><ins>+#include "NotImplemented.h"
</ins><span class="cx"> #include <gcrypt.h>
</span><span class="cx"> #include <wtf/CryptographicUtilities.h>
</span><span class="cx">
</span><span class="lines">@@ -96,6 +97,11 @@
</span><span class="cx"> return WTFMove(signature);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void CryptoAlgorithmHMAC::platformSign(Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&)
+{
+ notImplemented();
+}
+
</ins><span class="cx"> ExceptionOr<void> CryptoAlgorithmHMAC::platformSign(const CryptoAlgorithmHmacParamsDeprecated& parameters, const CryptoKeyHMAC& key, const CryptoOperationData& data, VectorCallback&& callback, VoidCallback&& failureCallback)
</span><span class="cx"> {
</span><span class="cx"> int algorithm = getGCryptDigestAlgorithm(parameters.hash);
</span></span></pre></div>
<a id="trunkSourceWebCorecryptognutlsCryptoAlgorithmHMACGnuTLScpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmHMACGnuTLS.cpp (209091 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmHMACGnuTLS.cpp        2016-11-29 22:38:26 UTC (rev 209091)
+++ trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmHMACGnuTLS.cpp        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include "CryptoAlgorithmHmacParamsDeprecated.h"
</span><span class="cx"> #include "CryptoKeyHMAC.h"
</span><span class="cx"> #include "ExceptionCode.h"
</span><ins>+#include "NotImplemented.h"
</ins><span class="cx"> #include <gnutls/gnutls.h>
</span><span class="cx"> #include <gnutls/crypto.h>
</span><span class="cx"> #include <wtf/CryptographicUtilities.h>
</span><span class="lines">@@ -68,6 +69,11 @@
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void CryptoAlgorithmHMAC::platformSign(Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&)
+{
+ notImplemented();
+}
+
</ins><span class="cx"> ExceptionOr<void> CryptoAlgorithmHMAC::platformSign(const CryptoAlgorithmHmacParamsDeprecated& parameters, const CryptoKeyHMAC& key, const CryptoOperationData& data, VectorCallback&& callback, VoidCallback&&)
</span><span class="cx"> {
</span><span class="cx"> gnutls_mac_algorithm_t algorithm = getGnutlsDigestAlgorithm(parameters.hash);
</span></span></pre></div>
<a id="trunkSourceWebCorecryptognutlsCryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLScpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLS.cpp (209091 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLS.cpp        2016-11-29 22:38:26 UTC (rev 209091)
+++ trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLS.cpp        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -35,6 +35,11 @@
</span><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><ins>+void CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign(Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&)
+{
+ notImplemented();
+}
+
</ins><span class="cx"> ExceptionOr<void> CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign(const CryptoAlgorithmRsaSsaParamsDeprecated&, const CryptoKeyRSA&, const CryptoOperationData&, VectorCallback&&, VoidCallback&&)
</span><span class="cx"> {
</span><span class="cx"> notImplemented();
</span></span></pre></div>
<a id="trunkSourceWebCorecryptomacCryptoAlgorithmHMACMaccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/mac/CryptoAlgorithmHMACMac.cpp (209091 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/mac/CryptoAlgorithmHMACMac.cpp        2016-11-29 22:38:26 UTC (rev 209091)
+++ trunk/Source/WebCore/crypto/mac/CryptoAlgorithmHMACMac.cpp        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include "CryptoAlgorithmHmacParamsDeprecated.h"
</span><span class="cx"> #include "CryptoKeyHMAC.h"
</span><span class="cx"> #include "ExceptionCode.h"
</span><ins>+#include "ScriptExecutionContext.h"
</ins><span class="cx"> #include <CommonCrypto/CommonHMAC.h>
</span><span class="cx"> #include <wtf/CryptographicUtilities.h>
</span><span class="cx">
</span><span class="lines">@@ -54,7 +55,9 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static Vector<uint8_t> calculateSignature(CCHmacAlgorithm algorithm, const Vector<uint8_t>& key, const CryptoOperationData& data)
</del><ins>+// FIXME: We should change data to Vector<uint8_t> type once WebKitSubtleCrypto is deprecated.
+// https://bugs.webkit.org/show_bug.cgi?id=164939
+static Vector<uint8_t> calculateSignature(CCHmacAlgorithm algorithm, const Vector<uint8_t>& key, const uint8_t* data, size_t dataLength)
</ins><span class="cx"> {
</span><span class="cx"> size_t digestLength;
</span><span class="cx"> switch (algorithm) {
</span><span class="lines">@@ -79,17 +82,40 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Vector<uint8_t> result(digestLength);
</span><del>- const void* keyData = key.data() ? key.data() : reinterpret_cast<const uint8_t*>(""); // <rdar://problem/15467425> HMAC crashes when key pointer is null.
- CCHmac(algorithm, keyData, key.size(), data.first, data.second, result.data());
</del><ins>+ CCHmac(algorithm, key.data(), key.size(), data, dataLength, result.data());
</ins><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void CryptoAlgorithmHMAC::platformSign(Ref<CryptoKey>&& key, Vector<uint8_t>&& data, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+{
+ context.ref();
+ workQueue.dispatch([key = WTFMove(key), data = WTFMove(data), callback = WTFMove(callback), exceptionCallback = WTFMove(exceptionCallback), &context]() mutable {
+ auto& hmacKey = downcast<CryptoKeyHMAC>(key.get());
+ auto algorithm = commonCryptoHMACAlgorithm(hmacKey.hashAlgorithmIdentifier());
+ if (!algorithm) {
+ // We should only dereference callbacks after being back to the Document/Worker threads.
+ context.postTask([exceptionCallback = WTFMove(exceptionCallback), callback = WTFMove(callback)](ScriptExecutionContext& context) {
+ exceptionCallback(OperationError);
+ context.deref();
+ });
+ return;
+ }
+ auto result = calculateSignature(*algorithm, hmacKey.key(), data.data(), data.size());
+ // We should only dereference callbacks after being back to the Document/Worker threads.
+ context.postTask([callback = WTFMove(callback), result = WTFMove(result), exceptionCallback = WTFMove(exceptionCallback)](ScriptExecutionContext& context) {
+ callback(result);
+ context.deref();
+ });
+ });
+
+}
+
</ins><span class="cx"> ExceptionOr<void> CryptoAlgorithmHMAC::platformSign(const CryptoAlgorithmHmacParamsDeprecated& parameters, const CryptoKeyHMAC& key, const CryptoOperationData& data, VectorCallback&& callback, VoidCallback&&)
</span><span class="cx"> {
</span><span class="cx"> auto algorithm = commonCryptoHMACAlgorithm(parameters.hash);
</span><span class="cx"> if (!algorithm)
</span><span class="cx"> return Exception { NOT_SUPPORTED_ERR };
</span><del>- callback(calculateSignature(*algorithm, key.key(), data));
</del><ins>+ callback(calculateSignature(*algorithm, key.key(), data.first, data.second));
</ins><span class="cx"> return { };
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -99,7 +125,7 @@
</span><span class="cx"> if (!algorithm)
</span><span class="cx"> return Exception { NOT_SUPPORTED_ERR };
</span><span class="cx">
</span><del>- auto signature = calculateSignature(*algorithm, key.key(), data);
</del><ins>+ auto signature = calculateSignature(*algorithm, key.key(), data.first, data.second);
</ins><span class="cx">
</span><span class="cx"> // Using a constant time comparison to prevent timing attacks.
</span><span class="cx"> bool result = signature.size() == expectedSignature.second && !constantTimeMemcmp(signature.data(), expectedSignature.first, signature.size());
</span></span></pre></div>
<a id="trunkSourceWebCorecryptomacCryptoAlgorithmRSASSA_PKCS1_v1_5Maccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp (209091 => 209092)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp        2016-11-29 22:38:26 UTC (rev 209091)
+++ trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp        2016-11-29 22:52:03 UTC (rev 209092)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #include "CryptoDigest.h"
</span><span class="cx"> #include "CryptoKeyRSA.h"
</span><span class="cx"> #include "ExceptionCode.h"
</span><ins>+#include "ScriptExecutionContext.h"
</ins><span class="cx">
</span><span class="cx"> namespace WebCore {
</span><span class="cx">
</span><span class="lines">@@ -54,35 +55,63 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-ExceptionOr<void> CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign(const CryptoAlgorithmRsaSsaParamsDeprecated& parameters, const CryptoKeyRSA& key, const CryptoOperationData& data, VectorCallback&& callback, VoidCallback&& failureCallback)
</del><ins>+// FIXME: We should change data to Vector<uint8_t> type once WebKitSubtleCrypto is deprecated.
+// https://bugs.webkit.org/show_bug.cgi?id=164939
+static ExceptionOr<Vector<uint8_t>> signRSASSA_PKCS1_v1_5(CryptoAlgorithmIdentifier hash, const PlatformRSAKey key, size_t keyLength, const uint8_t* data, size_t dataLength)
</ins><span class="cx"> {
</span><span class="cx"> CCDigestAlgorithm digestAlgorithm;
</span><del>- if (!getCommonCryptoDigestAlgorithm(parameters.hash, digestAlgorithm))
- return Exception { NOT_SUPPORTED_ERR };
</del><ins>+ if (!getCommonCryptoDigestAlgorithm(hash, digestAlgorithm))
+ return Exception { OperationError };
</ins><span class="cx">
</span><del>- auto cryptoDigestAlgorithm = WebCore::cryptoDigestAlgorithm(parameters.hash);
</del><ins>+ auto cryptoDigestAlgorithm = WebCore::cryptoDigestAlgorithm(hash);
</ins><span class="cx"> if (!cryptoDigestAlgorithm)
</span><del>- return Exception { NOT_SUPPORTED_ERR };
-
</del><ins>+ return Exception { OperationError };
</ins><span class="cx"> auto digest = CryptoDigest::create(*cryptoDigestAlgorithm);
</span><span class="cx"> if (!digest)
</span><del>- return Exception { NOT_SUPPORTED_ERR };
-
- digest->addBytes(data.first, data.second);
-
</del><ins>+ return Exception { OperationError };
+ digest->addBytes(data, dataLength);
</ins><span class="cx"> auto digestData = digest->computeHash();
</span><span class="cx">
</span><del>- Vector<uint8_t> signature(512);
</del><ins>+ Vector<uint8_t> signature(keyLength / 8); // Per https://tools.ietf.org/html/rfc3447#section-8.2.1
</ins><span class="cx"> size_t signatureSize = signature.size();
</span><span class="cx">
</span><del>- CCCryptorStatus status = CCRSACryptorSign(key.platformKey(), ccPKCS1Padding, digestData.data(), digestData.size(), digestAlgorithm, 0, signature.data(), &signatureSize);
- if (status) {
</del><ins>+ CCCryptorStatus status = CCRSACryptorSign(key, ccPKCS1Padding, digestData.data(), digestData.size(), digestAlgorithm, 0, signature.data(), &signatureSize);
+ if (status)
+ return Exception { OperationError };
+
+ return WTFMove(signature);
+}
+
+void CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign(Ref<CryptoKey>&& key, Vector<uint8_t>&& data, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+{
+ context.ref();
+ workQueue.dispatch([key = WTFMove(key), data = WTFMove(data), callback = WTFMove(callback), exceptionCallback = WTFMove(exceptionCallback), &context]() mutable {
+ auto& rsaKey = downcast<CryptoKeyRSA>(key.get());
+ auto result = signRSASSA_PKCS1_v1_5(rsaKey.hashAlgorithmIdentifier(), rsaKey.platformKey(), rsaKey.keySizeInBits(), data.data(), data.size());
+ if (result.hasException()) {
+ // We should only dereference callbacks after being back to the Document/Worker threads.
+ context.postTask([exceptionCallback = WTFMove(exceptionCallback), ec = result.releaseException().code(), callback = WTFMove(callback)](ScriptExecutionContext& context) {
+ exceptionCallback(ec);
+ context.deref();
+ });
+ return;
+ }
+ // We should only dereference callbacks after being back to the Document/Worker threads.
+ context.postTask([callback = WTFMove(callback), result = result.releaseReturnValue(), exceptionCallback = WTFMove(exceptionCallback)](ScriptExecutionContext& context) {
+ callback(result);
+ context.deref();
+ });
+ });
+}
+
+ExceptionOr<void> CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign(const CryptoAlgorithmRsaSsaParamsDeprecated& parameters, const CryptoKeyRSA& key, const CryptoOperationData& data, VectorCallback&& callback, VoidCallback&& failureCallback)
+{
+ auto result = signRSASSA_PKCS1_v1_5(parameters.hash, key.platformKey(), key.keySizeInBits(), data.first, data.second);
+ if (result.hasException()) {
</ins><span class="cx"> failureCallback();
</span><span class="cx"> return { };
</span><span class="cx"> }
</span><del>-
- signature.resize(signatureSize);
- callback(signature);
</del><ins>+ callback(result.releaseReturnValue());
</ins><span class="cx"> return { };
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>