<!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>[209633] 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/209633">209633</a></dd>
<dt>Author</dt> <dd>jiewen_tan@apple.com</dd>
<dt>Date</dt> <dd>2016-12-09 15:05:29 -0800 (Fri, 09 Dec 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>[Part 2 of 2] Add support for PKCS8 format while doing SubtleCrypto.importKey/exportKey
https://bugs.webkit.org/show_bug.cgi?id=129978
<rdar://problem/21799829>
Reviewed by Brent Fulgham.
LayoutTests/imported/w3c:
* WebCryptoAPI/encrypt_decrypt/test_rsa_oaep-expected.txt:
Source/WebCore:
This is part 2 of Bug 129978. In this patch, it adds the PKCS8 format support for
SubtleCrypto.importKey/exportKey. Currently support algorithms are RSAES-PKCS1-v1_5,
RSASSA-PKCS1-v1_5 and RSA-OAEP.
Tests: crypto/subtle/rsa-import-jwk-key-export-pkcs8-key.html
crypto/subtle/rsa-import-pkcs8-key-export-jwk-key.html
crypto/subtle/rsa-import-pkcs8-key-export-pkcs8-key.html
crypto/subtle/rsa-oaep-generate-export-key-pkcs8.html
crypto/subtle/rsa-oaep-import-pkcs8-key.html
crypto/subtle/rsaes-pkcs1-v1_5-generate-export-key-pkcs8.html
crypto/subtle/rsaes-pkcs1-v1_5-import-pkcs8-key.html
crypto/subtle/rsassa-pkcs1-v1_5-generate-export-key-pkcs8.html
crypto/subtle/rsassa-pkcs1-v1_5-import-pkcs8-key.html
crypto/workers/subtle/rsa-export-pkcs8-key.html
crypto/workers/subtle/rsa-import-pkcs8-key.html
* bindings/js/JSSubtleCryptoCustom.cpp:
(WebCore::toKeyData):
* crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):
(WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::exportKey):
* crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
(WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::exportKey):
* crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
(WebCore::CryptoAlgorithmRSA_OAEP::importKey):
(WebCore::CryptoAlgorithmRSA_OAEP::exportKey):
* crypto/gnutls/CryptoKeyRSAGnuTLS.cpp:
(WebCore::CryptoKeyRSA::importPkcs8):
(WebCore::CryptoKeyRSA::exportPkcs8):
* crypto/keys/CryptoKeyRSA.h:
* crypto/mac/CryptoKeyRSAMac.cpp:
(WebCore::CryptoKeyRSA::importSpki):
(WebCore::CryptoKeyRSA::importPkcs8):
(WebCore::CryptoKeyRSA::exportPkcs8):
LayoutTests:
* crypto/subtle/import-key-malformed-parameters-expected.txt:
* crypto/subtle/import-key-malformed-parameters.html:
* crypto/subtle/rsa-export-key-malformed-parameters-expected.txt:
* crypto/subtle/rsa-export-key-malformed-parameters.html:
* crypto/subtle/rsa-import-jwk-key-export-pkcs8-key-expected.txt: Added.
* crypto/subtle/rsa-import-jwk-key-export-pkcs8-key.html: Added.
* crypto/subtle/rsa-import-jwk-key-export-spki-key-expected.txt:
* crypto/subtle/rsa-import-jwk-key-export-spki-key.html:
* crypto/subtle/rsa-import-key-malformed-parameters-expected.txt:
* crypto/subtle/rsa-import-key-malformed-parameters.html:
* crypto/subtle/rsa-import-pkcs8-key-export-jwk-key-expected.txt: Added.
* crypto/subtle/rsa-import-pkcs8-key-export-jwk-key.html: Added.
* crypto/subtle/rsa-import-pkcs8-key-export-pkcs8-key-expected.txt: Added.
* crypto/subtle/rsa-import-pkcs8-key-export-pkcs8-key.html: Added.
* crypto/subtle/rsa-oaep-generate-export-key-pkcs8-expected.txt: Added.
* crypto/subtle/rsa-oaep-generate-export-key-pkcs8.html: Added.
* crypto/subtle/rsa-oaep-import-pkcs8-key-expected.txt: Added.
* crypto/subtle/rsa-oaep-import-pkcs8-key.html: Added.
* crypto/subtle/rsaes-pkcs1-v1_5-generate-export-key-pkcs8-expected.txt: Added.
* crypto/subtle/rsaes-pkcs1-v1_5-generate-export-key-pkcs8.html: Added.
* crypto/subtle/rsaes-pkcs1-v1_5-import-pkcs8-key-expected.txt: Added.
* crypto/subtle/rsaes-pkcs1-v1_5-import-pkcs8-key.html: Added.
* crypto/subtle/rsassa-pkcs1-v1_5-generate-export-key-pkcs8-expected.txt: Added.
* crypto/subtle/rsassa-pkcs1-v1_5-generate-export-key-pkcs8.html: Added.
* crypto/subtle/rsassa-pkcs1-v1_5-import-pkcs8-key-expected.txt: Added.
* crypto/subtle/rsassa-pkcs1-v1_5-import-pkcs8-key.html: Added.
* crypto/workers/subtle/resources/rsa-export-pkcs8-key.js: Added.
* crypto/workers/subtle/resources/rsa-import-pkcs8-key.js: Added.
* crypto/workers/subtle/rsa-export-pkcs8-key-expected.txt: Added.
* crypto/workers/subtle/rsa-export-pkcs8-key.html: Added.
* crypto/workers/subtle/rsa-import-pkcs8-key-expected.txt: Added.
* crypto/workers/subtle/rsa-import-pkcs8-key.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestscryptosubtleimportkeymalformedparametersexpectedtxt">trunk/LayoutTests/crypto/subtle/import-key-malformed-parameters-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtleimportkeymalformedparametershtml">trunk/LayoutTests/crypto/subtle/import-key-malformed-parameters.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersaexportkeymalformedparametersexpectedtxt">trunk/LayoutTests/crypto/subtle/rsa-export-key-malformed-parameters-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersaexportkeymalformedparametershtml">trunk/LayoutTests/crypto/subtle/rsa-export-key-malformed-parameters.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersaimportjwkkeyexportspkikeyexpectedtxt">trunk/LayoutTests/crypto/subtle/rsa-import-jwk-key-export-spki-key-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersaimportjwkkeyexportspkikeyhtml">trunk/LayoutTests/crypto/subtle/rsa-import-jwk-key-export-spki-key.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersaimportkeymalformedparametersexpectedtxt">trunk/LayoutTests/crypto/subtle/rsa-import-key-malformed-parameters-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersaimportkeymalformedparametershtml">trunk/LayoutTests/crypto/subtle/rsa-import-key-malformed-parameters.html</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cWebCryptoAPIencrypt_decrypttest_rsa_oaepexpectedtxt">trunk/LayoutTests/imported/w3c/WebCryptoAPI/encrypt_decrypt/test_rsa_oaep-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="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmRSAES_PKCS1_v1_5cpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmRSASSA_PKCS1_v1_5cpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmRSA_OAEPcpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptognutlsCryptoKeyRSAGnuTLScpp">trunk/Source/WebCore/crypto/gnutls/CryptoKeyRSAGnuTLS.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptokeysCryptoKeyRSAh">trunk/Source/WebCore/crypto/keys/CryptoKeyRSA.h</a></li>
<li><a href="#trunkSourceWebCorecryptomacCryptoKeyRSAMaccpp">trunk/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestscryptosubtlersaimportjwkkeyexportpkcs8keyexpectedtxt">trunk/LayoutTests/crypto/subtle/rsa-import-jwk-key-export-pkcs8-key-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersaimportjwkkeyexportpkcs8keyhtml">trunk/LayoutTests/crypto/subtle/rsa-import-jwk-key-export-pkcs8-key.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersaimportpkcs8keyexportjwkkeyexpectedtxt">trunk/LayoutTests/crypto/subtle/rsa-import-pkcs8-key-export-jwk-key-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersaimportpkcs8keyexportjwkkeyhtml">trunk/LayoutTests/crypto/subtle/rsa-import-pkcs8-key-export-jwk-key.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersaimportpkcs8keyexportpkcs8keyexpectedtxt">trunk/LayoutTests/crypto/subtle/rsa-import-pkcs8-key-export-pkcs8-key-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersaimportpkcs8keyexportpkcs8keyhtml">trunk/LayoutTests/crypto/subtle/rsa-import-pkcs8-key-export-pkcs8-key.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersaoaepgenerateexportkeypkcs8expectedtxt">trunk/LayoutTests/crypto/subtle/rsa-oaep-generate-export-key-pkcs8-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersaoaepgenerateexportkeypkcs8html">trunk/LayoutTests/crypto/subtle/rsa-oaep-generate-export-key-pkcs8.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersaoaepimportpkcs8keyexpectedtxt">trunk/LayoutTests/crypto/subtle/rsa-oaep-import-pkcs8-key-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersaoaepimportpkcs8keyhtml">trunk/LayoutTests/crypto/subtle/rsa-oaep-import-pkcs8-key.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersaespkcs1v1_5generateexportkeypkcs8expectedtxt">trunk/LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-generate-export-key-pkcs8-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersaespkcs1v1_5generateexportkeypkcs8html">trunk/LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-generate-export-key-pkcs8.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersaespkcs1v1_5importpkcs8keyexpectedtxt">trunk/LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-import-pkcs8-key-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersaespkcs1v1_5importpkcs8keyhtml">trunk/LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-import-pkcs8-key.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersassapkcs1v1_5generateexportkeypkcs8expectedtxt">trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-generate-export-key-pkcs8-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersassapkcs1v1_5generateexportkeypkcs8html">trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-generate-export-key-pkcs8.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersassapkcs1v1_5importpkcs8keyexpectedtxt">trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-pkcs8-key-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersassapkcs1v1_5importpkcs8keyhtml">trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-pkcs8-key.html</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtleresourcesrsaexportpkcs8keyjs">trunk/LayoutTests/crypto/workers/subtle/resources/rsa-export-pkcs8-key.js</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtleresourcesrsaimportpkcs8keyjs">trunk/LayoutTests/crypto/workers/subtle/resources/rsa-import-pkcs8-key.js</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtlersaexportpkcs8keyexpectedtxt">trunk/LayoutTests/crypto/workers/subtle/rsa-export-pkcs8-key-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtlersaexportpkcs8keyhtml">trunk/LayoutTests/crypto/workers/subtle/rsa-export-pkcs8-key.html</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtlersaimportpkcs8keyexpectedtxt">trunk/LayoutTests/crypto/workers/subtle/rsa-import-pkcs8-key-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtlersaimportpkcs8keyhtml">trunk/LayoutTests/crypto/workers/subtle/rsa-import-pkcs8-key.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (209632 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-12-09 22:59:52 UTC (rev 209632)
+++ trunk/LayoutTests/ChangeLog        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -1,3 +1,44 @@
</span><ins>+2016-12-06 Jiewen Tan <jiewen_tan@apple.com>
+
+ [Part 2 of 2] Add support for PKCS8 format while doing SubtleCrypto.importKey/exportKey
+ https://bugs.webkit.org/show_bug.cgi?id=129978
+ <rdar://problem/21799829>
+
+ Reviewed by Brent Fulgham.
+
+ * crypto/subtle/import-key-malformed-parameters-expected.txt:
+ * crypto/subtle/import-key-malformed-parameters.html:
+ * crypto/subtle/rsa-export-key-malformed-parameters-expected.txt:
+ * crypto/subtle/rsa-export-key-malformed-parameters.html:
+ * crypto/subtle/rsa-import-jwk-key-export-pkcs8-key-expected.txt: Added.
+ * crypto/subtle/rsa-import-jwk-key-export-pkcs8-key.html: Added.
+ * crypto/subtle/rsa-import-jwk-key-export-spki-key-expected.txt:
+ * crypto/subtle/rsa-import-jwk-key-export-spki-key.html:
+ * crypto/subtle/rsa-import-key-malformed-parameters-expected.txt:
+ * crypto/subtle/rsa-import-key-malformed-parameters.html:
+ * crypto/subtle/rsa-import-pkcs8-key-export-jwk-key-expected.txt: Added.
+ * crypto/subtle/rsa-import-pkcs8-key-export-jwk-key.html: Added.
+ * crypto/subtle/rsa-import-pkcs8-key-export-pkcs8-key-expected.txt: Added.
+ * crypto/subtle/rsa-import-pkcs8-key-export-pkcs8-key.html: Added.
+ * crypto/subtle/rsa-oaep-generate-export-key-pkcs8-expected.txt: Added.
+ * crypto/subtle/rsa-oaep-generate-export-key-pkcs8.html: Added.
+ * crypto/subtle/rsa-oaep-import-pkcs8-key-expected.txt: Added.
+ * crypto/subtle/rsa-oaep-import-pkcs8-key.html: Added.
+ * crypto/subtle/rsaes-pkcs1-v1_5-generate-export-key-pkcs8-expected.txt: Added.
+ * crypto/subtle/rsaes-pkcs1-v1_5-generate-export-key-pkcs8.html: Added.
+ * crypto/subtle/rsaes-pkcs1-v1_5-import-pkcs8-key-expected.txt: Added.
+ * crypto/subtle/rsaes-pkcs1-v1_5-import-pkcs8-key.html: Added.
+ * crypto/subtle/rsassa-pkcs1-v1_5-generate-export-key-pkcs8-expected.txt: Added.
+ * crypto/subtle/rsassa-pkcs1-v1_5-generate-export-key-pkcs8.html: Added.
+ * crypto/subtle/rsassa-pkcs1-v1_5-import-pkcs8-key-expected.txt: Added.
+ * crypto/subtle/rsassa-pkcs1-v1_5-import-pkcs8-key.html: Added.
+ * crypto/workers/subtle/resources/rsa-export-pkcs8-key.js: Added.
+ * crypto/workers/subtle/resources/rsa-import-pkcs8-key.js: Added.
+ * crypto/workers/subtle/rsa-export-pkcs8-key-expected.txt: Added.
+ * crypto/workers/subtle/rsa-export-pkcs8-key.html: Added.
+ * crypto/workers/subtle/rsa-import-pkcs8-key-expected.txt: Added.
+ * crypto/workers/subtle/rsa-import-pkcs8-key.html: Added.
+
</ins><span class="cx"> 2016-12-09 Joseph Pecoraro <pecoraro@apple.com>
</span><span class="cx">
</span><span class="cx"> Web Inspector: Some resources fetched via Fetch API do not have data
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtleimportkeymalformedparametersexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/crypto/subtle/import-key-malformed-parameters-expected.txt (209632 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/import-key-malformed-parameters-expected.txt        2016-12-09 22:59:52 UTC (rev 209632)
+++ trunk/LayoutTests/crypto/subtle/import-key-malformed-parameters-expected.txt        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -15,7 +15,6 @@
</span><span class="cx"> PASS crypto.subtle.importKey(Symbol(), rawKey, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with TypeError: Type error.
</span><span class="cx"> PASS crypto.subtle.importKey({ }, rawKey, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with TypeError: Type error.
</span><span class="cx"> PASS crypto.subtle.importKey("foo", rawKey, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with TypeError: Type error.
</span><del>-PASS crypto.subtle.importKey("pkcs8", rawKey, "rsaes-pkcs1-v1_5", extractable, ["encrypt", "decrypt"]) rejected promise with NotSupportedError (DOM Exception 9): The operation is not supported..
</del><span class="cx"> PASS crypto.subtle.importKey("raw", jwkKey, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with TypeError: Type error.
</span><span class="cx"> PASS crypto.subtle.importKey("raw", 1, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with TypeError: Type error.
</span><span class="cx"> PASS crypto.subtle.importKey("raw", true, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with TypeError: Type error.
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtleimportkeymalformedparametershtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/crypto/subtle/import-key-malformed-parameters.html (209632 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/import-key-malformed-parameters.html        2016-12-09 22:59:52 UTC (rev 209632)
+++ trunk/LayoutTests/crypto/subtle/import-key-malformed-parameters.html        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -48,8 +48,6 @@
</span><span class="cx"> shouldReject('crypto.subtle.importKey(Symbol(), rawKey, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])');
</span><span class="cx"> shouldReject('crypto.subtle.importKey({ }, rawKey, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])');
</span><span class="cx"> shouldReject('crypto.subtle.importKey("foo", rawKey, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])');
</span><del>-// Currently not support formats.
-shouldReject('crypto.subtle.importKey("pkcs8", rawKey, "rsaes-pkcs1-v1_5", extractable, ["encrypt", "decrypt"])');
</del><span class="cx"> // Wrong KeyData.
</span><span class="cx"> shouldReject('crypto.subtle.importKey("raw", jwkKey, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])');
</span><span class="cx"> shouldReject('crypto.subtle.importKey("raw", 1, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])');
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersaexportkeymalformedparametersexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/crypto/subtle/rsa-export-key-malformed-parameters-expected.txt (209632 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsa-export-key-malformed-parameters-expected.txt        2016-12-09 22:59:52 UTC (rev 209632)
+++ trunk/LayoutTests/crypto/subtle/rsa-export-key-malformed-parameters-expected.txt        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -3,7 +3,7 @@
</span><span class="cx"> On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
</span><span class="cx">
</span><span class="cx">
</span><del>-PASS crypto.subtle.exportKey("pkcs8", publicKey) rejected promise with NotSupportedError (DOM Exception 9): The algorithm is not supported.
</del><ins>+PASS crypto.subtle.exportKey("pkcs8", publicKey) rejected promise with InvalidAccessError (DOM Exception 15): The requested operation is not valid for the provided key.
</ins><span class="cx"> PASS crypto.subtle.exportKey("raw", publicKey) rejected promise with NotSupportedError (DOM Exception 9): The algorithm is not supported.
</span><span class="cx"> PASS crypto.subtle.exportKey("spki", privateKey) rejected promise with InvalidAccessError (DOM Exception 15): The requested operation is not valid for the provided key.
</span><span class="cx"> PASS successfullyParsed is true
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersaexportkeymalformedparametershtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/crypto/subtle/rsa-export-key-malformed-parameters.html (209632 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsa-export-key-malformed-parameters.html        2016-12-09 22:59:52 UTC (rev 209632)
+++ trunk/LayoutTests/crypto/subtle/rsa-export-key-malformed-parameters.html        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -26,7 +26,7 @@
</span><span class="cx"> publicKey = result.publicKey;
</span><span class="cx"> privateKey = result.privateKey;
</span><span class="cx">
</span><del>- // Currently not support format.
</del><ins>+ // Wrong key and format.
</ins><span class="cx"> return shouldReject('crypto.subtle.exportKey("pkcs8", publicKey)');
</span><span class="cx"> }).then(function() {
</span><span class="cx"> // Not support format.
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersaimportjwkkeyexportpkcs8keyexpectedtxtfromrev209632trunkLayoutTestscryptosubtlersaimportjwkkeyexportspkikeyexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/crypto/subtle/rsa-import-jwk-key-export-pkcs8-key-expected.txt (from rev 209632, trunk/LayoutTests/crypto/subtle/rsa-import-jwk-key-export-spki-key-expected.txt) (0 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsa-import-jwk-key-export-pkcs8-key-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsa-import-jwk-key-export-pkcs8-key-expected.txt        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+Test importing a JWK RSA-OAEP public key with SHA-1 and then export it in PKCS8 format
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Importing a key...
+Exporting a key...
+PASS bytesToHexString(pkcs8Key) is expectedPkcs8Key
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersaimportjwkkeyexportpkcs8keyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/rsa-import-jwk-key-export-pkcs8-key.html (0 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsa-import-jwk-key-export-pkcs8-key.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsa-import-jwk-key-export-pkcs8-key.html        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -0,0 +1,49 @@
</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 importing a JWK RSA-OAEP public key with SHA-1 and then export it in PKCS8 format");
+
+jsTestIsAsync = true;
+
+var jwkKey = {
+ kty: "RSA",
+ alg: "RSA-OAEP",
+ key_ops: ["decrypt", "unwrapKey"],
+ ext: true,
+ n: "v_dgJnIz-_l4noBUwEkMAc-TkUXOBXUb4homc5oLYbVKYee51acuc3m26xK-vPD7VMCwEt17ylKW6jiEIEG50cZxzvCnGn2AiaqzVeqmm79htT93aX74yD6lginrtSSky5pasjxLlIzvEEGCC3zuupFyxXmCztY3AXbfcTscgWgSiNrgNzuuxtG6tbigc9gEPQj8XgSecr8XXKTqVbwQwh8rOao2rHfe_IjiXwElsTaL2sl3IHIrHx6NVbj54_0HCuo5AZ4ZyJ_bkLVBFe4gO9pIlhVuAHr6adlM83-moDeowYKqU4me_2GR_JspZ3Kif-WEwSY6jJuIn7qXtD5jUw",
+ e: "AQAB",
+ d: "DxvDH4OBf-VkjuT-xpt5LHNP4_Egg-FxrlvshtCq8Ke6EPaR87TSvRfpQ5sYE_rLbSI1OWbhJU1Wv1xvWbKSk2YQ8v6RyE30XeFnd-2d60gmwoMaPN1Xazsy_4mZGYqmxbeCR-Di-fAVqKvfNlRA3cIwzEYB-5F0htL6Rwkl9zE8th1DTuBvqBLoTxYZKLnoCN8YdfTUr-CQOghMafCwi3ltAkZqxNNqP9RRSqfkNCqAKK_23jhXS9yZSes3QEO1LBxDNpdumIk4smpO_iFhxd5I68s8JCDogfNQulmErrYbAk6cAUXNMvpua9ipH-uIw8qgakzKfD6lIQmeFoM7MQ",
+ p: "7uKCNGo6nH5Kk6zz6H6n3LAkKr45IQb1CfyLi6Po-6lxHt2a5bi5CkRH7PNUz3QRYWAkYmlpfvoAqzXhOYIUewvcbzyzTUxpv-F1Xbw9KV6nc1LFe8W8733AzLtHBgjimwU9VYgsmV7DJDP7djODjskSGPC9O9rcq7jK_1atFy8",
+ q: "zbhQdf5AX_ssgZALSFhMmvR39c2XJXBLFuAF_c1EBRtch3X-_DgHiZ1srZrdIbnI7yjx7smJPg1Met1pHTgrk9jdlGwkzxFQWgo5XbhergrB7njOtWmkTUlpd01zidk0Nh138KTCchVe7h4JKy7wIomw9256B3ozh0DuP7eIrR0",
+ dp: "C5HAyJUUfZvINNq9fVcU_iUxuzg3QBg8Kd2nTH4FvJp6Ngp5hAKsQ4kHCrzGML3oUZT8bh-40kN9YM1dORHJuCPc6y4_aND4lihvLLj_JU_GQFmT4uiyu86VVdUEHZC0mNlqHQhZUJw8SzaRSSo5huLKE5clMw7ofRCYFEG4ZFU",
+ dq: "axFbpx2N6aZzUndit-Nk81z7Nk4rNUwNeLldxOtZVIMaFFKARErw-Vman3wzTQNBpd-ckxgHOul2_ZdQxuleHNPI9x-VxMORG1uo4bM8a76jkncDtn1mCueDYZlI4dzPBL8vlmpZ3UBsKOgvA2-pgYBCP3UbQ9sBCIrttPHTy60",
+ qi: "o3RcFTK_WfBFceq7ZG3u3imgQkIfRWZorEAKBffBNw0ggh7XjKKNx_dAinTmCE_UlNih-kO9UPTPEI3QyB3i_BIxcm122Ldzot-9Q7H-hsQ6p7AODSlc3xfYNQEG5PjEsDBBG_GlybmDeblhr67s2hDPEmMgAuoXNHxf4QMvmqM",
+};
+var expectedPkcs8Key = "308204bd020100300d06092a864886f70d0101010500048204a7308204a30201000282010100bff760267233fbf9789e8054c0490c01cf939145ce05751be21a26739a0b61b54a61e7b9d5a72e7379b6eb12bebcf0fb54c0b012dd7bca5296ea38842041b9d1c671cef0a71a7d8089aab355eaa69bbf61b53f77697ef8c83ea58229ebb524a4cb9a5ab23c4b948cef1041820b7ceeba9172c57982ced6370176df713b1c81681288dae0373baec6d1bab5b8a073d8043d08fc5e049e72bf175ca4ea55bc10c21f2b39aa36ac77defc88e25f0125b1368bdac97720722b1f1e8d55b8f9e3fd070aea39019e19c89fdb90b54115ee203bda4896156e007afa69d94cf37fa6a037a8c182aa53899eff6191fc9b296772a27fe584c1263a8c9b889fba97b43e63530203010001028201000f1bc31f83817fe5648ee4fec69b792c734fe3f12083e171ae5bec86d0aaf0a7ba10f691f3b4d2bd17e9439b1813facb6d22353966e1254d56bf5c6f59b292936610f2fe91c84df45de16777ed9deb4826c2831a3cdd576b3b32ff8999198aa6c5b78247e0e2f9f015a8abdf365440ddc230cc4601fb917486d2fa470925f7313cb61d434ee06fa812e84f161928b9e808df1875f4d4afe0903a084c69f0b08b796d02466ac4d36a3fd4514aa7e4342a80
28aff6de38574bdc9949eb374043b52c1c4336976e988938b26a4efe2161c5de48ebcb3c2420e881f350ba5984aeb61b024e9c0145cd32fa6e6bd8a91feb88c3caa06a4cca7c3ea521099e16833b3102818100eee282346a3a9c7e4a93acf3e87ea7dcb0242abe392106f509fc8b8ba3e8fba9711edd9ae5b8b90a4447ecf354cf74116160246269697efa00ab35e13982147b0bdc6f3cb34d4c69bfe1755dbc3d295ea77352c57bc5bcef7dc0ccbb470608e29b053d55882c995ec32433fb7633838ec91218f0bd3bdadcabb8caff56ad172f02818100cdb85075fe405ffb2c81900b48584c9af477f5cd9725704b16e005fdcd44051b5c8775fefc3807899d6cad9add21b9c8ef28f1eec9893e0d4c7add691d382b93d8dd946c24cf11505a0a395db85eae0ac1ee78ceb569a44d4969774d7389d934361d77f0a4c272155eee1e092b2ef02289b0f76e7a077a338740ee3fb788ad1d0281800b91c0c895147d9bc834dabd7d5714fe2531bb383740183c29dda74c7e05bc9a7a360a798402ac4389070abcc630bde85194fc6e1fb8d2437d60cd5d3911c9b823dceb2e3f68d0f896286f2cb8ff254fc6405993e2e8b2bbce9555d5041d90b498d96a1d0859509c3c4b3691492a3986e2ca139725330ee87d10981441b864550281806b115ba71d8de9a673527762b7e364f35cf
b364e2b354c0d78b95dc4eb5954831a145280444af0f9599a9f7c334d0341a5df9c9318073ae976fd9750c6e95e1cd3c8f71f95c4c3911b5ba8e1b33c6bbea3927703b67d660ae783619948e1dccf04bf2f966a59dd406c28e82f036fa98180423f751b43db01088aedb4f1d3cbad02818100a3745c1532bf59f04571eabb646deede29a042421f456668ac400a05f7c1370d20821ed78ca28dc7f7408a74e6084fd494d8a1fa43bd50f4cf108dd0c81de2fc1231726d76d8b773a2dfbd43b1fe86c43aa7b00e0d295cdf17d8350106e4f8c4b030411bf1a5c9b98379b961afaeecda10cf12632002ea17347c5fe1032f9aa3";
+var extractable = true;
+
+debug("Importing a key...");
+crypto.subtle.importKey("jwk", jwkKey, {name: "RSA-OAEP", hash: "sha-1"}, extractable, ["decrypt", "unwrapKey"]).then(function(cryptoKey) {
+ debug("Exporting a key...");
+ return crypto.subtle.exportKey("pkcs8", cryptoKey);
+}).then(function(result) {
+ pkcs8Key = result;
+
+ shouldBe("bytesToHexString(pkcs8Key)", "expectedPkcs8Key");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersaimportjwkkeyexportspkikeyexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/crypto/subtle/rsa-import-jwk-key-export-spki-key-expected.txt (209632 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsa-import-jwk-key-export-spki-key-expected.txt        2016-12-09 22:59:52 UTC (rev 209632)
+++ trunk/LayoutTests/crypto/subtle/rsa-import-jwk-key-export-spki-key-expected.txt        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -5,7 +5,7 @@
</span><span class="cx">
</span><span class="cx"> Importing a key...
</span><span class="cx"> Exporting a key...
</span><del>-PASS exportedSpkiKey.byteLength is 294
</del><ins>+PASS bytesToHexString(spkiKey) is expectedSpkiKey
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx">
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersaimportjwkkeyexportspkikeyhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/crypto/subtle/rsa-import-jwk-key-export-spki-key.html (209632 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsa-import-jwk-key-export-spki-key.html        2016-12-09 22:59:52 UTC (rev 209632)
+++ trunk/LayoutTests/crypto/subtle/rsa-import-jwk-key-export-spki-key.html        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -21,6 +21,7 @@
</span><span class="cx"> n: "p55Xl-DyqKL06TE8GCuXd_e-ruTqVB19iDH6DwTIknTyM0fl8EY6qsyOBNTxjpLDsOldEJ8QblG78WY7xYTZtNn-fimz5eG80bwSZ6FUO10z3ikeKzPPC7K4AA196rMoiEu2G4mSfqeg5zz6_iqHf8u_md_n8yk_iPaXJ9RVT-W4zEQQ6WSlsOtYa7blSSAlq0JYDJciNeE0RGqUU-UjcxUWIEnT2ODHGRzSfKHgc8O3fGt4dpVm0op1yItBcSAY-0_f1p_YrVDo8bsyq2uodyDGYhcuQgYJ0NjMgT_rb8rUPpR3bUitd-IZJd_NO9i_NmvbnQfgl6kfnxe_2kM4Tw",
</span><span class="cx"> e: "AQAB"
</span><span class="cx"> };
</span><ins>+var expectedSpkiKey = "30820122300d06092a864886f70d01010105000382010f003082010a0282010100a79e5797e0f2a8a2f4e9313c182b9777f7beaee4ea541d7d8831fa0f04c89274f23347e5f0463aaacc8e04d4f18e92c3b0e95d109f106e51bbf1663bc584d9b4d9fe7e29b3e5e1bcd1bc1267a1543b5d33de291e2b33cf0bb2b8000d7deab328884bb61b89927ea7a0e73cfafe2a877fcbbf99dfe7f3293f88f69727d4554fe5b8cc4410e964a5b0eb586bb6e5492025ab42580c972235e134446a9453e5237315162049d3d8e0c7191cd27ca1e073c3b77c6b78769566d28a75c88b41712018fb4fdfd69fd8ad50e8f1bb32ab6ba87720c662172e420609d0d8cc813feb6fcad43e94776d48ad77e21925dfcd3bd8bf366bdb9d07e097a91f9f17bfda43384f0203010001";
</ins><span class="cx"> var extractable = true;
</span><span class="cx">
</span><span class="cx"> debug("Importing a key...");
</span><span class="lines">@@ -28,9 +29,9 @@
</span><span class="cx"> debug("Exporting a key...");
</span><span class="cx"> return crypto.subtle.exportKey("spki", cryptoKey);
</span><span class="cx"> }).then(function(result) {
</span><del>- exportedSpkiKey = result;
</del><ins>+ spkiKey = result;
</ins><span class="cx">
</span><del>- shouldBe("exportedSpkiKey.byteLength", "294");
</del><ins>+ shouldBe("bytesToHexString(spkiKey)", "expectedSpkiKey");
</ins><span class="cx">
</span><span class="cx"> finishJSTest();
</span><span class="cx"> });
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersaimportkeymalformedparametersexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/crypto/subtle/rsa-import-key-malformed-parameters-expected.txt (209632 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsa-import-key-malformed-parameters-expected.txt        2016-12-09 22:59:52 UTC (rev 209632)
+++ trunk/LayoutTests/crypto/subtle/rsa-import-key-malformed-parameters-expected.txt        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -39,6 +39,19 @@
</span><span class="cx"> PASS crypto.subtle.importKey("spki", spkiKey, "RSAES-PKCS1-v1_5", extractable, ["decrypt"]) rejected promise with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
</span><span class="cx"> PASS crypto.subtle.importKey("spki", spkiKey, {name: "RSASSA-PKCS1-v1_5", hash: "sha-1"}, extractable, ["sign"]) rejected promise with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
</span><span class="cx"> PASS crypto.subtle.importKey("spki", spkiKey, {name: "RSA-OAEP", hash: "sha-1"}, extractable, ["decrypt", "unwrapKey"]) rejected promise with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
</span><ins>+PASS crypto.subtle.importKey("pkcs8", pkcs8Key, "RSAES-PKCS1-v1_5", extractable, ["encrypt"]) rejected promise with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
+PASS crypto.subtle.importKey("pkcs8", pkcs8Key, {name: "RSASSA-PKCS1-v1_5", hash: "sha-1"}, extractable, ["verify"]) rejected promise with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
+PASS crypto.subtle.importKey("pkcs8", pkcs8Key, {name: "RSA-OAEP", hash: "sha-1"}, extractable, ["encrypt", "wrapKey"]) rejected promise with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
+PASS crypto.subtle.importKey("spki", malformedKey0, "RSAES-PKCS1-v1_5", extractable, ["encrypt"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
+PASS crypto.subtle.importKey("spki", malformedKey1, "RSAES-PKCS1-v1_5", extractable, ["encrypt"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
+PASS crypto.subtle.importKey("spki", malformedKey2, "RSAES-PKCS1-v1_5", extractable, ["encrypt"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
+PASS crypto.subtle.importKey("spki", malformedKey4, "RSAES-PKCS1-v1_5", extractable, ["encrypt"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
+PASS crypto.subtle.importKey("spki", malformedKey6, "RSAES-PKCS1-v1_5", extractable, ["encrypt"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
+PASS crypto.subtle.importKey("pkcs8", malformedKey0, "RSAES-PKCS1-v1_5", extractable, ["decrypt"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
+PASS crypto.subtle.importKey("pkcs8", malformedKey1, "RSAES-PKCS1-v1_5", extractable, ["decrypt"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
+PASS crypto.subtle.importKey("pkcs8", malformedKey3, "RSAES-PKCS1-v1_5", extractable, ["decrypt"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
+PASS crypto.subtle.importKey("pkcs8", malformedKey5, "RSAES-PKCS1-v1_5", extractable, ["decrypt"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
+PASS crypto.subtle.importKey("pkcs8", malformedKey7, "RSAES-PKCS1-v1_5", extractable, ["decrypt"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx">
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersaimportkeymalformedparametershtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/crypto/subtle/rsa-import-key-malformed-parameters.html (209632 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsa-import-key-malformed-parameters.html        2016-12-09 22:59:52 UTC (rev 209632)
+++ trunk/LayoutTests/crypto/subtle/rsa-import-key-malformed-parameters.html        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -22,6 +22,15 @@
</span><span class="cx"> var dq = "jmE2DiIPdhwDgLXAQpIaBqQ81bO3XfVT_LRULAwwwwlPuQV148H04zlh9TJ6Y2GZHYokV1U0eOBpJxfkb7dLYtpJpuiBjRf4yIUEoGlkkI_QlJnFSFr-YjGRdfNHqWBkxlSMZL770R9mIATndGkH7z5x-r9KwBZFC4FCG2hg_zE";
</span><span class="cx"> var qi = "YCX_pLwbMBA1ThVH0WcwmnytqNcrMCEwTm7ByA2eU6nWbQrULvf7m9_kzfLUcjsnpAVlBQG5JMXMy0Sq4ptwbywsa5-G8KAOOOR2L3v4hC-Eys9ftgFM_3i0o40eeQH4b3haPbntrIeMg8IzlOuVYKf9-2QuKDoWeRdd7NsdxTk";
</span><span class="cx"> var spkiKey = hexStringToUint8Array("30820122300d06092a864886f70d01010105000382010f003082010a0282010100d61051c4920d4c7c04a33beabb2412bedc4173fdbe82c7db80f0052d00abd32e01656d2105abef4fa5417bb868bb77780c08d20cfe9e2d767ee952970941398f8bea59a966772b1d89f19693cfff5faba22ba39ef7982ac46257180d557d3cbf3f7e65dd835d1d351e679a841b904a3cf24a0323aac0bb89705777507c76f57663b6d846e995a63057ceb48053ddf9282a366d6dc6cbdceb2ebcb3b374c7dc49da160cba8a3656211b8597a39ef9b8cc44d0c5735f870679ffcb1cb9321bbfbc307844d3174ef5dc144a951071340f4d156bead21fd3d9bd4641afa5851512264b4eed228b5d6324de428b00cbb89a1a88cb138d59de0b4ad75f2196e0e7ba890203010001");
</span><ins>+var pkcs8Key = hexStringToUint8Array("308204bd020100300d06092a864886f70d0101010500048204a7308204a30201000282010100ca6ee8ec62b6a02e187b70c19ca15a13c386a470ee8816c7340a270f96f905511f93362f8f7aae3e60394dac34cb29ea5f540d6ef80b1df7155b66a2d6d6e44092bcbafbf69b061b3f4d927060c81d0fa07d22f481ff503c0581ffa444f57345204ddf0a93a225979c61aeb9686557f7632002e165430452868d010d505e3ccfed7315432a298a9b6d1a6ede98ee746c2c8bd22f5495cee563e2db24f1e33d91ced83af1baac754dba4ddba430f6cf3d4ac7edb0bf69891140854e8700056a7ef6d06ed5a605a05e74ecb3b246ce9cb310b39b00c707af3a637862e3d2914013de212ff09a36db84d99b8d610d0cfd36a4411dbf1b62e06ebff1bee50f040ca502030100010282010024706483309db925b3087d5a8cac4abfa60195963289d2b7d6f940e0c08760daa279685695583b074560eb47655570dd1c7dcfd13adb1d70bdaa6f463eaffdf455b59d5eff9c16344f67d2456256834cadd1f8b9d4b0b5aba83e275b55826d567323315401113dfd158c4bdc5a1b6c033f17a30d19a23fa3ef4e70730a157c928b1c7840a34401d19daab52cfa9b424cc8e1084254ca597304be22547b7221e875bf1fdc
a2386ba1e855d5e0bcaba03376bfd73de8513c07ab0e67cb3554dc8c8f7a67d231f99a2b653ad471ee2f8bd3b8fad51b02f807d131b6b71ab17e45a5faf161ce3b919d96b5e78e9e4e1202d6398a954def4c1980da1fcc30d56167e102818100ee24b92668d38465fdd9a2262e64be56846be561e4cfbcedc82496a3190b549636923d61c3e5a2d40cc6d2c46a3e89ac23eb44ac40c777147e3e49a80bd382bae06e284f1cc553f89d78f0c7bf20fd3a33ee598ce2caf61e3f5457cd228ff03fe009f10952206bf248e161d17950c6655af75b097bbda1b909038d4d752cd11d02818100d99cb65195a399f9a3aca1ef1593592992e7d91cc028b713ec5b661b9976fcffdb086f523f042699cb910321fe7b67a27dd4a72822e6fbb98d005280721efc32d889d431d2737c92a4f34d4885c7a9c6244e081a1264a283d07744b752a68ebb6fbff3492a039e3e3a0cc5b94537582a7d11cc6b8678e4c338671f96be029b2902818100a1a2a7509ca1c4217db4f3cbba7d827b32921134ea9add7efef36692f8f2a9ccf2e93b645a1448fa6859a2c0d1e3f489b42f8182f0ccf1d425039df6c360224139074bb0b6b47094343ddc1f97688ab7b07bbca8555eb0c242f5ba4a6f8506ea33e44b87aa087b7c0d5f7c8733325216853192c6d30818f68059bad4b20d633902818034b3bf7
402c99c80d922f614f124be735320d3742315b94119fd08bda66d2ad8cc333ec2ac8054d8ea74344e0753dbc57eb401c7b6ac3a4ab5db5e1fbd83c3908ce0d4833c74bbb6c83c247b6beaef330d97d85e7815e7460536dd6d8896cdfa9715e5d5d2570dfc041313cfcaf39c66ade3a19e68f2de7469349071f192b00102818060a8271f45161d8ecf62c3ac5f0fa8539b6d86a35123aafcc37541e2d5e5b62715777db0ef75f3cdf67506b8fcad6baed862eaf88fa1f280f42736b69a41ea7a3fea31ce62aa0563c85df1d9b02b83839c4ab9453e420c5c401cce979f6fb7b6ac12baf1e9140546eed24e92e383b8f2d37b3e4410844d235c7175112e751ee0");
+var malformedKey0 = new Uint8Array(); // empty.
+var malformedKey1 = hexStringToUint8Array("30"); // only 1 byte.
+var malformedKey2 = hexStringToUint8Array("30820122300d06092a864886f70d010101050003"); // truncated Spki key
+var malformedKey3 = hexStringToUint8Array("308204bd020100300d06092a864886f70d010101050004"); // truncated Pkcs8 key
+var malformedKey4 = hexStringToUint8Array("30820122300d06092a864886f70d01010105000382"); // truncated Spki key
+var malformedKey5 = hexStringToUint8Array("308204bd020100300d06092a864886f70d01010105000482"); // truncated Pkcs8 key
+var malformedKey6 = hexStringToUint8Array("30820122300d06092a864886f70d01010105000382010f"); // truncated Spki key
+var malformedKey7 = hexStringToUint8Array("308204bd020100300d06092a864886f70d0101010500048204a7"); // truncated Pkcs8 key
</ins><span class="cx">
</span><span class="cx"> // Jwk: Wrong usages
</span><span class="cx"> shouldReject('crypto.subtle.importKey("jwk", {kty: "RSA", n: n, e: e}, "RSAES-PKCS1-v1_5", extractable, ["decrypt"])');
</span><span class="lines">@@ -69,6 +78,21 @@
</span><span class="cx"> shouldReject('crypto.subtle.importKey("spki", spkiKey, "RSAES-PKCS1-v1_5", extractable, ["decrypt"])');
</span><span class="cx"> shouldReject('crypto.subtle.importKey("spki", spkiKey, {name: "RSASSA-PKCS1-v1_5", hash: "sha-1"}, extractable, ["sign"])');
</span><span class="cx"> shouldReject('crypto.subtle.importKey("spki", spkiKey, {name: "RSA-OAEP", hash: "sha-1"}, extractable, ["decrypt", "unwrapKey"])');
</span><ins>+// Pkcs8: Wrong usages
+shouldReject('crypto.subtle.importKey("pkcs8", pkcs8Key, "RSAES-PKCS1-v1_5", extractable, ["encrypt"])');
+shouldReject('crypto.subtle.importKey("pkcs8", pkcs8Key, {name: "RSASSA-PKCS1-v1_5", hash: "sha-1"}, extractable, ["verify"])');
+shouldReject('crypto.subtle.importKey("pkcs8", pkcs8Key, {name: "RSA-OAEP", hash: "sha-1"}, extractable, ["encrypt", "wrapKey"])');
+// Malformed Key for Spki and Pkcs8
+shouldReject('crypto.subtle.importKey("spki", malformedKey0, "RSAES-PKCS1-v1_5", extractable, ["encrypt"])');
+shouldReject('crypto.subtle.importKey("spki", malformedKey1, "RSAES-PKCS1-v1_5", extractable, ["encrypt"])');
+shouldReject('crypto.subtle.importKey("spki", malformedKey2, "RSAES-PKCS1-v1_5", extractable, ["encrypt"])');
+shouldReject('crypto.subtle.importKey("spki", malformedKey4, "RSAES-PKCS1-v1_5", extractable, ["encrypt"])');
+shouldReject('crypto.subtle.importKey("spki", malformedKey6, "RSAES-PKCS1-v1_5", extractable, ["encrypt"])');
+shouldReject('crypto.subtle.importKey("pkcs8", malformedKey0, "RSAES-PKCS1-v1_5", extractable, ["decrypt"])');
+shouldReject('crypto.subtle.importKey("pkcs8", malformedKey1, "RSAES-PKCS1-v1_5", extractable, ["decrypt"])');
+shouldReject('crypto.subtle.importKey("pkcs8", malformedKey3, "RSAES-PKCS1-v1_5", extractable, ["decrypt"])');
+shouldReject('crypto.subtle.importKey("pkcs8", malformedKey5, "RSAES-PKCS1-v1_5", extractable, ["decrypt"])');
+shouldReject('crypto.subtle.importKey("pkcs8", malformedKey7, "RSAES-PKCS1-v1_5", extractable, ["decrypt"])');
</ins><span class="cx"> </script>
</span><span class="cx">
</span><span class="cx"> <script src="../../resources/js-test-post.js"></script>
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersaimportpkcs8keyexportjwkkeyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/rsa-import-pkcs8-key-export-jwk-key-expected.txt (0 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsa-import-pkcs8-key-export-jwk-key-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsa-import-pkcs8-key-export-jwk-key-expected.txt        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -0,0 +1,23 @@
</span><ins>+Test importing a PKCS8 RSA-OAEP public key and then export it in JWK format
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Importing a key...
+Exporting a key...
+PASS exportedJwkKey.kty is jwkKey.kty
+PASS exportedJwkKey.alg is jwkKey.alg
+PASS exportedJwkKey.key_ops is jwkKey.key_ops
+PASS exportedJwkKey.ext is jwkKey.ext
+PASS exportedJwkKey.n is jwkKey.n
+PASS exportedJwkKey.e is jwkKey.e
+PASS exportedJwkKey.d is jwkKey.d
+PASS exportedJwkKey.p is jwkKey.p
+PASS exportedJwkKey.q is jwkKey.q
+PASS exportedJwkKey.dp is jwkKey.dp
+PASS exportedJwkKey.dq is jwkKey.dq
+PASS exportedJwkKey.qi is jwkKey.qi
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersaimportpkcs8keyexportjwkkeyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/rsa-import-pkcs8-key-export-jwk-key.html (0 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsa-import-pkcs8-key-export-jwk-key.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsa-import-pkcs8-key-export-jwk-key.html        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -0,0 +1,60 @@
</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 importing a PKCS8 RSA-OAEP public key and then export it in JWK format");
+
+jsTestIsAsync = true;
+
+var jwkKey = {
+ kty: "RSA",
+ alg: "RSA-OAEP",
+ key_ops: ["decrypt", "unwrapKey"],
+ ext: true,
+ n: "ym7o7GK2oC4Ye3DBnKFaE8OGpHDuiBbHNAonD5b5BVEfkzYvj3quPmA5Taw0yynqX1QNbvgLHfcVW2ai1tbkQJK8uvv2mwYbP02ScGDIHQ-gfSL0gf9QPAWB_6RE9XNFIE3fCpOiJZecYa65aGVX92MgAuFlQwRSho0BDVBePM_tcxVDKimKm20abt6Y7nRsLIvSL1SVzuVj4tsk8eM9kc7YOvG6rHVNuk3bpDD2zz1Kx-2wv2mJEUCFTocABWp-9tBu1aYFoF507LOyRs6csxCzmwDHB686Y3hi49KRQBPeIS_wmjbbhNmbjWENDP02pEEdvxti4G6_8b7lDwQMpQ",
+ e: "AQAB",
+ d: "JHBkgzCduSWzCH1ajKxKv6YBlZYyidK31vlA4MCHYNqieWhWlVg7B0Vg60dlVXDdHH3P0TrbHXC9qm9GPq_99FW1nV7_nBY0T2fSRWJWg0yt0fi51LC1q6g-J1tVgm1WcyMxVAERPf0VjEvcWhtsAz8Xow0Zoj-j705wcwoVfJKLHHhAo0QB0Z2qtSz6m0JMyOEIQlTKWXMEviJUe3Ih6HW_H9yiOGuh6FXV4LyroDN2v9c96FE8B6sOZ8s1VNyMj3pn0jH5mitlOtRx7i-L07j61RsC-AfRMba3GrF-RaX68WHOO5GdlrXnjp5OEgLWOYqVTe9MGYDaH8ww1WFn4Q",
+ p: "7iS5JmjThGX92aImLmS-VoRr5WHkz7ztyCSWoxkLVJY2kj1hw-Wi1AzG0sRqPomsI-tErEDHdxR-PkmoC9OCuuBuKE8cxVP4nXjwx78g_Toz7lmM4sr2Hj9UV80ij_A_4AnxCVIga_JI4WHReVDGZVr3Wwl7vaG5CQONTXUs0R0",
+ q: "2Zy2UZWjmfmjrKHvFZNZKZLn2RzAKLcT7FtmG5l2_P_bCG9SPwQmmcuRAyH-e2eifdSnKCLm-7mNAFKAch78MtiJ1DHSc3ySpPNNSIXHqcYkTggaEmSig9B3RLdSpo67b7_zSSoDnj46DMW5RTdYKn0RzGuGeOTDOGcflr4Cmyk",
+ dp: "oaKnUJyhxCF9tPPLun2CezKSETTqmt1-_vNmkvjyqczy6TtkWhRI-mhZosDR4_SJtC-BgvDM8dQlA532w2AiQTkHS7C2tHCUND3cH5doirewe7yoVV6wwkL1ukpvhQbqM-RLh6oIe3wNX3yHMzJSFoUxksbTCBj2gFm61LINYzk",
+ dq: "NLO_dALJnIDZIvYU8SS-c1Mg03QjFblBGf0IvaZtKtjMMz7CrIBU2Op0NE4HU9vFfrQBx7asOkq1214fvYPDkIzg1IM8dLu2yDwke2vq7zMNl9heeBXnRgU23W2Ils36lxXl1dJXDfwEExPPyvOcZq3joZ5o8t50aTSQcfGSsAE",
+ qi: "YKgnH0UWHY7PYsOsXw-oU5tthqNRI6r8w3VB4tXlticVd32w73XzzfZ1Brj8rWuu2GLq-I-h8oD0Jza2mkHqej_qMc5iqgVjyF3x2bArg4OcSrlFPkIMXEAczpefb7e2rBK68ekUBUbu0k6S44O48tN7PkQQhE0jXHF1ES51HuA",
+};
+var pkcs8Key = hexStringToUint8Array("308204bd020100300d06092a864886f70d0101010500048204a7308204a30201000282010100ca6ee8ec62b6a02e187b70c19ca15a13c386a470ee8816c7340a270f96f905511f93362f8f7aae3e60394dac34cb29ea5f540d6ef80b1df7155b66a2d6d6e44092bcbafbf69b061b3f4d927060c81d0fa07d22f481ff503c0581ffa444f57345204ddf0a93a225979c61aeb9686557f7632002e165430452868d010d505e3ccfed7315432a298a9b6d1a6ede98ee746c2c8bd22f5495cee563e2db24f1e33d91ced83af1baac754dba4ddba430f6cf3d4ac7edb0bf69891140854e8700056a7ef6d06ed5a605a05e74ecb3b246ce9cb310b39b00c707af3a637862e3d2914013de212ff09a36db84d99b8d610d0cfd36a4411dbf1b62e06ebff1bee50f040ca502030100010282010024706483309db925b3087d5a8cac4abfa60195963289d2b7d6f940e0c08760daa279685695583b074560eb47655570dd1c7dcfd13adb1d70bdaa6f463eaffdf455b59d5eff9c16344f67d2456256834cadd1f8b9d4b0b5aba83e275b55826d567323315401113dfd158c4bdc5a1b6c033f17a30d19a23fa3ef4e70730a157c928b1c7840a34401d19daab52cfa9b424cc8e1084254ca597304be22547b7221e875bf1fdca2386ba1e855
d5e0bcaba03376bfd73de8513c07ab0e67cb3554dc8c8f7a67d231f99a2b653ad471ee2f8bd3b8fad51b02f807d131b6b71ab17e45a5faf161ce3b919d96b5e78e9e4e1202d6398a954def4c1980da1fcc30d56167e102818100ee24b92668d38465fdd9a2262e64be56846be561e4cfbcedc82496a3190b549636923d61c3e5a2d40cc6d2c46a3e89ac23eb44ac40c777147e3e49a80bd382bae06e284f1cc553f89d78f0c7bf20fd3a33ee598ce2caf61e3f5457cd228ff03fe009f10952206bf248e161d17950c6655af75b097bbda1b909038d4d752cd11d02818100d99cb65195a399f9a3aca1ef1593592992e7d91cc028b713ec5b661b9976fcffdb086f523f042699cb910321fe7b67a27dd4a72822e6fbb98d005280721efc32d889d431d2737c92a4f34d4885c7a9c6244e081a1264a283d07744b752a68ebb6fbff3492a039e3e3a0cc5b94537582a7d11cc6b8678e4c338671f96be029b2902818100a1a2a7509ca1c4217db4f3cbba7d827b32921134ea9add7efef36692f8f2a9ccf2e93b645a1448fa6859a2c0d1e3f489b42f8182f0ccf1d425039df6c360224139074bb0b6b47094343ddc1f97688ab7b07bbca8555eb0c242f5ba4a6f8506ea33e44b87aa087b7c0d5f7c8733325216853192c6d30818f68059bad4b20d633902818034b3bf7402c99c80d92
2f614f124be735320d3742315b94119fd08bda66d2ad8cc333ec2ac8054d8ea74344e0753dbc57eb401c7b6ac3a4ab5db5e1fbd83c3908ce0d4833c74bbb6c83c247b6beaef330d97d85e7815e7460536dd6d8896cdfa9715e5d5d2570dfc041313cfcaf39c66ade3a19e68f2de7469349071f192b00102818060a8271f45161d8ecf62c3ac5f0fa8539b6d86a35123aafcc37541e2d5e5b62715777db0ef75f3cdf67506b8fcad6baed862eaf88fa1f280f42736b69a41ea7a3fea31ce62aa0563c85df1d9b02b83839c4ab9453e420c5c401cce979f6fb7b6ac12baf1e9140546eed24e92e383b8f2d37b3e4410844d235c7175112e751ee0");
+var extractable = true;
+
+debug("Importing a key...");
+crypto.subtle.importKey("pkcs8", pkcs8Key, {name: "RSA-OAEP", hash: "sha-1"}, extractable, ["decrypt", "unwrapKey"]).then(function(cryptoKey) {
+ debug("Exporting a key...");
+ return crypto.subtle.exportKey("jwk", cryptoKey);
+}).then(function(result) {
+ exportedJwkKey = result;
+
+ shouldBe("exportedJwkKey.kty", "jwkKey.kty");
+ shouldBe("exportedJwkKey.alg", "jwkKey.alg");
+ shouldBe("exportedJwkKey.key_ops", "jwkKey.key_ops");
+ shouldBe("exportedJwkKey.ext", "jwkKey.ext");
+ shouldBe("exportedJwkKey.n", "jwkKey.n");
+ shouldBe("exportedJwkKey.e", "jwkKey.e");
+ shouldBe("exportedJwkKey.d", "jwkKey.d");
+ shouldBe("exportedJwkKey.p", "jwkKey.p");
+ shouldBe("exportedJwkKey.q", "jwkKey.q");
+ shouldBe("exportedJwkKey.dp", "jwkKey.dp");
+ shouldBe("exportedJwkKey.dq", "jwkKey.dq");
+ shouldBe("exportedJwkKey.qi", "jwkKey.qi");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersaimportpkcs8keyexportpkcs8keyexpectedtxtfromrev209632trunkLayoutTestscryptosubtlersaimportjwkkeyexportspkikeyexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/crypto/subtle/rsa-import-pkcs8-key-export-pkcs8-key-expected.txt (from rev 209632, trunk/LayoutTests/crypto/subtle/rsa-import-jwk-key-export-spki-key-expected.txt) (0 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsa-import-pkcs8-key-export-pkcs8-key-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsa-import-pkcs8-key-export-pkcs8-key-expected.txt        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+Test importing a PKCS8 RSA-OAEP key and then export it in PKCS8 format
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Importing a key...
+PASS bytesToHexString(privateKey) is pkcs8KeyHex
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersaimportpkcs8keyexportpkcs8keyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/rsa-import-pkcs8-key-export-pkcs8-key.html (0 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsa-import-pkcs8-key-export-pkcs8-key.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsa-import-pkcs8-key-export-pkcs8-key.html        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -0,0 +1,35 @@
</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 importing a PKCS8 RSA-OAEP key and then export it in PKCS8 format");
+
+jsTestIsAsync = true;
+
+var pkcs8KeyHex = "308204bd020100300d06092a864886f70d0101010500048204a7308204a30201000282010100ca6ee8ec62b6a02e187b70c19ca15a13c386a470ee8816c7340a270f96f905511f93362f8f7aae3e60394dac34cb29ea5f540d6ef80b1df7155b66a2d6d6e44092bcbafbf69b061b3f4d927060c81d0fa07d22f481ff503c0581ffa444f57345204ddf0a93a225979c61aeb9686557f7632002e165430452868d010d505e3ccfed7315432a298a9b6d1a6ede98ee746c2c8bd22f5495cee563e2db24f1e33d91ced83af1baac754dba4ddba430f6cf3d4ac7edb0bf69891140854e8700056a7ef6d06ed5a605a05e74ecb3b246ce9cb310b39b00c707af3a637862e3d2914013de212ff09a36db84d99b8d610d0cfd36a4411dbf1b62e06ebff1bee50f040ca502030100010282010024706483309db925b3087d5a8cac4abfa60195963289d2b7d6f940e0c08760daa279685695583b074560eb47655570dd1c7dcfd13adb1d70bdaa6f463eaffdf455b59d5eff9c16344f67d2456256834cadd1f8b9d4b0b5aba83e275b55826d567323315401113dfd158c4bdc5a1b6c033f17a30d19a23fa3ef4e70730a157c928b1c7840a34401d19daab52cfa9b424cc8e1084254ca597304be22547b7221e875bf1fdca2386ba1e855d5e0bcaba03376bfd73
de8513c07ab0e67cb3554dc8c8f7a67d231f99a2b653ad471ee2f8bd3b8fad51b02f807d131b6b71ab17e45a5faf161ce3b919d96b5e78e9e4e1202d6398a954def4c1980da1fcc30d56167e102818100ee24b92668d38465fdd9a2262e64be56846be561e4cfbcedc82496a3190b549636923d61c3e5a2d40cc6d2c46a3e89ac23eb44ac40c777147e3e49a80bd382bae06e284f1cc553f89d78f0c7bf20fd3a33ee598ce2caf61e3f5457cd228ff03fe009f10952206bf248e161d17950c6655af75b097bbda1b909038d4d752cd11d02818100d99cb65195a399f9a3aca1ef1593592992e7d91cc028b713ec5b661b9976fcffdb086f523f042699cb910321fe7b67a27dd4a72822e6fbb98d005280721efc32d889d431d2737c92a4f34d4885c7a9c6244e081a1264a283d07744b752a68ebb6fbff3492a039e3e3a0cc5b94537582a7d11cc6b8678e4c338671f96be029b2902818100a1a2a7509ca1c4217db4f3cbba7d827b32921134ea9add7efef36692f8f2a9ccf2e93b645a1448fa6859a2c0d1e3f489b42f8182f0ccf1d425039df6c360224139074bb0b6b47094343ddc1f97688ab7b07bbca8555eb0c242f5ba4a6f8506ea33e44b87aa087b7c0d5f7c8733325216853192c6d30818f68059bad4b20d633902818034b3bf7402c99c80d922f614f124be735320d3
742315b94119fd08bda66d2ad8cc333ec2ac8054d8ea74344e0753dbc57eb401c7b6ac3a4ab5db5e1fbd83c3908ce0d4833c74bbb6c83c247b6beaef330d97d85e7815e7460536dd6d8896cdfa9715e5d5d2570dfc041313cfcaf39c66ade3a19e68f2de7469349071f192b00102818060a8271f45161d8ecf62c3ac5f0fa8539b6d86a35123aafcc37541e2d5e5b62715777db0ef75f3cdf67506b8fcad6baed862eaf88fa1f280f42736b69a41ea7a3fea31ce62aa0563c85df1d9b02b83839c4ab9453e420c5c401cce979f6fb7b6ac12baf1e9140546eed24e92e383b8f2d37b3e4410844d235c7175112e751ee0";
+var pkcs8Key = hexStringToUint8Array(pkcs8KeyHex);
+var extractable = true;
+
+debug("Importing a key...");
+crypto.subtle.importKey("pkcs8", pkcs8Key, {name: "RSA-OAEP", hash: "sha-1"}, extractable, ["decrypt", "unwrapKey"]).then(function(privateKey) {
+ return crypto.subtle.exportKey("pkcs8", privateKey);
+}).then(function(result) {
+ privateKey = result;
+
+ shouldBe("bytesToHexString(privateKey)", "pkcs8KeyHex");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersaoaepgenerateexportkeypkcs8expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/rsa-oaep-generate-export-key-pkcs8-expected.txt (0 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsa-oaep-generate-export-key-pkcs8-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsa-oaep-generate-export-key-pkcs8-expected.txt        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+Test exporting a RSA-OAEP private key with PKCS8 format.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Generating a key pair...
+Exporting the private key...
+PASS privateKey is an instance of ArrayBuffer
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersaoaepgenerateexportkeypkcs8htmlfromrev209632trunkLayoutTestscryptosubtlersaexportkeymalformedparametershtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/crypto/subtle/rsa-oaep-generate-export-key-pkcs8.html (from rev 209632, trunk/LayoutTests/crypto/subtle/rsa-export-key-malformed-parameters.html) (0 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsa-oaep-generate-export-key-pkcs8.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsa-oaep-generate-export-key-pkcs8.html        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -0,0 +1,42 @@
</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 exporting a RSA-OAEP private key with PKCS8 format.");
+
+jsTestIsAsync = true;
+
+var algorithmKeyGen = {
+ name: "RSA-OAEP",
+ // RsaKeyGenParams
+ modulusLength: 2048,
+ publicExponent: new Uint8Array([0x01, 0x00, 0x01]), // Equivalent to 65537
+ hash: "sha-1",
+};
+var extractable = true;
+
+var keyPair;
+debug("Generating a key pair...");
+crypto.subtle.generateKey(algorithmKeyGen, extractable, ["decrypt", "encrypt", "wrapKey", "unwrapKey"]).then(function(result) {
+ keyPair = result;
+ debug("Exporting the private key...");
+ return crypto.subtle.exportKey("pkcs8", keyPair.privateKey);
+}).then(function(result) {
+ privateKey = result;
+
+ shouldBeType("privateKey", "ArrayBuffer");
+
+ finishJSTest();
+});
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersaoaepimportpkcs8keyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/rsa-oaep-import-pkcs8-key-expected.txt (0 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsa-oaep-import-pkcs8-key-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsa-oaep-import-pkcs8-key-expected.txt        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+Test importing a PKCS8 RSA-OAEP key
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Importing a key...
+PASS privateKey.toString() is '[object CryptoKey]'
+PASS privateKey.type is 'private'
+PASS privateKey.extractable is true
+PASS privateKey.algorithm.name is 'RSA-OAEP'
+PASS privateKey.algorithm.modulusLength is 2048
+PASS bytesToHexString(privateKey.algorithm.publicExponent) is '010001'
+PASS privateKey.algorithm.hash.name is 'SHA-1'
+PASS privateKey.usages is ['decrypt', 'unwrapKey']
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersaoaepimportpkcs8keyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/rsa-oaep-import-pkcs8-key.html (0 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsa-oaep-import-pkcs8-key.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsa-oaep-import-pkcs8-key.html        2016-12-09 23:05:29 UTC (rev 209633)
</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 importing a PKCS8 RSA-OAEP key");
+
+jsTestIsAsync = true;
+
+var pkcs8Key = hexStringToUint8Array("308204bd020100300d06092a864886f70d0101010500048204a7308204a30201000282010100ca6ee8ec62b6a02e187b70c19ca15a13c386a470ee8816c7340a270f96f905511f93362f8f7aae3e60394dac34cb29ea5f540d6ef80b1df7155b66a2d6d6e44092bcbafbf69b061b3f4d927060c81d0fa07d22f481ff503c0581ffa444f57345204ddf0a93a225979c61aeb9686557f7632002e165430452868d010d505e3ccfed7315432a298a9b6d1a6ede98ee746c2c8bd22f5495cee563e2db24f1e33d91ced83af1baac754dba4ddba430f6cf3d4ac7edb0bf69891140854e8700056a7ef6d06ed5a605a05e74ecb3b246ce9cb310b39b00c707af3a637862e3d2914013de212ff09a36db84d99b8d610d0cfd36a4411dbf1b62e06ebff1bee50f040ca502030100010282010024706483309db925b3087d5a8cac4abfa60195963289d2b7d6f940e0c08760daa279685695583b074560eb47655570dd1c7dcfd13adb1d70bdaa6f463eaffdf455b59d5eff9c16344f67d2456256834cadd1f8b9d4b0b5aba83e275b55826d567323315401113dfd158c4bdc5a1b6c033f17a30d19a23fa3ef4e70730a157c928b1c7840a34401d19daab52cfa9b424cc8e1084254ca597304be22547b7221e875bf1fdca2386ba1e855
d5e0bcaba03376bfd73de8513c07ab0e67cb3554dc8c8f7a67d231f99a2b653ad471ee2f8bd3b8fad51b02f807d131b6b71ab17e45a5faf161ce3b919d96b5e78e9e4e1202d6398a954def4c1980da1fcc30d56167e102818100ee24b92668d38465fdd9a2262e64be56846be561e4cfbcedc82496a3190b549636923d61c3e5a2d40cc6d2c46a3e89ac23eb44ac40c777147e3e49a80bd382bae06e284f1cc553f89d78f0c7bf20fd3a33ee598ce2caf61e3f5457cd228ff03fe009f10952206bf248e161d17950c6655af75b097bbda1b909038d4d752cd11d02818100d99cb65195a399f9a3aca1ef1593592992e7d91cc028b713ec5b661b9976fcffdb086f523f042699cb910321fe7b67a27dd4a72822e6fbb98d005280721efc32d889d431d2737c92a4f34d4885c7a9c6244e081a1264a283d07744b752a68ebb6fbff3492a039e3e3a0cc5b94537582a7d11cc6b8678e4c338671f96be029b2902818100a1a2a7509ca1c4217db4f3cbba7d827b32921134ea9add7efef36692f8f2a9ccf2e93b645a1448fa6859a2c0d1e3f489b42f8182f0ccf1d425039df6c360224139074bb0b6b47094343ddc1f97688ab7b07bbca8555eb0c242f5ba4a6f8506ea33e44b87aa087b7c0d5f7c8733325216853192c6d30818f68059bad4b20d633902818034b3bf7402c99c80d92
2f614f124be735320d3742315b94119fd08bda66d2ad8cc333ec2ac8054d8ea74344e0753dbc57eb401c7b6ac3a4ab5db5e1fbd83c3908ce0d4833c74bbb6c83c247b6beaef330d97d85e7815e7460536dd6d8896cdfa9715e5d5d2570dfc041313cfcaf39c66ade3a19e68f2de7469349071f192b00102818060a8271f45161d8ecf62c3ac5f0fa8539b6d86a35123aafcc37541e2d5e5b62715777db0ef75f3cdf67506b8fcad6baed862eaf88fa1f280f42736b69a41ea7a3fea31ce62aa0563c85df1d9b02b83839c4ab9453e420c5c401cce979f6fb7b6ac12baf1e9140546eed24e92e383b8f2d37b3e4410844d235c7175112e751ee0");
+var extractable = true;
+
+debug("Importing a key...");
+crypto.subtle.importKey("pkcs8", pkcs8Key, {name: "RSA-OAEP", hash: "sha-1"}, extractable, ["decrypt", "unwrapKey"]).then(function(result) {
+ privateKey = result;
+
+ shouldBe("privateKey.toString()", "'[object CryptoKey]'");
+ shouldBe("privateKey.type", "'private'");
+ shouldBe("privateKey.extractable", "true");
+ shouldBe("privateKey.algorithm.name", "'RSA-OAEP'");
+ shouldBe("privateKey.algorithm.modulusLength", "2048");
+ shouldBe("bytesToHexString(privateKey.algorithm.publicExponent)", "'010001'");
+ shouldBe("privateKey.algorithm.hash.name", "'SHA-1'");
+ shouldBe("privateKey.usages", "['decrypt', 'unwrapKey']");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersaespkcs1v1_5generateexportkeypkcs8expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-generate-export-key-pkcs8-expected.txt (0 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-generate-export-key-pkcs8-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-generate-export-key-pkcs8-expected.txt        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+Test exporting a RSAES-PKCS1-v1_5 private key with PKCS8 format.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Generating a key pair...
+Exporting the private key...
+PASS privateKey is an instance of ArrayBuffer
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersaespkcs1v1_5generateexportkeypkcs8html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-generate-export-key-pkcs8.html (0 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-generate-export-key-pkcs8.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-generate-export-key-pkcs8.html        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -0,0 +1,41 @@
</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 exporting a RSAES-PKCS1-v1_5 private key with PKCS8 format.");
+
+jsTestIsAsync = true;
+
+var algorithmKeyGen = {
+ name: "RSAES-PKCS1-v1_5",
+ // RsaKeyGenParams
+ modulusLength: 2048,
+ publicExponent: new Uint8Array([0x01, 0x00, 0x01]), // Equivalent to 65537
+};
+var extractable = true;
+
+var keyPair;
+debug("Generating a key pair...");
+crypto.subtle.generateKey(algorithmKeyGen, extractable, ["decrypt", "encrypt"]).then(function(result) {
+ keyPair = result;
+ debug("Exporting the private key...");
+ return crypto.subtle.exportKey("pkcs8", keyPair.privateKey);
+}).then(function(result) {
+ privateKey = result;
+
+ shouldBeType("privateKey", "ArrayBuffer");
+
+ finishJSTest();
+});
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersaespkcs1v1_5importpkcs8keyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-import-pkcs8-key-expected.txt (0 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-import-pkcs8-key-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-import-pkcs8-key-expected.txt        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+Test importing a PKCS8 RSAES-PKCS1-v1_5 key
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Importing a key...
+PASS privateKey.toString() is '[object CryptoKey]'
+PASS privateKey.type is 'private'
+PASS privateKey.extractable is true
+PASS privateKey.algorithm.name is 'RSAES-PKCS1-v1_5'
+PASS privateKey.algorithm.modulusLength is 2048
+PASS bytesToHexString(privateKey.algorithm.publicExponent) is '010001'
+PASS privateKey.algorithm.hash is undefined.
+PASS privateKey.usages is ['decrypt']
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersaespkcs1v1_5importpkcs8keyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-import-pkcs8-key.html (0 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-import-pkcs8-key.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsaes-pkcs1-v1_5-import-pkcs8-key.html        2016-12-09 23:05:29 UTC (rev 209633)
</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 importing a PKCS8 RSAES-PKCS1-v1_5 key");
+
+jsTestIsAsync = true;
+
+var pkcs8Key = hexStringToUint8Array("308204bd020100300d06092a864886f70d0101010500048204a7308204a30201000282010100ca6ee8ec62b6a02e187b70c19ca15a13c386a470ee8816c7340a270f96f905511f93362f8f7aae3e60394dac34cb29ea5f540d6ef80b1df7155b66a2d6d6e44092bcbafbf69b061b3f4d927060c81d0fa07d22f481ff503c0581ffa444f57345204ddf0a93a225979c61aeb9686557f7632002e165430452868d010d505e3ccfed7315432a298a9b6d1a6ede98ee746c2c8bd22f5495cee563e2db24f1e33d91ced83af1baac754dba4ddba430f6cf3d4ac7edb0bf69891140854e8700056a7ef6d06ed5a605a05e74ecb3b246ce9cb310b39b00c707af3a637862e3d2914013de212ff09a36db84d99b8d610d0cfd36a4411dbf1b62e06ebff1bee50f040ca502030100010282010024706483309db925b3087d5a8cac4abfa60195963289d2b7d6f940e0c08760daa279685695583b074560eb47655570dd1c7dcfd13adb1d70bdaa6f463eaffdf455b59d5eff9c16344f67d2456256834cadd1f8b9d4b0b5aba83e275b55826d567323315401113dfd158c4bdc5a1b6c033f17a30d19a23fa3ef4e70730a157c928b1c7840a34401d19daab52cfa9b424cc8e1084254ca597304be22547b7221e875bf1fdca2386ba1e855
d5e0bcaba03376bfd73de8513c07ab0e67cb3554dc8c8f7a67d231f99a2b653ad471ee2f8bd3b8fad51b02f807d131b6b71ab17e45a5faf161ce3b919d96b5e78e9e4e1202d6398a954def4c1980da1fcc30d56167e102818100ee24b92668d38465fdd9a2262e64be56846be561e4cfbcedc82496a3190b549636923d61c3e5a2d40cc6d2c46a3e89ac23eb44ac40c777147e3e49a80bd382bae06e284f1cc553f89d78f0c7bf20fd3a33ee598ce2caf61e3f5457cd228ff03fe009f10952206bf248e161d17950c6655af75b097bbda1b909038d4d752cd11d02818100d99cb65195a399f9a3aca1ef1593592992e7d91cc028b713ec5b661b9976fcffdb086f523f042699cb910321fe7b67a27dd4a72822e6fbb98d005280721efc32d889d431d2737c92a4f34d4885c7a9c6244e081a1264a283d07744b752a68ebb6fbff3492a039e3e3a0cc5b94537582a7d11cc6b8678e4c338671f96be029b2902818100a1a2a7509ca1c4217db4f3cbba7d827b32921134ea9add7efef36692f8f2a9ccf2e93b645a1448fa6859a2c0d1e3f489b42f8182f0ccf1d425039df6c360224139074bb0b6b47094343ddc1f97688ab7b07bbca8555eb0c242f5ba4a6f8506ea33e44b87aa087b7c0d5f7c8733325216853192c6d30818f68059bad4b20d633902818034b3bf7402c99c80d92
2f614f124be735320d3742315b94119fd08bda66d2ad8cc333ec2ac8054d8ea74344e0753dbc57eb401c7b6ac3a4ab5db5e1fbd83c3908ce0d4833c74bbb6c83c247b6beaef330d97d85e7815e7460536dd6d8896cdfa9715e5d5d2570dfc041313cfcaf39c66ade3a19e68f2de7469349071f192b00102818060a8271f45161d8ecf62c3ac5f0fa8539b6d86a35123aafcc37541e2d5e5b62715777db0ef75f3cdf67506b8fcad6baed862eaf88fa1f280f42736b69a41ea7a3fea31ce62aa0563c85df1d9b02b83839c4ab9453e420c5c401cce979f6fb7b6ac12baf1e9140546eed24e92e383b8f2d37b3e4410844d235c7175112e751ee0");
+var extractable = true;
+
+debug("Importing a key...");
+crypto.subtle.importKey("pkcs8", pkcs8Key, "RSAES-PKCS1-v1_5", extractable, ["decrypt"]).then(function(result) {
+ privateKey = result;
+
+ shouldBe("privateKey.toString()", "'[object CryptoKey]'");
+ shouldBe("privateKey.type", "'private'");
+ shouldBe("privateKey.extractable", "true");
+ shouldBe("privateKey.algorithm.name", "'RSAES-PKCS1-v1_5'");
+ shouldBe("privateKey.algorithm.modulusLength", "2048");
+ shouldBe("bytesToHexString(privateKey.algorithm.publicExponent)", "'010001'");
+ shouldBeUndefined("privateKey.algorithm.hash");
+ shouldBe("privateKey.usages", "['decrypt']");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersassapkcs1v1_5generateexportkeypkcs8expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-generate-export-key-pkcs8-expected.txt (0 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-generate-export-key-pkcs8-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-generate-export-key-pkcs8-expected.txt        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+Test exporting a RSASSA-PKCS1-v1_5 private key with PKCS8 format.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Generating a key pair...
+Exporting the private key...
+PASS privateKey is an instance of ArrayBuffer
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersassapkcs1v1_5generateexportkeypkcs8html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-generate-export-key-pkcs8.html (0 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-generate-export-key-pkcs8.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-generate-export-key-pkcs8.html        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -0,0 +1,42 @@
</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 exporting a RSASSA-PKCS1-v1_5 private key with PKCS8 format.");
+
+jsTestIsAsync = true;
+
+var algorithmKeyGen = {
+ name: "RSASSA-PKCS1-v1_5",
+ // RsaKeyGenParams
+ modulusLength: 2048,
+ publicExponent: new Uint8Array([0x01, 0x00, 0x01]), // Equivalent to 65537
+ hash: "sha-1",
+};
+var extractable = true;
+
+var keyPair;
+debug("Generating a key pair...");
+crypto.subtle.generateKey(algorithmKeyGen, extractable, ["sign", "verify"]).then(function(result) {
+ keyPair = result;
+ debug("Exporting the private key...");
+ return crypto.subtle.exportKey("pkcs8", keyPair.privateKey);
+}).then(function(result) {
+ privateKey = result;
+
+ shouldBeType("privateKey", "ArrayBuffer");
+
+ finishJSTest();
+});
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersassapkcs1v1_5importpkcs8keyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-pkcs8-key-expected.txt (0 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-pkcs8-key-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-pkcs8-key-expected.txt        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+Test importing a PKCS8 RSASSA-PKCS1-v1_5 key
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Importing a key...
+PASS privateKey.toString() is '[object CryptoKey]'
+PASS privateKey.type is 'private'
+PASS privateKey.extractable is true
+PASS privateKey.algorithm.name is 'RSASSA-PKCS1-v1_5'
+PASS privateKey.algorithm.modulusLength is 2048
+PASS bytesToHexString(privateKey.algorithm.publicExponent) is '010001'
+PASS privateKey.algorithm.hash.name is 'SHA-1'
+PASS privateKey.usages is ['sign']
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersassapkcs1v1_5importpkcs8keyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-pkcs8-key.html (0 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-pkcs8-key.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsassa-pkcs1-v1_5-import-pkcs8-key.html        2016-12-09 23:05:29 UTC (rev 209633)
</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 importing a PKCS8 RSASSA-PKCS1-v1_5 key");
+
+jsTestIsAsync = true;
+
+var pkcs8Key = hexStringToUint8Array("308204bd020100300d06092a864886f70d0101010500048204a7308204a30201000282010100ca6ee8ec62b6a02e187b70c19ca15a13c386a470ee8816c7340a270f96f905511f93362f8f7aae3e60394dac34cb29ea5f540d6ef80b1df7155b66a2d6d6e44092bcbafbf69b061b3f4d927060c81d0fa07d22f481ff503c0581ffa444f57345204ddf0a93a225979c61aeb9686557f7632002e165430452868d010d505e3ccfed7315432a298a9b6d1a6ede98ee746c2c8bd22f5495cee563e2db24f1e33d91ced83af1baac754dba4ddba430f6cf3d4ac7edb0bf69891140854e8700056a7ef6d06ed5a605a05e74ecb3b246ce9cb310b39b00c707af3a637862e3d2914013de212ff09a36db84d99b8d610d0cfd36a4411dbf1b62e06ebff1bee50f040ca502030100010282010024706483309db925b3087d5a8cac4abfa60195963289d2b7d6f940e0c08760daa279685695583b074560eb47655570dd1c7dcfd13adb1d70bdaa6f463eaffdf455b59d5eff9c16344f67d2456256834cadd1f8b9d4b0b5aba83e275b55826d567323315401113dfd158c4bdc5a1b6c033f17a30d19a23fa3ef4e70730a157c928b1c7840a34401d19daab52cfa9b424cc8e1084254ca597304be22547b7221e875bf1fdca2386ba1e855
d5e0bcaba03376bfd73de8513c07ab0e67cb3554dc8c8f7a67d231f99a2b653ad471ee2f8bd3b8fad51b02f807d131b6b71ab17e45a5faf161ce3b919d96b5e78e9e4e1202d6398a954def4c1980da1fcc30d56167e102818100ee24b92668d38465fdd9a2262e64be56846be561e4cfbcedc82496a3190b549636923d61c3e5a2d40cc6d2c46a3e89ac23eb44ac40c777147e3e49a80bd382bae06e284f1cc553f89d78f0c7bf20fd3a33ee598ce2caf61e3f5457cd228ff03fe009f10952206bf248e161d17950c6655af75b097bbda1b909038d4d752cd11d02818100d99cb65195a399f9a3aca1ef1593592992e7d91cc028b713ec5b661b9976fcffdb086f523f042699cb910321fe7b67a27dd4a72822e6fbb98d005280721efc32d889d431d2737c92a4f34d4885c7a9c6244e081a1264a283d07744b752a68ebb6fbff3492a039e3e3a0cc5b94537582a7d11cc6b8678e4c338671f96be029b2902818100a1a2a7509ca1c4217db4f3cbba7d827b32921134ea9add7efef36692f8f2a9ccf2e93b645a1448fa6859a2c0d1e3f489b42f8182f0ccf1d425039df6c360224139074bb0b6b47094343ddc1f97688ab7b07bbca8555eb0c242f5ba4a6f8506ea33e44b87aa087b7c0d5f7c8733325216853192c6d30818f68059bad4b20d633902818034b3bf7402c99c80d92
2f614f124be735320d3742315b94119fd08bda66d2ad8cc333ec2ac8054d8ea74344e0753dbc57eb401c7b6ac3a4ab5db5e1fbd83c3908ce0d4833c74bbb6c83c247b6beaef330d97d85e7815e7460536dd6d8896cdfa9715e5d5d2570dfc041313cfcaf39c66ade3a19e68f2de7469349071f192b00102818060a8271f45161d8ecf62c3ac5f0fa8539b6d86a35123aafcc37541e2d5e5b62715777db0ef75f3cdf67506b8fcad6baed862eaf88fa1f280f42736b69a41ea7a3fea31ce62aa0563c85df1d9b02b83839c4ab9453e420c5c401cce979f6fb7b6ac12baf1e9140546eed24e92e383b8f2d37b3e4410844d235c7175112e751ee0");
+var extractable = true;
+
+debug("Importing a key...");
+crypto.subtle.importKey("pkcs8", pkcs8Key, {name: "RSASSA-PKCS1-v1_5", hash: "sha-1"}, extractable, ["sign"]).then(function(result) {
+ privateKey = result;
+
+ shouldBe("privateKey.toString()", "'[object CryptoKey]'");
+ shouldBe("privateKey.type", "'private'");
+ shouldBe("privateKey.extractable", "true");
+ shouldBe("privateKey.algorithm.name", "'RSASSA-PKCS1-v1_5'");
+ shouldBe("privateKey.algorithm.modulusLength", "2048");
+ shouldBe("bytesToHexString(privateKey.algorithm.publicExponent)", "'010001'");
+ shouldBe("privateKey.algorithm.hash.name", "'SHA-1'");
+ shouldBe("privateKey.usages", "['sign']");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtleresourcesrsaexportpkcs8keyjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/resources/rsa-export-pkcs8-key.js (0 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/resources/rsa-export-pkcs8-key.js         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/resources/rsa-export-pkcs8-key.js        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+importScripts('../../../../resources/js-test-pre.js');
+importScripts("../../../resources/common.js");
+
+description("Test exporting a RSA-OAEP private key with PKCS8 format in workers.");
+
+jsTestIsAsync = true;
+
+var algorithmKeyGen = {
+ name: "RSA-OAEP",
+ // RsaKeyGenParams
+ modulusLength: 2048,
+ publicExponent: new Uint8Array([0x01, 0x00, 0x01]), // Equivalent to 65537
+ hash: "sha-1",
+};
+var extractable = true;
+
+var keyPair;
+debug("Generating a key pair...");
+crypto.subtle.generateKey(algorithmKeyGen, extractable, ["decrypt", "encrypt", "wrapKey", "unwrapKey"]).then(function(result) {
+ keyPair = result;
+ debug("Exporting the private key...");
+ return crypto.subtle.exportKey("pkcs8", keyPair.privateKey);
+}).then(function(result) {
+ privateKey = result;
+
+ shouldBeType("privateKey", "ArrayBuffer");
+
+ finishJSTest();
+});
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtleresourcesrsaimportpkcs8keyjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/resources/rsa-import-pkcs8-key.js (0 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/resources/rsa-import-pkcs8-key.js         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/resources/rsa-import-pkcs8-key.js        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+importScripts('../../../../resources/js-test-pre.js');
+importScripts("../../../resources/common.js");
+
+description("Test importing a PKCS8 RSA-OAEP key in workers");
+
+jsTestIsAsync = true;
+
+var pkcs8Key = hexStringToUint8Array("308204bd020100300d06092a864886f70d0101010500048204a7308204a30201000282010100ca6ee8ec62b6a02e187b70c19ca15a13c386a470ee8816c7340a270f96f905511f93362f8f7aae3e60394dac34cb29ea5f540d6ef80b1df7155b66a2d6d6e44092bcbafbf69b061b3f4d927060c81d0fa07d22f481ff503c0581ffa444f57345204ddf0a93a225979c61aeb9686557f7632002e165430452868d010d505e3ccfed7315432a298a9b6d1a6ede98ee746c2c8bd22f5495cee563e2db24f1e33d91ced83af1baac754dba4ddba430f6cf3d4ac7edb0bf69891140854e8700056a7ef6d06ed5a605a05e74ecb3b246ce9cb310b39b00c707af3a637862e3d2914013de212ff09a36db84d99b8d610d0cfd36a4411dbf1b62e06ebff1bee50f040ca502030100010282010024706483309db925b3087d5a8cac4abfa60195963289d2b7d6f940e0c08760daa279685695583b074560eb47655570dd1c7dcfd13adb1d70bdaa6f463eaffdf455b59d5eff9c16344f67d2456256834cadd1f8b9d4b0b5aba83e275b55826d567323315401113dfd158c4bdc5a1b6c033f17a30d19a23fa3ef4e70730a157c928b1c7840a34401d19daab52cfa9b424cc8e1084254ca597304be22547b7221e875bf1fdca2386ba1e855
d5e0bcaba03376bfd73de8513c07ab0e67cb3554dc8c8f7a67d231f99a2b653ad471ee2f8bd3b8fad51b02f807d131b6b71ab17e45a5faf161ce3b919d96b5e78e9e4e1202d6398a954def4c1980da1fcc30d56167e102818100ee24b92668d38465fdd9a2262e64be56846be561e4cfbcedc82496a3190b549636923d61c3e5a2d40cc6d2c46a3e89ac23eb44ac40c777147e3e49a80bd382bae06e284f1cc553f89d78f0c7bf20fd3a33ee598ce2caf61e3f5457cd228ff03fe009f10952206bf248e161d17950c6655af75b097bbda1b909038d4d752cd11d02818100d99cb65195a399f9a3aca1ef1593592992e7d91cc028b713ec5b661b9976fcffdb086f523f042699cb910321fe7b67a27dd4a72822e6fbb98d005280721efc32d889d431d2737c92a4f34d4885c7a9c6244e081a1264a283d07744b752a68ebb6fbff3492a039e3e3a0cc5b94537582a7d11cc6b8678e4c338671f96be029b2902818100a1a2a7509ca1c4217db4f3cbba7d827b32921134ea9add7efef36692f8f2a9ccf2e93b645a1448fa6859a2c0d1e3f489b42f8182f0ccf1d425039df6c360224139074bb0b6b47094343ddc1f97688ab7b07bbca8555eb0c242f5ba4a6f8506ea33e44b87aa087b7c0d5f7c8733325216853192c6d30818f68059bad4b20d633902818034b3bf7402c99c80d92
2f614f124be735320d3742315b94119fd08bda66d2ad8cc333ec2ac8054d8ea74344e0753dbc57eb401c7b6ac3a4ab5db5e1fbd83c3908ce0d4833c74bbb6c83c247b6beaef330d97d85e7815e7460536dd6d8896cdfa9715e5d5d2570dfc041313cfcaf39c66ade3a19e68f2de7469349071f192b00102818060a8271f45161d8ecf62c3ac5f0fa8539b6d86a35123aafcc37541e2d5e5b62715777db0ef75f3cdf67506b8fcad6baed862eaf88fa1f280f42736b69a41ea7a3fea31ce62aa0563c85df1d9b02b83839c4ab9453e420c5c401cce979f6fb7b6ac12baf1e9140546eed24e92e383b8f2d37b3e4410844d235c7175112e751ee0");
+var extractable = true;
+
+debug("Importing a key...");
+crypto.subtle.importKey("pkcs8", pkcs8Key, {name: "RSA-OAEP", hash: "sha-1"}, extractable, ["decrypt", "unwrapKey"]).then(function(result) {
+ privateKey = result;
+
+ shouldBe("privateKey.toString()", "'[object CryptoKey]'");
+ shouldBe("privateKey.type", "'private'");
+ shouldBe("privateKey.extractable", "true");
+ shouldBe("privateKey.algorithm.name", "'RSA-OAEP'");
+ shouldBe("privateKey.algorithm.modulusLength", "2048");
+ shouldBe("bytesToHexString(privateKey.algorithm.publicExponent)", "'010001'");
+ shouldBe("privateKey.algorithm.hash.name", "'SHA-1'");
+ shouldBe("privateKey.usages", "['decrypt', 'unwrapKey']");
+
+ finishJSTest();
+});
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtlersaexportpkcs8keyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/rsa-export-pkcs8-key-expected.txt (0 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/rsa-export-pkcs8-key-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/rsa-export-pkcs8-key-expected.txt        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+[Worker] Test exporting a RSA-OAEP private key with PKCS8 format in workers.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Starting worker: resources/rsa-export-pkcs8-key.js
+[Worker] Generating a key pair...
+[Worker] Exporting the private key...
+PASS [Worker] privateKey is an instance of ArrayBuffer
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtlersaexportpkcs8keyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/rsa-export-pkcs8-key.html (0 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/rsa-export-pkcs8-key.html         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/rsa-export-pkcs8-key.html        2016-12-09 23:05:29 UTC (rev 209633)
</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/rsa-export-pkcs8-key.js');
+ </script>
+ <script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtlersaimportpkcs8keyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/rsa-import-pkcs8-key-expected.txt (0 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/rsa-import-pkcs8-key-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/rsa-import-pkcs8-key-expected.txt        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+[Worker] Test importing a PKCS8 RSA-OAEP key in workers
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Starting worker: resources/rsa-import-pkcs8-key.js
+[Worker] Importing a key...
+PASS [Worker] privateKey.toString() is '[object CryptoKey]'
+PASS [Worker] privateKey.type is 'private'
+PASS [Worker] privateKey.extractable is true
+PASS [Worker] privateKey.algorithm.name is 'RSA-OAEP'
+PASS [Worker] privateKey.algorithm.modulusLength is 2048
+PASS [Worker] bytesToHexString(privateKey.algorithm.publicExponent) is '010001'
+PASS [Worker] privateKey.algorithm.hash.name is 'SHA-1'
+PASS [Worker] privateKey.usages is ['decrypt', 'unwrapKey']
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtlersaimportpkcs8keyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/rsa-import-pkcs8-key.html (0 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/rsa-import-pkcs8-key.html         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/rsa-import-pkcs8-key.html        2016-12-09 23:05:29 UTC (rev 209633)
</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/rsa-import-pkcs8-key.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 (209632 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/ChangeLog        2016-12-09 22:59:52 UTC (rev 209632)
+++ trunk/LayoutTests/imported/w3c/ChangeLog        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2016-12-06 Jiewen Tan <jiewen_tan@apple.com>
+
+ [Part 2 of 2] Add support for PKCS8 format while doing SubtleCrypto.importKey/exportKey
+ https://bugs.webkit.org/show_bug.cgi?id=129978
+ <rdar://problem/21799829>
+
+ Reviewed by Brent Fulgham.
+
+ * WebCryptoAPI/encrypt_decrypt/test_rsa_oaep-expected.txt:
+
</ins><span class="cx"> 2016-12-08 Jiewen Tan <jiewen_tan@apple.com>
</span><span class="cx">
</span><span class="cx"> [WebCrypto] Remove NoInterfaceObject attribute from SubtleCrypto Interface
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cWebCryptoAPIencrypt_decrypttest_rsa_oaepexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/WebCryptoAPI/encrypt_decrypt/test_rsa_oaep-expected.txt (209632 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/imported/w3c/WebCryptoAPI/encrypt_decrypt/test_rsa_oaep-expected.txt        2016-12-09 22:59:52 UTC (rev 209632)
+++ trunk/LayoutTests/imported/w3c/WebCryptoAPI/encrypt_decrypt/test_rsa_oaep-expected.txt        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -1,102 +1,102 @@
</span><span class="cx"> encrypt Tests for RSA-OAEP
</span><span class="cx">
</span><span class="cx">
</span><del>-FAIL importVectorKeys step: RSA-OAEP with SHA-1 and no label decryption assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-1 and no label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-256 and no label decryption assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-256 and no label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-384 and no label decryption assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-384 and no label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-512 and no label decryption assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-512 and no label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-1 and empty label decryption assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-1 and empty label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-256 and empty label decryption assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-256 and empty label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-384 and empty label decryption assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-384 and empty label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-512 and empty label decryption assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-512 and empty label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-1 and a label decryption assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-1 and a label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-256 and a label decryption assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-256 and a label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-384 and a label decryption assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-384 and a label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-512 and a label decryption assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-512 and a label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-1 and no label decryption with altered ciphertext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-1 and no label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-256 and no label decryption with altered ciphertext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-256 and no label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-384 and no label decryption with altered ciphertext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-384 and no label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-512 and no label decryption with altered ciphertext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-512 and no label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-1 and empty label decryption with altered ciphertext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-1 and empty label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-256 and empty label decryption with altered ciphertext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-256 and empty label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-384 and empty label decryption with altered ciphertext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-384 and empty label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-512 and empty label decryption with altered ciphertext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-512 and empty label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-1 and a label decryption with altered ciphertext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-1 and a label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-256 and a label decryption with altered ciphertext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-256 and a label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-384 and a label decryption with altered ciphertext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-384 and a label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-512 and a label decryption with altered ciphertext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-512 and a label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-1 and no label using publicKey to decrypt assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-1 and no label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-256 and no label using publicKey to decrypt assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-256 and no label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-384 and no label using publicKey to decrypt assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-384 and no label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-512 and no label using publicKey to decrypt assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-512 and no label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-1 and empty label using publicKey to decrypt assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-1 and empty label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-256 and empty label using publicKey to decrypt assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-256 and empty label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-384 and empty label using publicKey to decrypt assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-384 and empty label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-512 and empty label using publicKey to decrypt assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-512 and empty label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-1 and a label using publicKey to decrypt assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-1 and a label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-256 and a label using publicKey to decrypt assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-256 and a label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-384 and a label using publicKey to decrypt assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-384 and a label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-512 and a label using publicKey to decrypt assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-512 and a label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-1 and no label no decrypt usage assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-1 and no label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-256 and no label no decrypt usage assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-256 and no label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-384 and no label no decrypt usage assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-384 and no label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-512 and no label no decrypt usage assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-512 and no label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-1 and empty label no decrypt usage assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-1 and empty label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-256 and empty label no decrypt usage assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-256 and empty label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-384 and empty label no decrypt usage assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-384 and empty label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-512 and empty label no decrypt usage assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-512 and empty label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-1 and a label no decrypt usage assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-1 and a label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-256 and a label no decrypt usage assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-256 and a label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-384 and a label no decrypt usage assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-384 and a label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-512 and a label no decrypt usage assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-512 and a label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-1 and no label with altered plaintext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-1 and no label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-256 and no label with altered plaintext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-256 and no label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-384 and no label with altered plaintext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-384 and no label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-512 and no label with altered plaintext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-512 and no label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-1 and empty label with altered plaintext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-1 and empty label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-256 and empty label with altered plaintext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-256 and empty label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-384 and empty label with altered plaintext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-384 and empty label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-512 and empty label with altered plaintext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-512 and empty label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-1 and a label with altered plaintext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-1 and a label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-256 and a label with altered plaintext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-256 and a label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-384 and a label with altered plaintext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-384 and a label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-512 and a label with altered plaintext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-512 and a label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-1 and no label assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-1 and no label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-256 and no label assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-256 and no label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-384 and no label assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-384 and no label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-512 and no label assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-512 and no label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-1 and empty label assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-1 and empty label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-256 and empty label assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-256 and empty label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-384 and empty label assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-384 and empty label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-512 and empty label assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-512 and empty label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-1 and a label assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-1 and a label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-256 and a label assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-256 and a label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-384 and a label assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-384 and a label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-512 and a label assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-512 and a label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-1 and no label too long plaintext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-1 and no label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-256 and no label too long plaintext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-256 and no label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-384 and no label too long plaintext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-384 and no label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-512 and no label too long plaintext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-512 and no label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-1 and empty label too long plaintext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-1 and empty label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-256 and empty label too long plaintext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-256 and empty label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-384 and empty label too long plaintext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-384 and empty label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-512 and empty label too long plaintext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-512 and empty label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-1 and a label too long plaintext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-1 and a label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-256 and a label too long plaintext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-256 and a label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-384 and a label too long plaintext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-384 and a label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-512 and a label too long plaintext assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-512 and a label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-1 and no label using privateKey to encrypt assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-1 and no label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-256 and no label using privateKey to encrypt assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-256 and no label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-384 and no label using privateKey to encrypt assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-384 and no label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-512 and no label using privateKey to encrypt assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-512 and no label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-1 and empty label using privateKey to encrypt assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-1 and empty label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-256 and empty label using privateKey to encrypt assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-256 and empty label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-384 and empty label using privateKey to encrypt assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-384 and empty label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-512 and empty label using privateKey to encrypt assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-512 and empty label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-1 and a label using privateKey to encrypt assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-1 and a label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-256 and a label using privateKey to encrypt assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-256 and a label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-384 and a label using privateKey to encrypt assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-384 and a label. Message: ''The operation is not supported.'' Reached unreachable code
-FAIL importVectorKeys step: RSA-OAEP with SHA-512 and a label using privateKey to encrypt assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-512 and a label. Message: ''The operation is not supported.'' Reached unreachable code
</del><ins>+PASS RSA-OAEP with SHA-1 and no label decryption
+PASS RSA-OAEP with SHA-256 and no label decryption
+PASS RSA-OAEP with SHA-384 and no label decryption
+PASS RSA-OAEP with SHA-512 and no label decryption
+PASS RSA-OAEP with SHA-1 and empty label decryption
+PASS RSA-OAEP with SHA-256 and empty label decryption
+PASS RSA-OAEP with SHA-384 and empty label decryption
+PASS RSA-OAEP with SHA-512 and empty label decryption
+PASS RSA-OAEP with SHA-1 and a label decryption
+PASS RSA-OAEP with SHA-256 and a label decryption
+PASS RSA-OAEP with SHA-384 and a label decryption
+PASS RSA-OAEP with SHA-512 and a label decryption
+PASS RSA-OAEP with SHA-1 and no label decryption with altered ciphertext
+PASS RSA-OAEP with SHA-256 and no label decryption with altered ciphertext
+PASS RSA-OAEP with SHA-384 and no label decryption with altered ciphertext
+PASS RSA-OAEP with SHA-512 and no label decryption with altered ciphertext
+PASS RSA-OAEP with SHA-1 and empty label decryption with altered ciphertext
+PASS RSA-OAEP with SHA-256 and empty label decryption with altered ciphertext
+PASS RSA-OAEP with SHA-384 and empty label decryption with altered ciphertext
+PASS RSA-OAEP with SHA-512 and empty label decryption with altered ciphertext
+PASS RSA-OAEP with SHA-1 and a label decryption with altered ciphertext
+PASS RSA-OAEP with SHA-256 and a label decryption with altered ciphertext
+PASS RSA-OAEP with SHA-384 and a label decryption with altered ciphertext
+PASS RSA-OAEP with SHA-512 and a label decryption with altered ciphertext
+PASS RSA-OAEP with SHA-1 and no label using publicKey to decrypt
+PASS RSA-OAEP with SHA-256 and no label using publicKey to decrypt
+PASS RSA-OAEP with SHA-384 and no label using publicKey to decrypt
+PASS RSA-OAEP with SHA-512 and no label using publicKey to decrypt
+PASS RSA-OAEP with SHA-1 and empty label using publicKey to decrypt
+PASS RSA-OAEP with SHA-256 and empty label using publicKey to decrypt
+PASS RSA-OAEP with SHA-384 and empty label using publicKey to decrypt
+PASS RSA-OAEP with SHA-512 and empty label using publicKey to decrypt
+PASS RSA-OAEP with SHA-1 and a label using publicKey to decrypt
+PASS RSA-OAEP with SHA-256 and a label using publicKey to decrypt
+PASS RSA-OAEP with SHA-384 and a label using publicKey to decrypt
+PASS RSA-OAEP with SHA-512 and a label using publicKey to decrypt
+PASS RSA-OAEP with SHA-1 and no label no decrypt usage
+PASS RSA-OAEP with SHA-256 and no label no decrypt usage
+PASS RSA-OAEP with SHA-384 and no label no decrypt usage
+PASS RSA-OAEP with SHA-512 and no label no decrypt usage
+PASS RSA-OAEP with SHA-1 and empty label no decrypt usage
+PASS RSA-OAEP with SHA-256 and empty label no decrypt usage
+PASS RSA-OAEP with SHA-384 and empty label no decrypt usage
+PASS RSA-OAEP with SHA-512 and empty label no decrypt usage
+PASS RSA-OAEP with SHA-1 and a label no decrypt usage
+PASS RSA-OAEP with SHA-256 and a label no decrypt usage
+PASS RSA-OAEP with SHA-384 and a label no decrypt usage
+PASS RSA-OAEP with SHA-512 and a label no decrypt usage
+PASS RSA-OAEP with SHA-1 and no label with altered plaintext
+PASS RSA-OAEP with SHA-256 and no label with altered plaintext
+PASS RSA-OAEP with SHA-384 and no label with altered plaintext
+PASS RSA-OAEP with SHA-512 and no label with altered plaintext
+PASS RSA-OAEP with SHA-1 and empty label with altered plaintext
+PASS RSA-OAEP with SHA-256 and empty label with altered plaintext
+PASS RSA-OAEP with SHA-384 and empty label with altered plaintext
+PASS RSA-OAEP with SHA-512 and empty label with altered plaintext
+PASS RSA-OAEP with SHA-1 and a label with altered plaintext
+PASS RSA-OAEP with SHA-256 and a label with altered plaintext
+PASS RSA-OAEP with SHA-384 and a label with altered plaintext
+PASS RSA-OAEP with SHA-512 and a label with altered plaintext
+PASS RSA-OAEP with SHA-1 and no label
+PASS RSA-OAEP with SHA-256 and no label
+PASS RSA-OAEP with SHA-384 and no label
+PASS RSA-OAEP with SHA-512 and no label
+PASS RSA-OAEP with SHA-1 and empty label
+PASS RSA-OAEP with SHA-256 and empty label
+PASS RSA-OAEP with SHA-384 and empty label
+PASS RSA-OAEP with SHA-512 and empty label
+PASS RSA-OAEP with SHA-1 and a label
+PASS RSA-OAEP with SHA-256 and a label
+PASS RSA-OAEP with SHA-384 and a label
+PASS RSA-OAEP with SHA-512 and a label
+PASS RSA-OAEP with SHA-1 and no label too long plaintext
+PASS RSA-OAEP with SHA-256 and no label too long plaintext
+PASS RSA-OAEP with SHA-384 and no label too long plaintext
+PASS RSA-OAEP with SHA-512 and no label too long plaintext
+PASS RSA-OAEP with SHA-1 and empty label too long plaintext
+PASS RSA-OAEP with SHA-256 and empty label too long plaintext
+PASS RSA-OAEP with SHA-384 and empty label too long plaintext
+PASS RSA-OAEP with SHA-512 and empty label too long plaintext
+PASS RSA-OAEP with SHA-1 and a label too long plaintext
+PASS RSA-OAEP with SHA-256 and a label too long plaintext
+PASS RSA-OAEP with SHA-384 and a label too long plaintext
+PASS RSA-OAEP with SHA-512 and a label too long plaintext
+PASS RSA-OAEP with SHA-1 and no label using privateKey to encrypt
+PASS RSA-OAEP with SHA-256 and no label using privateKey to encrypt
+PASS RSA-OAEP with SHA-384 and no label using privateKey to encrypt
+PASS RSA-OAEP with SHA-512 and no label using privateKey to encrypt
+PASS RSA-OAEP with SHA-1 and empty label using privateKey to encrypt
+PASS RSA-OAEP with SHA-256 and empty label using privateKey to encrypt
+PASS RSA-OAEP with SHA-384 and empty label using privateKey to encrypt
+PASS RSA-OAEP with SHA-512 and empty label using privateKey to encrypt
+PASS RSA-OAEP with SHA-1 and a label using privateKey to encrypt
+PASS RSA-OAEP with SHA-256 and a label using privateKey to encrypt
+PASS RSA-OAEP with SHA-384 and a label using privateKey to encrypt
+PASS RSA-OAEP with SHA-512 and a label using privateKey to encrypt
</ins><span class="cx"> FAIL importVectorKeys step: RSA-OAEP with SHA-1 and no label no encrypt usage assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-1 and no label. Message: ''A required parameter was missing or out-of-range'' Reached unreachable code
</span><span class="cx"> FAIL importVectorKeys step: RSA-OAEP with SHA-256 and no label no encrypt usage assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-256 and no label. Message: ''A required parameter was missing or out-of-range'' Reached unreachable code
</span><span class="cx"> FAIL importVectorKeys step: RSA-OAEP with SHA-384 and no label no encrypt usage assert_unreached: importVectorKeys failed for RSA-OAEP with SHA-384 and no label. Message: ''A required parameter was missing or out-of-range'' Reached unreachable code
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (209632 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-12-09 22:59:52 UTC (rev 209632)
+++ trunk/Source/WebCore/ChangeLog        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -1,3 +1,47 @@
</span><ins>+2016-12-06 Jiewen Tan <jiewen_tan@apple.com>
+
+ [Part 2 of 2] Add support for PKCS8 format while doing SubtleCrypto.importKey/exportKey
+ https://bugs.webkit.org/show_bug.cgi?id=129978
+ <rdar://problem/21799829>
+
+ Reviewed by Brent Fulgham.
+
+ This is part 2 of Bug 129978. In this patch, it adds the PKCS8 format support for
+ SubtleCrypto.importKey/exportKey. Currently support algorithms are RSAES-PKCS1-v1_5,
+ RSASSA-PKCS1-v1_5 and RSA-OAEP.
+
+ Tests: crypto/subtle/rsa-import-jwk-key-export-pkcs8-key.html
+ crypto/subtle/rsa-import-pkcs8-key-export-jwk-key.html
+ crypto/subtle/rsa-import-pkcs8-key-export-pkcs8-key.html
+ crypto/subtle/rsa-oaep-generate-export-key-pkcs8.html
+ crypto/subtle/rsa-oaep-import-pkcs8-key.html
+ crypto/subtle/rsaes-pkcs1-v1_5-generate-export-key-pkcs8.html
+ crypto/subtle/rsaes-pkcs1-v1_5-import-pkcs8-key.html
+ crypto/subtle/rsassa-pkcs1-v1_5-generate-export-key-pkcs8.html
+ crypto/subtle/rsassa-pkcs1-v1_5-import-pkcs8-key.html
+ crypto/workers/subtle/rsa-export-pkcs8-key.html
+ crypto/workers/subtle/rsa-import-pkcs8-key.html
+
+ * bindings/js/JSSubtleCryptoCustom.cpp:
+ (WebCore::toKeyData):
+ * crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp:
+ (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::importKey):
+ (WebCore::CryptoAlgorithmRSAES_PKCS1_v1_5::exportKey):
+ * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp:
+ (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey):
+ (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::exportKey):
+ * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp:
+ (WebCore::CryptoAlgorithmRSA_OAEP::importKey):
+ (WebCore::CryptoAlgorithmRSA_OAEP::exportKey):
+ * crypto/gnutls/CryptoKeyRSAGnuTLS.cpp:
+ (WebCore::CryptoKeyRSA::importPkcs8):
+ (WebCore::CryptoKeyRSA::exportPkcs8):
+ * crypto/keys/CryptoKeyRSA.h:
+ * crypto/mac/CryptoKeyRSAMac.cpp:
+ (WebCore::CryptoKeyRSA::importSpki):
+ (WebCore::CryptoKeyRSA::importPkcs8):
+ (WebCore::CryptoKeyRSA::exportPkcs8):
+
</ins><span class="cx"> 2016-12-09 Geoffrey Garen <ggaren@apple.com>
</span><span class="cx">
</span><span class="cx"> Deploy OrdinalNumber in JSC::SourceCode
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSSubtleCryptoCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp (209632 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp        2016-12-09 22:59:52 UTC (rev 209632)
+++ trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -341,10 +341,8 @@
</span><span class="cx">
</span><span class="cx"> KeyData result;
</span><span class="cx"> switch (format) {
</span><ins>+ case SubtleCrypto::KeyFormat::Spki:
</ins><span class="cx"> case SubtleCrypto::KeyFormat::Pkcs8:
</span><del>- setDOMException(&state, NOT_SUPPORTED_ERR);
- return result;
- case SubtleCrypto::KeyFormat::Spki:
</del><span class="cx"> case SubtleCrypto::KeyFormat::Raw: {
</span><span class="cx"> BufferSource bufferSource = convert<IDLBufferSource>(state, value);
</span><span class="cx"> RETURN_IF_EXCEPTION(scope, result);
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmRSAES_PKCS1_v1_5cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp (209632 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp        2016-12-09 22:59:52 UTC (rev 209632)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -128,6 +128,14 @@
</span><span class="cx"> result = CryptoKeyRSA::importSpki(parameters->identifier, std::nullopt, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages);
</span><span class="cx"> break;
</span><span class="cx"> }
</span><ins>+ case SubtleCrypto::KeyFormat::Pkcs8: {
+ if (usages ^ CryptoKeyUsageDecrypt) {
+ exceptionCallback(SYNTAX_ERR);
+ return;
+ }
+ result = CryptoKeyRSA::importPkcs8(parameters->identifier, std::nullopt, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages);
+ break;
+ }
</ins><span class="cx"> default:
</span><span class="cx"> exceptionCallback(NOT_SUPPORTED_ERR);
</span><span class="cx"> return;
</span><span class="lines">@@ -166,6 +174,15 @@
</span><span class="cx"> result = spki.releaseReturnValue();
</span><span class="cx"> break;
</span><span class="cx"> }
</span><ins>+ case SubtleCrypto::KeyFormat::Pkcs8: {
+ auto pkcs8 = rsaKey.exportPkcs8();
+ if (pkcs8.hasException()) {
+ exceptionCallback(pkcs8.releaseException().code());
+ return;
+ }
+ result = pkcs8.releaseReturnValue();
+ break;
+ }
</ins><span class="cx"> default:
</span><span class="cx"> exceptionCallback(NOT_SUPPORTED_ERR);
</span><span class="cx"> return;
</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 (209632 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp        2016-12-09 22:59:52 UTC (rev 209632)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -162,6 +162,15 @@
</span><span class="cx"> result = CryptoKeyRSA::importSpki(rsaParameters.identifier, rsaParameters.hashIdentifier, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages);
</span><span class="cx"> break;
</span><span class="cx"> }
</span><ins>+ case SubtleCrypto::KeyFormat::Pkcs8: {
+ if (usages ^ CryptoKeyUsageSign) {
+ exceptionCallback(SYNTAX_ERR);
+ return;
+ }
+ // FIXME: <webkit.org/b/165436>
+ result = CryptoKeyRSA::importPkcs8(parameters->identifier, rsaParameters.hashIdentifier, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages);
+ break;
+ }
</ins><span class="cx"> default:
</span><span class="cx"> exceptionCallback(NOT_SUPPORTED_ERR);
</span><span class="cx"> return;
</span><span class="lines">@@ -218,6 +227,15 @@
</span><span class="cx"> result = spki.releaseReturnValue();
</span><span class="cx"> break;
</span><span class="cx"> }
</span><ins>+ case SubtleCrypto::KeyFormat::Pkcs8: {
+ auto pkcs8 = rsaKey.exportPkcs8();
+ if (pkcs8.hasException()) {
+ exceptionCallback(pkcs8.releaseException().code());
+ return;
+ }
+ result = pkcs8.releaseReturnValue();
+ break;
+ }
</ins><span class="cx"> default:
</span><span class="cx"> exceptionCallback(NOT_SUPPORTED_ERR);
</span><span class="cx"> return;
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmRSA_OAEPcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp (209632 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp        2016-12-09 22:59:52 UTC (rev 209632)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -175,6 +175,15 @@
</span><span class="cx"> result = CryptoKeyRSA::importSpki(rsaParameters.identifier, rsaParameters.hashIdentifier, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages);
</span><span class="cx"> break;
</span><span class="cx"> }
</span><ins>+ case SubtleCrypto::KeyFormat::Pkcs8: {
+ if ((usages ^ CryptoKeyUsageDecrypt) && (usages ^ CryptoKeyUsageUnwrapKey) && (usages ^ (CryptoKeyUsageDecrypt | CryptoKeyUsageUnwrapKey))) {
+ exceptionCallback(SYNTAX_ERR);
+ return;
+ }
+ // FIXME: <webkit.org/b/165436>
+ result = CryptoKeyRSA::importPkcs8(parameters->identifier, rsaParameters.hashIdentifier, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages);
+ break;
+ }
</ins><span class="cx"> default:
</span><span class="cx"> exceptionCallback(NOT_SUPPORTED_ERR);
</span><span class="cx"> return;
</span><span class="lines">@@ -232,6 +241,16 @@
</span><span class="cx"> result = spki.releaseReturnValue();
</span><span class="cx"> break;
</span><span class="cx"> }
</span><ins>+ case SubtleCrypto::KeyFormat::Pkcs8: {
+ // FIXME: <webkit.org/b/165437>
+ auto pkcs8 = rsaKey.exportPkcs8();
+ if (pkcs8.hasException()) {
+ exceptionCallback(pkcs8.releaseException().code());
+ return;
+ }
+ result = pkcs8.releaseReturnValue();
+ break;
+ }
</ins><span class="cx"> default:
</span><span class="cx"> exceptionCallback(NOT_SUPPORTED_ERR);
</span><span class="cx"> return;
</span></span></pre></div>
<a id="trunkSourceWebCorecryptognutlsCryptoKeyRSAGnuTLScpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/gnutls/CryptoKeyRSAGnuTLS.cpp (209632 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/gnutls/CryptoKeyRSAGnuTLS.cpp        2016-12-09 22:59:52 UTC (rev 209632)
+++ trunk/Source/WebCore/crypto/gnutls/CryptoKeyRSAGnuTLS.cpp        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -126,6 +126,20 @@
</span><span class="cx"> return Exception { NOT_SUPPORTED_ERR };
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+RefPtr<CryptoKeyRSA> CryptoKeyRSA::importPkcs8(CryptoAlgorithmIdentifier, std::optional<CryptoAlgorithmIdentifier>, Vector<uint8_t>&&, bool, CryptoKeyUsageBitmap)
+{
+ notImplemented();
+
+ return nullptr;
+}
+
+ExceptionOr<Vector<uint8_t>> CryptoKeyRSA::exportPkcs8() const
+{
+ notImplemented();
+
+ return Exception { NOT_SUPPORTED_ERR };
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #endif // ENABLE(SUBTLE_CRYPTO)
</span></span></pre></div>
<a id="trunkSourceWebCorecryptokeysCryptoKeyRSAh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/keys/CryptoKeyRSA.h (209632 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/keys/CryptoKeyRSA.h        2016-12-09 22:59:52 UTC (rev 209632)
+++ trunk/Source/WebCore/crypto/keys/CryptoKeyRSA.h        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -103,10 +103,12 @@
</span><span class="cx"> static void generatePair(CryptoAlgorithmIdentifier, CryptoAlgorithmIdentifier hash, bool hasHash, unsigned modulusLength, const Vector<uint8_t>& publicExponent, bool extractable, CryptoKeyUsageBitmap, KeyPairCallback&&, VoidCallback&& failureCallback, ScriptExecutionContext*);
</span><span class="cx"> static RefPtr<CryptoKeyRSA> importJwk(CryptoAlgorithmIdentifier, std::optional<CryptoAlgorithmIdentifier> hash, JsonWebKey&&, bool extractable, CryptoKeyUsageBitmap);
</span><span class="cx"> static RefPtr<CryptoKeyRSA> importSpki(CryptoAlgorithmIdentifier, std::optional<CryptoAlgorithmIdentifier> hash, Vector<uint8_t>&&, bool extractable, CryptoKeyUsageBitmap);
</span><ins>+ static RefPtr<CryptoKeyRSA> importPkcs8(CryptoAlgorithmIdentifier, std::optional<CryptoAlgorithmIdentifier> hash, Vector<uint8_t>&&, bool extractable, CryptoKeyUsageBitmap);
</ins><span class="cx">
</span><span class="cx"> PlatformRSAKey platformKey() const { return m_platformKey; }
</span><span class="cx"> JsonWebKey exportJwk() const;
</span><span class="cx"> ExceptionOr<Vector<uint8_t>> exportSpki() const;
</span><ins>+ ExceptionOr<Vector<uint8_t>> exportPkcs8() const;
</ins><span class="cx">
</span><span class="cx"> CryptoAlgorithmIdentifier hashAlgorithmIdentifier() const { return m_hash; }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorecryptomacCryptoKeyRSAMaccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp (209632 => 209633)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp        2016-12-09 22:59:52 UTC (rev 209632)
+++ trunk/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp        2016-12-09 23:05:29 UTC (rev 209633)
</span><span class="lines">@@ -40,9 +40,14 @@
</span><span class="cx">
</span><span class="cx"> // OID rsaEncryption: 1.2.840.113549.1.1.1. Per https://tools.ietf.org/html/rfc3279#section-2.3.1
</span><span class="cx"> static unsigned char RSAOIDHeader[] = {0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00};
</span><ins>+// Version 0. Per https://tools.ietf.org/html/rfc5208#section-5
+static unsigned char Version[] = {0x02, 0x01, 0x00};
+
</ins><span class="cx"> // Per X.690 08/2015: https://www.itu.int/rec/T-REC-X.680-X.693/en
</span><ins>+static unsigned char BitStringMark = 0x03;
+static unsigned char OctetStringMark = 0x04;
</ins><span class="cx"> static unsigned char SequenceMark = 0x30;
</span><del>-static unsigned char BitStringMark = 0x03;
</del><ins>+
</ins><span class="cx"> static unsigned char InitialOctet = 0x00;
</span><span class="cx">
</span><span class="cx"> // FIXME: We should get rid of magic number 16384. It assumes that the length of provided key will not exceed 16KB.
</span><span class="lines">@@ -332,10 +337,10 @@
</span><span class="cx"> // the most common one for now.
</span><span class="cx"> // Per https://tools.ietf.org/html/rfc5280#section-4.1. subjectPublicKeyInfo.
</span><span class="cx"> size_t headerSize = 1;
</span><del>- if (keyData.size() < headerSize)
</del><ins>+ if (keyData.size() < headerSize + 1)
</ins><span class="cx"> return nullptr;
</span><span class="cx"> headerSize += bytesUsedToEncodedLength(keyData[headerSize]) + sizeof(RSAOIDHeader) + sizeof(BitStringMark);
</span><del>- if (keyData.size() < headerSize)
</del><ins>+ if (keyData.size() < headerSize + 1)
</ins><span class="cx"> return nullptr;
</span><span class="cx"> headerSize += bytesUsedToEncodedLength(keyData[headerSize]) + sizeof(InitialOctet);
</span><span class="cx">
</span><span class="lines">@@ -378,6 +383,64 @@
</span><span class="cx"> return WTFMove(result);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+RefPtr<CryptoKeyRSA> CryptoKeyRSA::importPkcs8(CryptoAlgorithmIdentifier identifier, std::optional<CryptoAlgorithmIdentifier> hash, Vector<uint8_t>&& keyData, bool extractable, CryptoKeyUsageBitmap usages)
+{
+ // The current SecLibrary cannot import a PKCS8 format binary. Hence, we need to strip out the PKCS8 header.
+ // This hack can be removed when <rdar://problem/29523286> is resolved.
+ // The header format we assume is: SequenceMark(1) + Length(?) + Version(3) + rsaEncryption(15) + OctetStringMark(1) + Length(?).
+ // The header format could be varied. However since we don't have a full-fledged ASN.1 encoder/decoder, we want to restrict it to
+ // the most common one for now.
+ // Per https://tools.ietf.org/html/rfc5208#section-5. PrivateKeyInfo.
+ // We also assume there is no optional parameters.
+ size_t headerSize = 1;
+ if (keyData.size() < headerSize + 1)
+ return nullptr;
+ headerSize += bytesUsedToEncodedLength(keyData[headerSize]) + sizeof(Version) + sizeof(RSAOIDHeader) + sizeof(OctetStringMark);
+ if (keyData.size() < headerSize + 1)
+ return nullptr;
+ headerSize += bytesUsedToEncodedLength(keyData[headerSize]);
+
+ CCRSACryptorRef ccPrivateKey;
+ if (CCRSACryptorImport(keyData.data() + headerSize, keyData.size() - headerSize, &ccPrivateKey))
+ return nullptr;
+
+ // Notice: CryptoAlgorithmIdentifier::SHA_1 is just a placeholder. It should not have any effect if hash is std::nullopt.
+ return adoptRef(new CryptoKeyRSA(identifier, hash.value_or(CryptoAlgorithmIdentifier::SHA_1), !!hash, CryptoKeyType::Private, ccPrivateKey, extractable, usages));
+}
+
+ExceptionOr<Vector<uint8_t>> CryptoKeyRSA::exportPkcs8() const
+{
+ if (type() != CryptoKeyType::Private)
+ return Exception { INVALID_ACCESS_ERR };
+
+ // The current SecLibrary cannot output a valid PKCS8 format binary. Hence, we need the following hack.
+ // This hack can be removed when <rdar://problem/29523286> is resolved.
+ // Estimated size in produced bytes format. Per https://tools.ietf.org/html/rfc3447#appendix-A.1.2. RSAPrivateKey.
+ // O(size) = Sequence(1) + Length(3) + Integer(1) + Length(3) + Modulus + Integer(1) + Length(3) + publicExponent + Integer(1) + Length(3) +
+ // privateExponent + Integer(1) + Length(3) + prime1 + Integer(1) + Length(3) + prime2 + Integer(1) + Length(3) + exponent1 + Integer(1) +
+ // Length(3) + exponent2 + Integer(1) + Length(3) + coefficient.
+ Vector<uint8_t> keyBytes(keySizeInBits());
+ size_t keySize = keyBytes.size();
+ if (CCRSACryptorExport(platformKey(), keyBytes.data(), &keySize))
+ return Exception { OperationError };
+ keyBytes.shrink(keySize);
+
+ // Version + RSAOIDHeader + OctetStringMark + Length + keySize
+ size_t totalSize = sizeof(Version) + sizeof(RSAOIDHeader) + bytesNeededForEncodedLength(keySize) + keySize + 2;
+
+ // Per https://tools.ietf.org/html/rfc5208#section-5. PrivateKeyInfo.
+ Vector<uint8_t> result;
+ result.append(SequenceMark);
+ addEncodedASN1Length(result, totalSize);
+ result.append(Version, sizeof(Version));
+ result.append(RSAOIDHeader, sizeof(RSAOIDHeader));
+ result.append(OctetStringMark);
+ addEncodedASN1Length(result, keySize);
+ result.append(keyBytes.data(), keyBytes.size());
+
+ return WTFMove(result);
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx">
</span><span class="cx"> #endif // ENABLE(SUBTLE_CRYPTO)
</span></span></pre>
</div>
</div>
</body>
</html>