<!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>[159944] 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/159944">159944</a></dd>
<dt>Author</dt> <dd>ap@apple.com</dd>
<dt>Date</dt> <dd>2013-12-02 11:50:51 -0800 (Mon, 02 Dec 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add support for WebCrypto RSA-OAEP
https://bugs.webkit.org/show_bug.cgi?id=125084

Reviewed by Sam Weinig.

Source/WebCore: 

Tests: crypto/subtle/rsa-oaep-key-manipulation.html
       crypto/subtle/rsa-oaep-plaintext-length.html
       crypto/subtle/rsa-oaep-wrap-unwrap-aes.html

* WebCore.xcodeproj/project.pbxproj: Added new files.

* bindings/js/JSCryptoAlgorithmDictionary.cpp:
(WebCore::createRsaOaepParams):
(WebCore::JSCryptoAlgorithmDictionary::createParametersForEncrypt):
(WebCore::JSCryptoAlgorithmDictionary::createParametersForDecrypt):
(WebCore::JSCryptoAlgorithmDictionary::createParametersForImportKey):
Added RSA-OAEP parameters.

* bindings/js/JSCryptoKeySerializationJWK.cpp:
(WebCore::JSCryptoKeySerializationJWK::reconcileAlgorithm):
(WebCore::JSCryptoKeySerializationJWK::keySizeIsValid):
(WebCore::JSCryptoKeySerializationJWK::addJWKAlgorithmToJSON):
Support RSA-OAEP in JWK. It is more limited than general WebCrypto, as JWK only
allows SHA-1 as hash.

* crypto/CommonCryptoUtilities.cpp: Added. (WebCore::getCommonCryptoDigestAlgorithm):
* crypto/CommonCryptoUtilities.h: Added.
Extracted some shared code and forward declarations for CommonCrypto.

* crypto/CryptoAlgorithmParameters.h: (WebCore::CryptoAlgorithmParameters::Class):
* crypto/parameters/CryptoAlgorithmRsaOaepParams.h: Added.
Added RsaOaepParams.

* crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp: Added.
* crypto/algorithms/CryptoAlgorithmRSA_OAEP.h: Added.
* crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp: Added.

* crypto/mac/CryptoAlgorithmHMACMac.cpp:
(WebCore::getCommonCryptoHMACAlgorithm):
(WebCore::CryptoAlgorithmHMAC::platformSign):
(WebCore::CryptoAlgorithmHMAC::platformVerify):
* crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
* crypto/mac/CryptoKeyMac.cpp:
* crypto/mac/CryptoKeyRSAMac.cpp:
Use CommonCryptoUtilities.

* crypto/mac/CryptoAlgorithmRegistryMac.cpp:
(WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms): Register RSA-OAEP.

LayoutTests: 

* crypto/subtle/rsa-oaep-key-manipulation-expected.txt: Added.
* crypto/subtle/rsa-oaep-key-manipulation.html: Added.
* crypto/subtle/rsa-oaep-plaintext-length-expected.txt: Added.
* crypto/subtle/rsa-oaep-plaintext-length.html: Added.
* crypto/subtle/rsa-oaep-wrap-unwrap-aes-expected.txt: Added.
* crypto/subtle/rsa-oaep-wrap-unwrap-aes.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSCryptoAlgorithmDictionarycpp">trunk/Source/WebCore/bindings/js/JSCryptoAlgorithmDictionary.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSCryptoKeySerializationJWKcpp">trunk/Source/WebCore/bindings/js/JSCryptoKeySerializationJWK.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoCryptoAlgorithmParametersh">trunk/Source/WebCore/crypto/CryptoAlgorithmParameters.h</a></li>
<li><a href="#trunkSourceWebCorecryptomacCryptoAlgorithmHMACMaccpp">trunk/Source/WebCore/crypto/mac/CryptoAlgorithmHMACMac.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptomacCryptoAlgorithmRSASSA_PKCS1_v1_5Maccpp">trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptomacCryptoAlgorithmRegistryMaccpp">trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRegistryMac.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptomacCryptoKeyMaccpp">trunk/Source/WebCore/crypto/mac/CryptoKeyMac.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptomacCryptoKeyRSAMaccpp">trunk/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestscryptosubtlersaoaepkeymanipulationexpectedtxt">trunk/LayoutTests/crypto/subtle/rsa-oaep-key-manipulation-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersaoaepkeymanipulationhtml">trunk/LayoutTests/crypto/subtle/rsa-oaep-key-manipulation.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersaoaepplaintextlengthexpectedtxt">trunk/LayoutTests/crypto/subtle/rsa-oaep-plaintext-length-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersaoaepplaintextlengthhtml">trunk/LayoutTests/crypto/subtle/rsa-oaep-plaintext-length.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersaoaepwrapunwrapaesexpectedtxt">trunk/LayoutTests/crypto/subtle/rsa-oaep-wrap-unwrap-aes-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtlersaoaepwrapunwrapaeshtml">trunk/LayoutTests/crypto/subtle/rsa-oaep-wrap-unwrap-aes.html</a></li>
<li><a href="#trunkSourceWebCorecryptoCommonCryptoUtilitiescpp">trunk/Source/WebCore/crypto/CommonCryptoUtilities.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoCommonCryptoUtilitiesh">trunk/Source/WebCore/crypto/CommonCryptoUtilities.h</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmRSA_OAEPcpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmRSA_OAEPh">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.h</a></li>
<li><a href="#trunkSourceWebCorecryptomacCryptoAlgorithmRSA_OAEPMaccpp">trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoparametersCryptoAlgorithmRsaOaepParamsh">trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmRsaOaepParams.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (159943 => 159944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2013-12-02 19:49:43 UTC (rev 159943)
+++ trunk/LayoutTests/ChangeLog        2013-12-02 19:50:51 UTC (rev 159944)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2013-12-02  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        Add support for WebCrypto RSA-OAEP
+        https://bugs.webkit.org/show_bug.cgi?id=125084
+
+        Reviewed by Sam Weinig.
+
+        * crypto/subtle/rsa-oaep-key-manipulation-expected.txt: Added.
+        * crypto/subtle/rsa-oaep-key-manipulation.html: Added.
+        * crypto/subtle/rsa-oaep-plaintext-length-expected.txt: Added.
+        * crypto/subtle/rsa-oaep-plaintext-length.html: Added.
+        * crypto/subtle/rsa-oaep-wrap-unwrap-aes-expected.txt: Added.
+        * crypto/subtle/rsa-oaep-wrap-unwrap-aes.html: Added.
+
</ins><span class="cx"> 2013-12-01  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Stores to local captured variables should be intercepted
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtlersaoaepkeymanipulationexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/rsa-oaep-key-manipulation-expected.txt (0 => 159944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsa-oaep-key-manipulation-expected.txt                                (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsa-oaep-key-manipulation-expected.txt        2013-12-02 19:50:51 UTC (rev 159944)
</span><span class="lines">@@ -0,0 +1,45 @@
</span><ins>+Test generating, importing and exporting RSA keys for RSA-OAEP. Test that they can't be used with another algorithm.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Generating a key pair...
+PASS keyPair.toString() is '[object KeyPair]'
+PASS keyPair.publicKey.type is 'public'
+PASS keyPair.publicKey.algorithm.name is 'rsa-oaep'
+PASS keyPair.publicKey.algorithm.modulusLength is 2048
+PASS bytesToHexString(keyPair.publicKey.algorithm.publicExponent) is '010001'
+PASS keyPair.publicKey.algorithm.hash is undefined.
+PASS keyPair.privateKey.type is 'private'
+PASS keyPair.privateKey.algorithm.name is 'rsa-oaep'
+PASS keyPair.privateKey.algorithm.modulusLength is 2048
+PASS bytesToHexString(keyPair.privateKey.algorithm.publicExponent) is '010001'
+PASS keyPair.privateKey.algorithm.hash is undefined.
+
+Testing that the keys can't be used with different algorithms...
+PASS crypto.subtle.encrypt({name: &quot;aes-cbc&quot;, iv: iv}, keyPair.privateKey, hexStringToUint8Array(&quot;00&quot;)) threw exception Error: NotSupportedError: DOM Exception 9.
+PASS crypto.subtle.encrypt({name: &quot;aes-cbc&quot;, iv: iv}, keyPair.publicKey, hexStringToUint8Array(&quot;00&quot;)) threw exception Error: NotSupportedError: DOM Exception 9.
+
+Trying to export keys to raw...
+PASS Promise rejected for exporting public key
+PASS Promise rejected for exporting private key
+
+Exporting public key to JWK...
+PASS jwkPublicKey.alg is 'RSA-OAEP'
+PASS jwkPublicKey.extractable is true
+PASS jwkPublicKey.use is 'enc'
+PASS jwkPublicKey.kty is 'RSA'
+PASS bytesToHexString(Base64URL.parse(jwkPublicKey.e)) is '010001'
+
+Importing it back...
+PASS exportedPublicKey.type is 'public'
+PASS exportedPublicKey.algorithm.name is 'rsa-oaep'
+PASS exportedPublicKey.algorithm.modulusLength is 2048
+PASS bytesToHexString(exportedPublicKey.algorithm.publicExponent) is '010001'
+PASS exportedPublicKey.algorithm.hash.name is 'sha-1'
+PASS exportedPublicKey.extractable is true
+PASS exportedPublicKey.usages is ['encrypt','decrypt','wrapKey','unwrapKey']
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins><span class="cx">Property changes on: trunk/LayoutTests/crypto/subtle/rsa-oaep-key-manipulation-expected.txt
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkLayoutTestscryptosubtlersaoaepkeymanipulationhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/rsa-oaep-key-manipulation.html (0 => 159944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsa-oaep-key-manipulation.html                                (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsa-oaep-key-manipulation.html        2013-12-02 19:50:51 UTC (rev 159944)
</span><span class="lines">@@ -0,0 +1,81 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;resources/common.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+
+&lt;script&gt;
+description(&quot;Test generating, importing and exporting RSA keys for RSA-OAEP. Test that they can't be used with another algorithm.&quot;);
+
+jsTestIsAsync = true;
+
+var algorithmKeyGen = {
+    name: &quot;RSA-OAEP&quot;,
+    // RsaKeyGenParams
+    modulusLength: 2048,
+    publicExponent: new Uint8Array([0x01, 0x00, 0x01]),  // Equivalent to 65537
+};
+var extractable = true;
+
+debug(&quot;Generating a key pair...&quot;);
+crypto.subtle.generateKey(algorithmKeyGen, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;, &quot;wrapKey&quot;, &quot;unwrapKey&quot;]).then(function(result) {
+    keyPair = result;
+    shouldBe(&quot;keyPair.toString()&quot;, &quot;'[object KeyPair]'&quot;);
+    shouldBe(&quot;keyPair.publicKey.type&quot;, &quot;'public'&quot;);
+    shouldBe(&quot;keyPair.publicKey.algorithm.name&quot;, &quot;'rsa-oaep'&quot;);
+    shouldBe(&quot;keyPair.publicKey.algorithm.modulusLength&quot;, &quot;2048&quot;);
+    shouldBe(&quot;bytesToHexString(keyPair.publicKey.algorithm.publicExponent)&quot;, &quot;'010001'&quot;);
+    shouldBeUndefined(&quot;keyPair.publicKey.algorithm.hash&quot;);
+    shouldBe(&quot;keyPair.privateKey.type&quot;, &quot;'private'&quot;);
+    shouldBe(&quot;keyPair.privateKey.algorithm.name&quot;, &quot;'rsa-oaep'&quot;);
+    shouldBe(&quot;keyPair.privateKey.algorithm.modulusLength&quot;, &quot;2048&quot;);
+    shouldBe(&quot;bytesToHexString(keyPair.privateKey.algorithm.publicExponent)&quot;, &quot;'010001'&quot;);
+    shouldBeUndefined(&quot;keyPair.privateKey.algorithm.hash&quot;);
+
+    debug(&quot;\nTesting that the keys can't be used with different algorithms...&quot;);
+    iv = hexStringToUint8Array(&quot;000102030405060708090a0b0c0d0e0f&quot;);
+    shouldThrow('crypto.subtle.encrypt({name: &quot;aes-cbc&quot;, iv: iv}, keyPair.privateKey, hexStringToUint8Array(&quot;00&quot;))');
+    shouldThrow('crypto.subtle.encrypt({name: &quot;aes-cbc&quot;, iv: iv}, keyPair.publicKey, hexStringToUint8Array(&quot;00&quot;))');
+
+    debug(&quot;\nTrying to export keys to raw...&quot;);
+    return crypto.subtle.exportKey('raw', keyPair.publicKey);
+}).then(undefined, function(result) {
+    testPassed(&quot;Promise rejected for exporting public key&quot;);
+    return crypto.subtle.exportKey('raw', keyPair.privateKey);
+}).then(undefined, function(result) {
+    testPassed(&quot;Promise rejected for exporting private key&quot;);
+
+    debug(&quot;\nExporting public key to JWK...&quot;);
+    return crypto.subtle.exportKey(&quot;jwk&quot;, keyPair.publicKey);
+}).then(function(result) {
+    jwkPublicKeyArray = result;
+    jwkPublicKey = JSON.parse(bytesToASCIIString(jwkPublicKeyArray));
+    shouldBe(&quot;jwkPublicKey.alg&quot;, &quot;'RSA-OAEP'&quot;);
+    shouldBe(&quot;jwkPublicKey.extractable&quot;, &quot;true&quot;);
+    shouldBe(&quot;jwkPublicKey.use&quot;, &quot;'enc'&quot;);
+    shouldBe(&quot;jwkPublicKey.kty&quot;, &quot;'RSA'&quot;);
+    shouldBe(&quot;bytesToHexString(Base64URL.parse(jwkPublicKey.e))&quot;, &quot;'010001'&quot;);
+
+    debug(&quot;\nImporting it back...&quot;);
+    return crypto.subtle.importKey(&quot;jwk&quot;, jwkPublicKeyArray, null, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;, &quot;wrapKey&quot;, &quot;unwrapKey&quot;]);
+}).then(function(result) {
+    exportedPublicKey = result;
+    shouldBe(&quot;exportedPublicKey.type&quot;, &quot;'public'&quot;);
+    shouldBe(&quot;exportedPublicKey.algorithm.name&quot;, &quot;'rsa-oaep'&quot;);
+    shouldBe(&quot;exportedPublicKey.algorithm.modulusLength&quot;, &quot;2048&quot;);
+    shouldBe(&quot;bytesToHexString(exportedPublicKey.algorithm.publicExponent)&quot;, &quot;'010001'&quot;);
+    shouldBe(&quot;exportedPublicKey.algorithm.hash.name&quot;, &quot;'sha-1'&quot;);
+    shouldBe(&quot;exportedPublicKey.extractable&quot;, &quot;true&quot;);
+    shouldBe(&quot;exportedPublicKey.usages&quot;, &quot;['encrypt','decrypt','wrapKey','unwrapKey']&quot;);
+
+    finishJSTest();
+});
+&lt;/script&gt;
+
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">Property changes on: trunk/LayoutTests/crypto/subtle/rsa-oaep-key-manipulation.html
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestscryptosubtlersaoaepplaintextlengthexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/rsa-oaep-plaintext-length-expected.txt (0 => 159944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsa-oaep-plaintext-length-expected.txt                                (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsa-oaep-plaintext-length-expected.txt        2013-12-02 19:50:51 UTC (rev 159944)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+Test what happens when trying to encrypt a too large plain text with RSA-OAEP.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Importing RSA keys...
+Encrypting a 214 byte buffer with RSA-OAEP SHA-1, 2048 bit key...
+PASS Succeeded
+Encrypting a 215 byte buffer...
+PASS Rejected
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins><span class="cx">Property changes on: trunk/LayoutTests/crypto/subtle/rsa-oaep-plaintext-length-expected.txt
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkLayoutTestscryptosubtlersaoaepplaintextlengthhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/rsa-oaep-plaintext-length.html (0 => 159944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsa-oaep-plaintext-length.html                                (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsa-oaep-plaintext-length.html        2013-12-02 19:50:51 UTC (rev 159944)
</span><span class="lines">@@ -0,0 +1,63 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;resources/common.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+
+&lt;script&gt;
+description(&quot;Test what happens when trying to encrypt a too large plain text with RSA-OAEP.&quot;);
+
+jsTestIsAsync = true;
+
+var publicKeyJSON = {
+    kty: &quot;RSA&quot;,
+    alg: &quot;RSA-OAEP&quot;,
+    n: &quot;rcCUCv7Oc1HVam1DIhCzqknThWawOp8QLk8Ziy2p10ByjQFCajoFiyuAWl-R1WXZaf4xitLRracT9agpzIzc-MbLSHIGgWQGO21lGiImy5ftZ-D8bHAqRz2y15pzD4c4CEou7XSSLDoRnR0QG5MsDhD6s2gV9mwHkrtkCxtMWdBi-77as8wGmlNRldcOSgZDLK8UnCSgA1OguZ989bFyc8tOOEIb0xUSfPSz3LPSCnyYz68aDjmKVeNH-ig857OScyWbGyEy3Biw64qun3juUlNWsJ3zngkOdteYWytx5Qr4XKNs6R-Myyq72KUp02mJDZiiyiglxML_i3-_CeecCw&quot;,
+    e: &quot;AQAB&quot;
+};
+
+var privateKeyJSON = {
+    kty: &quot;RSA&quot;,
+    alg: &quot;RSA-OAEP&quot;,
+    n: &quot;rcCUCv7Oc1HVam1DIhCzqknThWawOp8QLk8Ziy2p10ByjQFCajoFiyuAWl-R1WXZaf4xitLRracT9agpzIzc-MbLSHIGgWQGO21lGiImy5ftZ-D8bHAqRz2y15pzD4c4CEou7XSSLDoRnR0QG5MsDhD6s2gV9mwHkrtkCxtMWdBi-77as8wGmlNRldcOSgZDLK8UnCSgA1OguZ989bFyc8tOOEIb0xUSfPSz3LPSCnyYz68aDjmKVeNH-ig857OScyWbGyEy3Biw64qun3juUlNWsJ3zngkOdteYWytx5Qr4XKNs6R-Myyq72KUp02mJDZiiyiglxML_i3-_CeecCw&quot;,
+    e: &quot;AQAB&quot;,
+    d: &quot;eNLS37aCz7RXSNPD_DtLBJ6j5T8cSxdzRBCjPaI6WcGqJp16lq3UTwuoDLAqlA9oGYm238dsIWpuucP_lQtbWe-7SpxoI6_vmYGf7YVUHv1-DF9qiOmSrMmdxMnVOzYXY8RaT6thPjn_J5cfLV2xI_LwsrMtmpdSyNlgX0zTUhwtuahgAKMEChYjH2EnjHdHw6sY2-wApdcQI7ULE0oo5RzbQZpmuhcN9hiBc0L3hhF0qo50mbl02_65_GQ7DpVkXBxNgRBLzlPabmzzG2oAhfefLgYmSC1opaCkXE6vRWQNWNL45RZNZFYM3uoJghOMqGeocM0BpjdChHrPOlFvSQ&quot;,
+    p: &quot;4miTuAjKMeH5uJ5KB397QUwhbkYEgSbcA2mifmSkvE2018gb55qkBHK1eVryf1_m43LNlc6O_ak6gfzdZIZvS5NCGjPl0q09plUpu8qFOSspBwA67qGH76lFlZLn_d4yglS7wfLru4_5Ys8qLLs-DqVLviwposOnyyWqwM5AXp0&quot;,
+    q: &quot;xHYrzkivtmnz_sGchnWGc0q-pDOkKicptRpv2pMFIIXxnFX5aMeEXIZjVujXtwUy1UlFIN2GZJSvy5KJ79mu_XyNnFHMzedH-A3ee3u8h1UUrZF-vUu1_e4U_x67NN1dedzUSKynN7pFl3OkuShMBWGV-cwzOPdcVAfVuZlxUMc&quot;,
+    dp: &quot;fBzDzYDUBmBQGop7Hn0dvf_T27V6RqpctWo074CQZcFbP2atFVtKSj3viWT3xid2VHzcgiDHdfpM3nEVlEO1wwIonGCSvdjGEOZiiFVOjrZAOVxA8guOjyyFvqbXke06VwPIIVvfKeSU2zuhbP__1tt6F_fxow4Kb2xonGT0GGk&quot;,
+    dq: &quot;jmE2DiIPdhwDgLXAQpIaBqQ81bO3XfVT_LRULAwwwwlPuQV148H04zlh9TJ6Y2GZHYokV1U0eOBpJxfkb7dLYtpJpuiBjRf4yIUEoGlkkI_QlJnFSFr-YjGRdfNHqWBkxlSMZL770R9mIATndGkH7z5x-r9KwBZFC4FCG2hg_zE&quot;,
+    qi: &quot;YCX_pLwbMBA1ThVH0WcwmnytqNcrMCEwTm7ByA2eU6nWbQrULvf7m9_kzfLUcjsnpAVlBQG5JMXMy0Sq4ptwbywsa5-G8KAOOOR2L3v4hC-Eys9ftgFM_3i0o40eeQH4b3haPbntrIeMg8IzlOuVYKf9-2QuKDoWeRdd7NsdxTk&quot;
+};
+var encryptAlgorithm = {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-1&quot;};
+var extractable = true;
+var nonExtractable = false;
+
+debug(&quot;Importing RSA keys...&quot;);
+crypto.subtle.importKey(&quot;jwk&quot;, asciiToUint8Array(JSON.stringify(publicKeyJSON)), null, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;]).then(function(result) {
+    publicKey = result;
+    return crypto.subtle.importKey(&quot;jwk&quot;, asciiToUint8Array(JSON.stringify(privateKeyJSON)), null, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;]);
+}).then(function(result) {
+    privateKey = result;
+
+    debug(&quot;Encrypting a 214 byte buffer with RSA-OAEP SHA-1, 2048 bit key...&quot;);
+    return crypto.subtle.encrypt({name: &quot;RSA-OAEP&quot;, hash: &quot;SHA-1&quot;}, publicKey, new Uint8Array(214));
+}).then(function(result) {
+    testPassed(&quot;Succeeded&quot;);
+    debug(&quot;Encrypting a 215 byte buffer...&quot;);
+    return crypto.subtle.encrypt({name: &quot;RSA-OAEP&quot;, hash: &quot;SHA-1&quot;}, publicKey, new Uint8Array(215));
+}).then(function(result) {
+    testFailed(&quot;Succeeded&quot;);
+    finishJSTest();
+}, function(result) {
+    testPassed(&quot;Rejected&quot;);
+    finishJSTest();
+});
+&lt;/script&gt;
+
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">Property changes on: trunk/LayoutTests/crypto/subtle/rsa-oaep-plaintext-length.html
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkLayoutTestscryptosubtlersaoaepwrapunwrapaesexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/rsa-oaep-wrap-unwrap-aes-expected.txt (0 => 159944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsa-oaep-wrap-unwrap-aes-expected.txt                                (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsa-oaep-wrap-unwrap-aes-expected.txt        2013-12-02 19:50:51 UTC (rev 159944)
</span><span class="lines">@@ -0,0 +1,34 @@
</span><ins>+Test wrapping and unwrapping AES keys with RSA-OAEP.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+Importing RSA keys...
+Importing an AES key...
+Wrapping it...
+PASS wrappedKey.toString() is '[object ArrayBuffer]'
+Unwrapping it...
+PASS unwrappedKey.toString() is '[object Key]'
+PASS unwrappedKey.type is 'secret'
+PASS unwrappedKey.extractable is true
+PASS unwrappedKey.algorithm.name is 'aes-cbc'
+PASS unwrappedKey.algorithm.length is 256
+PASS unwrappedKey.usages is ['encrypt', 'decrypt']
+Exporting it...
+PASS bytesToHexString(unwrappedKeyData) is bytesToHexString(aesKeyData)
+
+Wrapping the same key as JWK...
+PASS wrappedKey.toString() is '[object ArrayBuffer]'
+Unwrapping it...
+PASS unwrappedKey.toString() is '[object Key]'
+PASS unwrappedKey.type is 'secret'
+PASS unwrappedKey.extractable is true
+PASS unwrappedKey.algorithm.name is 'aes-cbc'
+PASS unwrappedKey.algorithm.length is 256
+PASS unwrappedKey.usages is ['encrypt', 'decrypt']
+Exporting it...
+PASS bytesToHexString(unwrappedKeyData) is bytesToHexString(aesKeyData)
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins><span class="cx">Property changes on: trunk/LayoutTests/crypto/subtle/rsa-oaep-wrap-unwrap-aes-expected.txt
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkLayoutTestscryptosubtlersaoaepwrapunwrapaeshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/rsa-oaep-wrap-unwrap-aes.html (0 => 159944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/rsa-oaep-wrap-unwrap-aes.html                                (rev 0)
+++ trunk/LayoutTests/crypto/subtle/rsa-oaep-wrap-unwrap-aes.html        2013-12-02 19:50:51 UTC (rev 159944)
</span><span class="lines">@@ -0,0 +1,103 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;resources/common.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+
+&lt;script&gt;
+description(&quot;Test wrapping and unwrapping AES keys with RSA-OAEP.&quot;);
+
+jsTestIsAsync = true;
+
+var publicKeyJSON = {
+    kty: &quot;RSA&quot;,
+    alg: &quot;RSA-OAEP&quot;,
+    n: &quot;rcCUCv7Oc1HVam1DIhCzqknThWawOp8QLk8Ziy2p10ByjQFCajoFiyuAWl-R1WXZaf4xitLRracT9agpzIzc-MbLSHIGgWQGO21lGiImy5ftZ-D8bHAqRz2y15pzD4c4CEou7XSSLDoRnR0QG5MsDhD6s2gV9mwHkrtkCxtMWdBi-77as8wGmlNRldcOSgZDLK8UnCSgA1OguZ989bFyc8tOOEIb0xUSfPSz3LPSCnyYz68aDjmKVeNH-ig857OScyWbGyEy3Biw64qun3juUlNWsJ3zngkOdteYWytx5Qr4XKNs6R-Myyq72KUp02mJDZiiyiglxML_i3-_CeecCw&quot;,
+    e: &quot;AQAB&quot;
+};
+
+var privateKeyJSON = {
+    kty: &quot;RSA&quot;,
+    alg: &quot;RSA-OAEP&quot;,
+    n: &quot;rcCUCv7Oc1HVam1DIhCzqknThWawOp8QLk8Ziy2p10ByjQFCajoFiyuAWl-R1WXZaf4xitLRracT9agpzIzc-MbLSHIGgWQGO21lGiImy5ftZ-D8bHAqRz2y15pzD4c4CEou7XSSLDoRnR0QG5MsDhD6s2gV9mwHkrtkCxtMWdBi-77as8wGmlNRldcOSgZDLK8UnCSgA1OguZ989bFyc8tOOEIb0xUSfPSz3LPSCnyYz68aDjmKVeNH-ig857OScyWbGyEy3Biw64qun3juUlNWsJ3zngkOdteYWytx5Qr4XKNs6R-Myyq72KUp02mJDZiiyiglxML_i3-_CeecCw&quot;,
+    e: &quot;AQAB&quot;,
+    d: &quot;eNLS37aCz7RXSNPD_DtLBJ6j5T8cSxdzRBCjPaI6WcGqJp16lq3UTwuoDLAqlA9oGYm238dsIWpuucP_lQtbWe-7SpxoI6_vmYGf7YVUHv1-DF9qiOmSrMmdxMnVOzYXY8RaT6thPjn_J5cfLV2xI_LwsrMtmpdSyNlgX0zTUhwtuahgAKMEChYjH2EnjHdHw6sY2-wApdcQI7ULE0oo5RzbQZpmuhcN9hiBc0L3hhF0qo50mbl02_65_GQ7DpVkXBxNgRBLzlPabmzzG2oAhfefLgYmSC1opaCkXE6vRWQNWNL45RZNZFYM3uoJghOMqGeocM0BpjdChHrPOlFvSQ&quot;,
+    p: &quot;4miTuAjKMeH5uJ5KB397QUwhbkYEgSbcA2mifmSkvE2018gb55qkBHK1eVryf1_m43LNlc6O_ak6gfzdZIZvS5NCGjPl0q09plUpu8qFOSspBwA67qGH76lFlZLn_d4yglS7wfLru4_5Ys8qLLs-DqVLviwposOnyyWqwM5AXp0&quot;,
+    q: &quot;xHYrzkivtmnz_sGchnWGc0q-pDOkKicptRpv2pMFIIXxnFX5aMeEXIZjVujXtwUy1UlFIN2GZJSvy5KJ79mu_XyNnFHMzedH-A3ee3u8h1UUrZF-vUu1_e4U_x67NN1dedzUSKynN7pFl3OkuShMBWGV-cwzOPdcVAfVuZlxUMc&quot;,
+    dp: &quot;fBzDzYDUBmBQGop7Hn0dvf_T27V6RqpctWo074CQZcFbP2atFVtKSj3viWT3xid2VHzcgiDHdfpM3nEVlEO1wwIonGCSvdjGEOZiiFVOjrZAOVxA8guOjyyFvqbXke06VwPIIVvfKeSU2zuhbP__1tt6F_fxow4Kb2xonGT0GGk&quot;,
+    dq: &quot;jmE2DiIPdhwDgLXAQpIaBqQ81bO3XfVT_LRULAwwwwlPuQV148H04zlh9TJ6Y2GZHYokV1U0eOBpJxfkb7dLYtpJpuiBjRf4yIUEoGlkkI_QlJnFSFr-YjGRdfNHqWBkxlSMZL770R9mIATndGkH7z5x-r9KwBZFC4FCG2hg_zE&quot;,
+    qi: &quot;YCX_pLwbMBA1ThVH0WcwmnytqNcrMCEwTm7ByA2eU6nWbQrULvf7m9_kzfLUcjsnpAVlBQG5JMXMy0Sq4ptwbywsa5-G8KAOOOR2L3v4hC-Eys9ftgFM_3i0o40eeQH4b3haPbntrIeMg8IzlOuVYKf9-2QuKDoWeRdd7NsdxTk&quot;
+};
+var wrapAlgorithm = {name: &quot;RSA-OAEP&quot;, hash: &quot;sha-1&quot;};
+var extractable = true;
+var nonExtractable = false;
+
+debug(&quot;Importing RSA keys...&quot;);
+crypto.subtle.importKey(&quot;jwk&quot;, asciiToUint8Array(JSON.stringify(publicKeyJSON)), null, extractable, [&quot;wrapKey&quot;, &quot;unwrapKey&quot;]).then(function(result) {
+    publicKey = result;
+    return crypto.subtle.importKey(&quot;jwk&quot;, asciiToUint8Array(JSON.stringify(privateKeyJSON)), null, extractable, [&quot;wrapKey&quot;, &quot;unwrapKey&quot;]);
+}).then(function(result) {
+    privateKey = result;
+
+    debug(&quot;Importing an AES key...&quot;);
+    aesKeyData = hexStringToUint8Array(&quot;603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4&quot;);
+    return crypto.subtle.importKey(&quot;raw&quot;, aesKeyData, &quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;, &quot;wrapKey&quot;, &quot;unwrapKey&quot;])
+}).then(function(result) {
+    aesKey = result;
+    debug(&quot;Wrapping it...&quot;);
+
+    return crypto.subtle.wrapKey(&quot;raw&quot;, aesKey, publicKey, wrapAlgorithm);
+}).then(function(result) {
+    wrappedKey = result;
+    shouldBe(&quot;wrappedKey.toString()&quot;, &quot;'[object ArrayBuffer]'&quot;);
+
+    debug(&quot;Unwrapping it...&quot;);
+    return crypto.subtle.unwrapKey(&quot;raw&quot;, wrappedKey, privateKey, wrapAlgorithm, &quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;]);
+}).then(function(result) {
+    unwrappedKey = result;
+    shouldBe(&quot;unwrappedKey.toString()&quot;, &quot;'[object Key]'&quot;);
+    shouldBe(&quot;unwrappedKey.type&quot;, &quot;'secret'&quot;);
+    shouldBe(&quot;unwrappedKey.extractable&quot;, &quot;true&quot;);
+    shouldBe(&quot;unwrappedKey.algorithm.name&quot;, &quot;'aes-cbc'&quot;);
+    shouldBe(&quot;unwrappedKey.algorithm.length&quot;, &quot;256&quot;);
+    shouldBe(&quot;unwrappedKey.usages&quot;, &quot;['encrypt', 'decrypt']&quot;);
+
+    debug(&quot;Exporting it...&quot;);
+    return crypto.subtle.exportKey(&quot;raw&quot;, unwrappedKey);
+}).then(function(result) {
+    unwrappedKeyData = result;
+    shouldBe(&quot;bytesToHexString(unwrappedKeyData)&quot;, &quot;bytesToHexString(aesKeyData)&quot;);
+
+    debug(&quot;\nWrapping the same key as JWK...&quot;);
+    return crypto.subtle.wrapKey(&quot;jwk&quot;, aesKey, publicKey, wrapAlgorithm);
+}).then(function(result) {
+    wrappedKey = result;
+    shouldBe(&quot;wrappedKey.toString()&quot;, &quot;'[object ArrayBuffer]'&quot;);
+
+    debug(&quot;Unwrapping it...&quot;);
+    return crypto.subtle.unwrapKey(&quot;jwk&quot;, wrappedKey, privateKey, wrapAlgorithm, &quot;aes-cbc&quot;, extractable, [&quot;encrypt&quot;, &quot;decrypt&quot;]);
+}).then(function(result) {
+    unwrappedKey = result;
+    shouldBe(&quot;unwrappedKey.toString()&quot;, &quot;'[object Key]'&quot;);
+    shouldBe(&quot;unwrappedKey.type&quot;, &quot;'secret'&quot;);
+    shouldBe(&quot;unwrappedKey.extractable&quot;, &quot;true&quot;);
+    shouldBe(&quot;unwrappedKey.algorithm.name&quot;, &quot;'aes-cbc'&quot;);
+    shouldBe(&quot;unwrappedKey.algorithm.length&quot;, &quot;256&quot;);
+    shouldBe(&quot;unwrappedKey.usages&quot;, &quot;['encrypt', 'decrypt']&quot;);
+
+    debug(&quot;Exporting it...&quot;);
+    return crypto.subtle.exportKey(&quot;raw&quot;, unwrappedKey);
+}).then(function(result) {
+    unwrappedKeyData = result;
+    shouldBe(&quot;bytesToHexString(unwrappedKeyData)&quot;, &quot;bytesToHexString(aesKeyData)&quot;);
+    finishJSTest();
+});
+&lt;/script&gt;
+
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">Property changes on: trunk/LayoutTests/crypto/subtle/rsa-oaep-wrap-unwrap-aes.html
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (159943 => 159944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2013-12-02 19:49:43 UTC (rev 159943)
+++ trunk/Source/WebCore/ChangeLog        2013-12-02 19:50:51 UTC (rev 159944)
</span><span class="lines">@@ -1,3 +1,54 @@
</span><ins>+2013-12-02  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        Add support for WebCrypto RSA-OAEP
+        https://bugs.webkit.org/show_bug.cgi?id=125084
+
+        Reviewed by Sam Weinig.
+
+        Tests: crypto/subtle/rsa-oaep-key-manipulation.html
+               crypto/subtle/rsa-oaep-plaintext-length.html
+               crypto/subtle/rsa-oaep-wrap-unwrap-aes.html
+
+        * WebCore.xcodeproj/project.pbxproj: Added new files.
+
+        * bindings/js/JSCryptoAlgorithmDictionary.cpp:
+        (WebCore::createRsaOaepParams):
+        (WebCore::JSCryptoAlgorithmDictionary::createParametersForEncrypt):
+        (WebCore::JSCryptoAlgorithmDictionary::createParametersForDecrypt):
+        (WebCore::JSCryptoAlgorithmDictionary::createParametersForImportKey):
+        Added RSA-OAEP parameters.
+
+        * bindings/js/JSCryptoKeySerializationJWK.cpp:
+        (WebCore::JSCryptoKeySerializationJWK::reconcileAlgorithm):
+        (WebCore::JSCryptoKeySerializationJWK::keySizeIsValid):
+        (WebCore::JSCryptoKeySerializationJWK::addJWKAlgorithmToJSON):
+        Support RSA-OAEP in JWK. It is more limited than general WebCrypto, as JWK only
+        allows SHA-1 as hash.
+
+        * crypto/CommonCryptoUtilities.cpp: Added. (WebCore::getCommonCryptoDigestAlgorithm):
+        * crypto/CommonCryptoUtilities.h: Added.
+        Extracted some shared code and forward declarations for CommonCrypto.
+
+        * crypto/CryptoAlgorithmParameters.h: (WebCore::CryptoAlgorithmParameters::Class):
+        * crypto/parameters/CryptoAlgorithmRsaOaepParams.h: Added.
+        Added RsaOaepParams.
+
+        * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp: Added.
+        * crypto/algorithms/CryptoAlgorithmRSA_OAEP.h: Added.
+        * crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp: Added.
+
+        * crypto/mac/CryptoAlgorithmHMACMac.cpp:
+        (WebCore::getCommonCryptoHMACAlgorithm):
+        (WebCore::CryptoAlgorithmHMAC::platformSign):
+        (WebCore::CryptoAlgorithmHMAC::platformVerify):
+        * crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp:
+        * crypto/mac/CryptoKeyMac.cpp:
+        * crypto/mac/CryptoKeyRSAMac.cpp:
+        Use CommonCryptoUtilities.
+
+        * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
+        (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms): Register RSA-OAEP.
+
</ins><span class="cx"> 2013-12-02  Andres Gomez  &lt;agomez@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] Fails to build with freetype 2.5.1
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (159943 => 159944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2013-12-02 19:49:43 UTC (rev 159943)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2013-12-02 19:50:51 UTC (rev 159944)
</span><span class="lines">@@ -5728,6 +5728,12 @@
</span><span class="cx">                 E1F80B8E183172B5007885C3 /* JSCryptoKeyPair.h in Headers */ = {isa = PBXBuildFile; fileRef = E1F80B8C183172B5007885C3 /* JSCryptoKeyPair.h */; };
</span><span class="cx">                 E1FE13641834351100892F13 /* CryptoDigestMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1FE13621834351100892F13 /* CryptoDigestMac.cpp */; };
</span><span class="cx">                 E1FE136718343A1000892F13 /* CryptoDigest.h in Headers */ = {isa = PBXBuildFile; fileRef = E1FE136618343A1000892F13 /* CryptoDigest.h */; };
</span><ins>+                E1FE136A183FE1AB00892F13 /* CryptoAlgorithmRSA_OAEP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1FE1368183FE1AB00892F13 /* CryptoAlgorithmRSA_OAEP.cpp */; };
+                E1FE136B183FE1AB00892F13 /* CryptoAlgorithmRSA_OAEP.h in Headers */ = {isa = PBXBuildFile; fileRef = E1FE1369183FE1AB00892F13 /* CryptoAlgorithmRSA_OAEP.h */; };
+                E1FE136D183FE21D00892F13 /* CryptoAlgorithmRsaOaepParams.h in Headers */ = {isa = PBXBuildFile; fileRef = E1FE136C183FE21D00892F13 /* CryptoAlgorithmRsaOaepParams.h */; };
+                E1FE1370183FECF000892F13 /* CryptoAlgorithmRSA_OAEPMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1FE136E183FECF000892F13 /* CryptoAlgorithmRSA_OAEPMac.cpp */; };
+                E1FE137418402A6700892F13 /* CommonCryptoUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1FE137218402A6700892F13 /* CommonCryptoUtilities.cpp */; };
+                E1FE137518402A6700892F13 /* CommonCryptoUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = E1FE137318402A6700892F13 /* CommonCryptoUtilities.h */; };
</ins><span class="cx">                 E1FF57A30F01255B00891EBB /* ThreadGlobalData.h in Headers */ = {isa = PBXBuildFile; fileRef = E1FF57A20F01255B00891EBB /* ThreadGlobalData.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 E1FF57A60F01256B00891EBB /* ThreadGlobalData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1FF57A50F01256B00891EBB /* ThreadGlobalData.cpp */; };
</span><span class="cx">                 E1FF8F5F1807442100132674 /* SubtleCrypto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1FF8F5D1807442100132674 /* SubtleCrypto.cpp */; };
</span><span class="lines">@@ -12848,6 +12854,12 @@
</span><span class="cx">                 E1F80B8C183172B5007885C3 /* JSCryptoKeyPair.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCryptoKeyPair.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E1FE13621834351100892F13 /* CryptoDigestMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CryptoDigestMac.cpp; path = mac/CryptoDigestMac.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E1FE136618343A1000892F13 /* CryptoDigest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoDigest.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                E1FE1368183FE1AB00892F13 /* CryptoAlgorithmRSA_OAEP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoAlgorithmRSA_OAEP.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                E1FE1369183FE1AB00892F13 /* CryptoAlgorithmRSA_OAEP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmRSA_OAEP.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                E1FE136C183FE21D00892F13 /* CryptoAlgorithmRsaOaepParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CryptoAlgorithmRsaOaepParams.h; path = parameters/CryptoAlgorithmRsaOaepParams.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                E1FE136E183FECF000892F13 /* CryptoAlgorithmRSA_OAEPMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CryptoAlgorithmRSA_OAEPMac.cpp; path = mac/CryptoAlgorithmRSA_OAEPMac.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                E1FE137218402A6700892F13 /* CommonCryptoUtilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CommonCryptoUtilities.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                E1FE137318402A6700892F13 /* CommonCryptoUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommonCryptoUtilities.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 E1FF57A20F01255B00891EBB /* ThreadGlobalData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadGlobalData.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E1FF57A50F01256B00891EBB /* ThreadGlobalData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThreadGlobalData.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 E1FF8F5C1807364B00132674 /* SubtleCrypto.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = SubtleCrypto.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -20406,10 +20418,13 @@
</span><span class="cx">                 E172AF71180F343400FBADB9 /* mac */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                E1FE137218402A6700892F13 /* CommonCryptoUtilities.cpp */,
+                                E1FE137318402A6700892F13 /* CommonCryptoUtilities.h */,
</ins><span class="cx">                                 E125F843182425C900D84CD9 /* CryptoAlgorithmAES_CBCMac.cpp */,
</span><span class="cx">                                 E125F8371822F1EB00D84CD9 /* CryptoAlgorithmHMACMac.cpp */,
</span><span class="cx">                                 E1BB84AC1822CA7400525043 /* CryptoAlgorithmRegistryMac.cpp */,
</span><span class="cx">                                 E1C266D618317AB4003F8B33 /* CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp */,
</span><ins>+                                E1FE136E183FECF000892F13 /* CryptoAlgorithmRSA_OAEPMac.cpp */,
</ins><span class="cx">                                 E19AC3F8182566F700349426 /* CryptoKeyMac.cpp */,
</span><span class="cx">                                 E164FAA418315E1A00DB4E61 /* CryptoKeyRSAMac.cpp */,
</span><span class="cx">                                 E1FE13621834351100892F13 /* CryptoDigestMac.cpp */,
</span><span class="lines">@@ -20424,6 +20439,8 @@
</span><span class="cx">                                 E125F8401824253A00D84CD9 /* CryptoAlgorithmAES_CBC.h */,
</span><span class="cx">                                 E125F82F1822F11B00D84CD9 /* CryptoAlgorithmHMAC.cpp */,
</span><span class="cx">                                 E125F8301822F11B00D84CD9 /* CryptoAlgorithmHMAC.h */,
</span><ins>+                                E1FE1368183FE1AB00892F13 /* CryptoAlgorithmRSA_OAEP.cpp */,
+                                E1FE1369183FE1AB00892F13 /* CryptoAlgorithmRSA_OAEP.h */,
</ins><span class="cx">                                 E1BD3317182D8DDD00C05D9F /* CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp */,
</span><span class="cx">                                 E1BD3318182D8DDD00C05D9F /* CryptoAlgorithmRSASSA_PKCS1_v1_5.h */,
</span><span class="cx">                                 E125F8291822CFEC00D84CD9 /* CryptoAlgorithmSHA1.cpp */,
</span><span class="lines">@@ -22437,6 +22454,7 @@
</span><span class="cx">                                 1C4C8F020AD85D87009475CE /* DeleteButtonController.h in Headers */,
</span><span class="cx">                                 93309DDF099E64920056E581 /* DeleteFromTextNodeCommand.h in Headers */,
</span><span class="cx">                                 07C59B6417F4D1C4000FBCBB /* MockMediaStreamCenter.h in Headers */,
</span><ins>+                                E1FE136B183FE1AB00892F13 /* CryptoAlgorithmRSA_OAEP.h in Headers */,
</ins><span class="cx">                                 93309DE1099E64920056E581 /* DeleteSelectionCommand.h in Headers */,
</span><span class="cx">                                 FD1660A513787C6D001FFA7B /* DenormalDisabler.h in Headers */,
</span><span class="cx">                                 E100EE761546EAC100BA11D1 /* DeprecatedStyleBuilder.h in Headers */,
</span><span class="lines">@@ -22586,6 +22604,7 @@
</span><span class="cx">                                 BC00F0090E0A185500FD04E3 /* DOMFileListInternal.h in Headers */,
</span><span class="cx">                                 2ED609BD1145B07100C8684E /* DOMFormData.h in Headers */,
</span><span class="cx">                                 BC1A37B6097C715F0019F3D8 /* DOMHTML.h in Headers */,
</span><ins>+                                E1FE137518402A6700892F13 /* CommonCryptoUtilities.h in Headers */,
</ins><span class="cx">                                 85DF81270AA7787200486AD7 /* DOMHTMLAnchorElement.h in Headers */,
</span><span class="cx">                                 B595FF471824CEE300FF51CD /* RenderIterator.h in Headers */,
</span><span class="cx">                                 85E7119B0AC5D5350053270F /* DOMHTMLAnchorElementInternal.h in Headers */,
</span><span class="lines">@@ -23706,6 +23725,7 @@
</span><span class="cx">                                 E19AC3EF1824DC7900349426 /* CryptoAlgorithmSHA224.h in Headers */,
</span><span class="cx">                                 078E092B17D14D1C00420AA1 /* RTCStatsRequestImpl.h in Headers */,
</span><span class="cx">                                 B266CD4E0C3AEC6500EB08D2 /* JSSVGException.h in Headers */,
</span><ins>+                                E1FE136D183FE21D00892F13 /* CryptoAlgorithmRsaOaepParams.h in Headers */,
</ins><span class="cx">                                 B2FA3D6B0AB75A6F000E5AC4 /* JSSVGFEBlendElement.h in Headers */,
</span><span class="cx">                                 B2FA3D6D0AB75A6F000E5AC4 /* JSSVGFEColorMatrixElement.h in Headers */,
</span><span class="cx">                                 B2FA3D6F0AB75A6F000E5AC4 /* JSSVGFEComponentTransferElement.h in Headers */,
</span><span class="lines">@@ -26712,6 +26732,7 @@
</span><span class="cx">                                 1403BA0C09EB18C700797C7F /* JSDOMWindow.cpp in Sources */,
</span><span class="cx">                                 BC6932730D7E293900AE44D1 /* JSDOMWindowBase.cpp in Sources */,
</span><span class="cx">                                 BCD9C2620C17AA67005C90A2 /* JSDOMWindowCustom.cpp in Sources */,
</span><ins>+                                E1FE136A183FE1AB00892F13 /* CryptoAlgorithmRSA_OAEP.cpp in Sources */,
</ins><span class="cx">                                 BCBFB53C0DCD29CF0019B3E5 /* JSDOMWindowShell.cpp in Sources */,
</span><span class="cx">                                 FD7868B9136B999200D403DF /* JSDynamicsCompressorNode.cpp in Sources */,
</span><span class="cx">                                 65DF31F909D1CC60000BE325 /* JSElement.cpp in Sources */,
</span><span class="lines">@@ -28159,6 +28180,7 @@
</span><span class="cx">                                 1FAFBF1815A5FA6E00083A20 /* UTIUtilities.mm in Sources */,
</span><span class="cx">                                 2E3BBF071162DA1100B9409A /* UUID.cpp in Sources */,
</span><span class="cx">                                 50D32857163B313F0016111E /* ValidatedCustomFilterOperation.cpp in Sources */,
</span><ins>+                                E1FE137418402A6700892F13 /* CommonCryptoUtilities.cpp in Sources */,
</ins><span class="cx">                                 F5A154271279534D00D0B0C0 /* ValidationMessage.cpp in Sources */,
</span><span class="cx">                                 FD3160AE12B026F700C1A359 /* VectorMath.cpp in Sources */,
</span><span class="cx">                                 BE88E0DE1715D2A200658D98 /* VideoTrack.cpp in Sources */,
</span><span class="lines">@@ -28202,6 +28224,7 @@
</span><span class="cx">                                 01D3CF8414BD0A3000FE9970 /* WebGLContextObject.cpp in Sources */,
</span><span class="cx">                                 A0EE0DF5144F825500F80B0D /* WebGLDebugRendererInfo.cpp in Sources */,
</span><span class="cx">                                 A0EE0DF7144F825500F80B0D /* WebGLDebugShaders.cpp in Sources */,
</span><ins>+                                E1FE1370183FECF000892F13 /* CryptoAlgorithmRSA_OAEPMac.cpp in Sources */,
</ins><span class="cx">                                 6E3FAE8E14733FDB00E42307 /* WebGLDepthTexture.cpp in Sources */,
</span><span class="cx">                                 6EBF0E5412A8929800DB1709 /* WebGLExtension.cpp in Sources */,
</span><span class="cx">                                 49C7B9CE1042D32F0009D447 /* WebGLFramebuffer.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSCryptoAlgorithmDictionarycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSCryptoAlgorithmDictionary.cpp (159943 => 159944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSCryptoAlgorithmDictionary.cpp        2013-12-02 19:49:43 UTC (rev 159943)
+++ trunk/Source/WebCore/bindings/js/JSCryptoAlgorithmDictionary.cpp        2013-12-02 19:50:51 UTC (rev 159944)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> #include &quot;CryptoAlgorithmRegistry.h&quot;
</span><span class="cx"> #include &quot;CryptoAlgorithmRsaKeyGenParams.h&quot;
</span><span class="cx"> #include &quot;CryptoAlgorithmRsaKeyParamsWithHash.h&quot;
</span><ins>+#include &quot;CryptoAlgorithmRsaOaepParams.h&quot;
</ins><span class="cx"> #include &quot;CryptoAlgorithmRsaSsaParams.h&quot;
</span><span class="cx"> #include &quot;ExceptionCode.h&quot;
</span><span class="cx"> #include &quot;JSCryptoOperationData.h&quot;
</span><span class="lines">@@ -244,6 +245,40 @@
</span><span class="cx">     return std::make_unique&lt;CryptoAlgorithmRsaKeyParamsWithHash&gt;();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static std::unique_ptr&lt;CryptoAlgorithmParameters&gt; createRsaOaepParams(ExecState* exec, JSValue value)
+{
+    if (!value.isObject()) {
+        throwTypeError(exec);
+        return nullptr;
+    }
+
+    JSDictionary jsDictionary(exec, value.getObject());
+    auto result = std::make_unique&lt;CryptoAlgorithmRsaOaepParams&gt;();
+
+    if (!getHashAlgorithm(jsDictionary, result-&gt;hash)) {
+        ASSERT(exec-&gt;hadException());
+        return nullptr;
+    }
+
+    JSValue labelValue = getProperty(exec, value.getObject(), &quot;label&quot;);
+    if (exec-&gt;hadException())
+        return nullptr;
+
+    result-&gt;hasLabel = !labelValue.isUndefinedOrNull();
+    if (!result-&gt;hasLabel)
+        return std::move(result);
+
+    CryptoOperationData labelData;
+    if (!cryptoOperationDataFromJSValue(exec, labelValue, labelData)) {
+        ASSERT(exec-&gt;hadException());
+        return nullptr;
+    }
+
+    result-&gt;label.append(labelData.first, labelData.second);
+
+    return std::move(result);
+}
+
</ins><span class="cx"> static std::unique_ptr&lt;CryptoAlgorithmParameters&gt; createRsaSsaParams(ExecState* exec, JSValue value)
</span><span class="cx"> {
</span><span class="cx">     if (!value.isObject()) {
</span><span class="lines">@@ -268,7 +303,10 @@
</span><span class="cx">     case CryptoAlgorithmIdentifier::RSAES_PKCS1_v1_5:
</span><span class="cx">     case CryptoAlgorithmIdentifier::RSASSA_PKCS1_v1_5:
</span><span class="cx">     case CryptoAlgorithmIdentifier::RSA_PSS:
</span><ins>+        setDOMException(exec, NOT_SUPPORTED_ERR);
+        return nullptr;
</ins><span class="cx">     case CryptoAlgorithmIdentifier::RSA_OAEP:
</span><ins>+        return createRsaOaepParams(exec, value);
</ins><span class="cx">     case CryptoAlgorithmIdentifier::ECDSA:
</span><span class="cx">     case CryptoAlgorithmIdentifier::ECDH:
</span><span class="cx">     case CryptoAlgorithmIdentifier::AES_CTR:
</span><span class="lines">@@ -300,7 +338,10 @@
</span><span class="cx">     case CryptoAlgorithmIdentifier::RSAES_PKCS1_v1_5:
</span><span class="cx">     case CryptoAlgorithmIdentifier::RSASSA_PKCS1_v1_5:
</span><span class="cx">     case CryptoAlgorithmIdentifier::RSA_PSS:
</span><ins>+        setDOMException(exec, NOT_SUPPORTED_ERR);
+        return nullptr;
</ins><span class="cx">     case CryptoAlgorithmIdentifier::RSA_OAEP:
</span><ins>+        return createRsaOaepParams(exec, value);
</ins><span class="cx">     case CryptoAlgorithmIdentifier::ECDSA:
</span><span class="cx">     case CryptoAlgorithmIdentifier::ECDH:
</span><span class="cx">     case CryptoAlgorithmIdentifier::AES_CTR:
</span><span class="lines">@@ -528,7 +569,9 @@
</span><span class="cx">     case CryptoAlgorithmIdentifier::RSASSA_PKCS1_v1_5:
</span><span class="cx">         return createRsaKeyParamsWithHash(exec, value);
</span><span class="cx">     case CryptoAlgorithmIdentifier::RSA_PSS:
</span><ins>+        return std::make_unique&lt;CryptoAlgorithmParameters&gt;();
</ins><span class="cx">     case CryptoAlgorithmIdentifier::RSA_OAEP:
</span><ins>+        return createRsaKeyParamsWithHash(exec, value);
</ins><span class="cx">     case CryptoAlgorithmIdentifier::ECDSA:
</span><span class="cx">     case CryptoAlgorithmIdentifier::ECDH:
</span><span class="cx">     case CryptoAlgorithmIdentifier::AES_CTR:
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSCryptoKeySerializationJWKcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSCryptoKeySerializationJWK.cpp (159943 => 159944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSCryptoKeySerializationJWK.cpp        2013-12-02 19:49:43 UTC (rev 159943)
+++ trunk/Source/WebCore/bindings/js/JSCryptoKeySerializationJWK.cpp        2013-12-02 19:50:51 UTC (rev 159944)
</span><span class="lines">@@ -190,6 +190,9 @@
</span><span class="cx">     } else if (m_jwkAlgorithmName == &quot;RS512&quot;) {
</span><span class="cx">         algorithm = CryptoAlgorithmRegistry::shared().create(CryptoAlgorithmIdentifier::RSASSA_PKCS1_v1_5);
</span><span class="cx">         parameters = createRSAKeyParametersWithHash(CryptoAlgorithmIdentifier::SHA_512);
</span><ins>+    } else if (m_jwkAlgorithmName == &quot;RSA-OAEP&quot;) {
+        algorithm = CryptoAlgorithmRegistry::shared().create(CryptoAlgorithmIdentifier::RSA_OAEP);
+        parameters = createRSAKeyParametersWithHash(CryptoAlgorithmIdentifier::SHA_1);
</ins><span class="cx">     } else if (m_jwkAlgorithmName == &quot;A128CBC&quot;) {
</span><span class="cx">         algorithm = CryptoAlgorithmRegistry::shared().create(CryptoAlgorithmIdentifier::AES_CBC);
</span><span class="cx">         parameters = std::make_unique&lt;CryptoAlgorithmParameters&gt;();
</span><span class="lines">@@ -218,7 +221,8 @@
</span><span class="cx"> 
</span><span class="cx">     if (algorithm-&gt;identifier() == CryptoAlgorithmIdentifier::HMAC)
</span><span class="cx">         return toCryptoAlgorithmHmacParams(*parameters).hash == toCryptoAlgorithmHmacParams(*suggestedParameters).hash;
</span><del>-    if (algorithm-&gt;identifier() == CryptoAlgorithmIdentifier::RSASSA_PKCS1_v1_5) {
</del><ins>+    if (algorithm-&gt;identifier() == CryptoAlgorithmIdentifier::RSASSA_PKCS1_v1_5
+        || algorithm-&gt;identifier() == CryptoAlgorithmIdentifier::RSA_OAEP) {
</ins><span class="cx">         CryptoAlgorithmRsaKeyParamsWithHash&amp; rsaKeyParameters = toCryptoAlgorithmRsaKeyParamsWithHash(*parameters);
</span><span class="cx">         CryptoAlgorithmRsaKeyParamsWithHash&amp; suggestedRSAKeyParameters = toCryptoAlgorithmRsaKeyParamsWithHash(*suggestedParameters);
</span><span class="cx">         ASSERT(rsaKeyParameters.hasHash);
</span><span class="lines">@@ -283,6 +287,8 @@
</span><span class="cx">         return sizeInBits &gt;= 2048;
</span><span class="cx">     if (m_jwkAlgorithmName == &quot;RS512&quot;)
</span><span class="cx">         return sizeInBits &gt;= 2048;
</span><ins>+    if (m_jwkAlgorithmName == &quot;RSA_OAEP&quot;)
+        return sizeInBits &gt;= 2048;
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -538,6 +544,17 @@
</span><span class="cx">         }
</span><span class="cx">         break;
</span><span class="cx">     }
</span><ins>+    case CryptoAlgorithmIdentifier::RSA_OAEP: {
+        const CryptoKeyRSA&amp; rsaKey = toCryptoKeyRSA(key);
+        CryptoAlgorithmIdentifier hash;
+        // WebCrypto RSA-OAEP keys are not tied to any particular hash, unless previously imported from JWK, which only supports SHA-1.
+        if (rsaKey.isRestrictedToHash(hash) &amp;&amp; hash != CryptoAlgorithmIdentifier::SHA_1)
+            break;
+        if (rsaKey.keySizeInBits() &lt; 2048)
+            break;
+        jwkAlgorithm = &quot;RSA-OAEP&quot;;
+        break;
+    }
</ins><span class="cx">     default:
</span><span class="cx">         break;
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoCommonCryptoUtilitiescpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/crypto/CommonCryptoUtilities.cpp (0 => 159944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/CommonCryptoUtilities.cpp                                (rev 0)
+++ trunk/Source/WebCore/crypto/CommonCryptoUtilities.cpp        2013-12-02 19:50:51 UTC (rev 159944)
</span><span class="lines">@@ -0,0 +1,58 @@
</span><ins>+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;CommonCryptoUtilities.h&quot;
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+namespace WebCore {
+
+bool getCommonCryptoDigestAlgorithm(CryptoAlgorithmIdentifier hashFunction, CCDigestAlgorithm&amp; algorithm)
+{
+    switch (hashFunction) {
+    case CryptoAlgorithmIdentifier::SHA_1:
+        algorithm = kCCDigestSHA1;
+        return true;
+    case CryptoAlgorithmIdentifier::SHA_224:
+        algorithm = kCCDigestSHA224;
+        return true;
+    case CryptoAlgorithmIdentifier::SHA_256:
+        algorithm = kCCDigestSHA256;
+        return true;
+    case CryptoAlgorithmIdentifier::SHA_384:
+        algorithm = kCCDigestSHA384;
+        return true;
+    case CryptoAlgorithmIdentifier::SHA_512:
+        algorithm = kCCDigestSHA512;
+        return true;
+    default:
+        return false;
+    }
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SUBTLE_CRYPTO)
</ins><span class="cx">Property changes on: trunk/Source/WebCore/crypto/CommonCryptoUtilities.cpp
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkSourceWebCorecryptoCommonCryptoUtilitiesh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/crypto/CommonCryptoUtilities.h (0 => 159944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/CommonCryptoUtilities.h                                (rev 0)
+++ trunk/Source/WebCore/crypto/CommonCryptoUtilities.h        2013-12-02 19:50:51 UTC (rev 159944)
</span><span class="lines">@@ -0,0 +1,94 @@
</span><ins>+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CommonCryptoUtilities_h
+#define CommonCryptoUtilities_h
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+#include &quot;CryptoAlgorithmIdentifier.h&quot;
+
+#if defined(__has_include)
+#if __has_include(&lt;CommonCrypto/CommonRSACryptor.h&gt;)
+#include &lt;CommonCrypto/CommonRSACryptor.h&gt;
+#endif
+#endif
+
+#if defined(__has_include) &amp;&amp; (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1090)
+#if __has_include(&lt;CommonCrypto/CommonRandomSPI.h&gt;)
+#include &lt;CommonCrypto/CommonRandomSPI.h&gt;
+#endif
+#endif
+
+#ifndef _CC_RSACRYPTOR_H_
+enum {
+    kCCDigestSHA1 = 8,
+    kCCDigestSHA224 = 9,
+    kCCDigestSHA256 = 10,
+    kCCDigestSHA384 = 11,
+    kCCDigestSHA512 = 12,
+};
+typedef uint32_t CCDigestAlgorithm;
+
+enum {
+    ccRSAKeyPublic = 0,
+    ccRSAKeyPrivate = 1
+};
+typedef uint32_t CCRSAKeyType;
+
+enum {
+    ccPKCS1Padding = 1001,
+    ccOAEPPadding = 1002
+};
+typedef uint32_t CCAsymmetricPadding;
+
+enum {
+    kCCNotVerified = -4306
+};
+#endif
+
+typedef struct __CCRandom *CCRandomRef;
+extern const CCRandomRef kCCRandomDefault;
+extern &quot;C&quot; int CCRandomCopyBytes(CCRandomRef rnd, void *bytes, size_t count);
+
+extern &quot;C&quot; CCCryptorStatus CCRSACryptorEncrypt(CCRSACryptorRef publicKey, CCAsymmetricPadding padding, const void *plainText, size_t plainTextLen, void *cipherText, size_t *cipherTextLen, const void *tagData, size_t tagDataLen, CCDigestAlgorithm digestType);
+extern &quot;C&quot; CCCryptorStatus CCRSACryptorDecrypt(CCRSACryptorRef privateKey, CCAsymmetricPadding padding, const void *cipherText, size_t cipherTextLen, void *plainText, size_t *plainTextLen, const void *tagData, size_t tagDataLen, CCDigestAlgorithm digestType);
+extern &quot;C&quot; CCCryptorStatus CCRSACryptorSign(CCRSACryptorRef privateKey, CCAsymmetricPadding padding, const void *hashToSign, size_t hashSignLen, CCDigestAlgorithm digestType, size_t saltLen, void *signedData, size_t *signedDataLen);
+extern &quot;C&quot; CCCryptorStatus CCRSACryptorVerify(CCRSACryptorRef publicKey, CCAsymmetricPadding padding, const void *hash, size_t hashLen, CCDigestAlgorithm digestType, size_t saltLen, const void *signedData, size_t signedDataLen);
+extern &quot;C&quot; CCCryptorStatus CCRSACryptorCreateFromData(CCRSAKeyType keyType, uint8_t *modulus, size_t modulusLength, uint8_t *exponent, size_t exponentLength, uint8_t *p, size_t pLength, uint8_t *q, size_t qLength, CCRSACryptorRef *ref);
+extern &quot;C&quot; CCCryptorStatus CCRSACryptorGeneratePair(size_t keysize, uint32_t e, CCRSACryptorRef *publicKey, CCRSACryptorRef *privateKey);
+extern &quot;C&quot; CCRSACryptorRef CCRSACryptorGetPublicKeyFromPrivateKey(CCRSACryptorRef privkey);
+extern &quot;C&quot; void CCRSACryptorRelease(CCRSACryptorRef key);
+extern &quot;C&quot; CCCryptorStatus CCRSAGetKeyComponents(CCRSACryptorRef rsaKey, uint8_t *modulus, size_t *modulusLength, uint8_t *exponent, size_t *exponentLength, uint8_t *p, size_t *pLength, uint8_t *q, size_t *qLength);
+extern &quot;C&quot; CCRSAKeyType CCRSAGetKeyType(CCRSACryptorRef key);
+
+namespace WebCore {
+
+bool getCommonCryptoDigestAlgorithm(CryptoAlgorithmIdentifier, CCDigestAlgorithm&amp;);
+
+} // namespace WebCore
+
+#endif // ENABLE(SUBTLE_CRYPTO)
+#endif // CommonCryptoUtilities_h
</ins><span class="cx">Property changes on: trunk/Source/WebCore/crypto/CommonCryptoUtilities.h
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkSourceWebCorecryptoCryptoAlgorithmParametersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/CryptoAlgorithmParameters.h (159943 => 159944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/CryptoAlgorithmParameters.h        2013-12-02 19:49:43 UTC (rev 159943)
+++ trunk/Source/WebCore/crypto/CryptoAlgorithmParameters.h        2013-12-02 19:50:51 UTC (rev 159944)
</span><span class="lines">@@ -46,6 +46,7 @@
</span><span class="cx">         HmacParams,
</span><span class="cx">         RsaKeyGenParams,
</span><span class="cx">         RsaKeyParamsWithHash,
</span><ins>+        RsaOaepParams,
</ins><span class="cx">         RsaSsaParams
</span><span class="cx">     };
</span><span class="cx">     virtual Class parametersClass() const { return Class::None; }
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmRSA_OAEPcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp (0 => 159944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp                                (rev 0)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp        2013-12-02 19:50:51 UTC (rev 159944)
</span><span class="lines">@@ -0,0 +1,127 @@
</span><ins>+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;CryptoAlgorithmRSA_OAEP.h&quot;
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+#include &quot;CryptoAlgorithmRsaKeyGenParams.h&quot;
+#include &quot;CryptoAlgorithmRsaKeyParamsWithHash.h&quot;
+#include &quot;CryptoAlgorithmRsaOaepParams.h&quot;
+#include &quot;CryptoKeyDataRSAComponents.h&quot;
+#include &quot;CryptoKeyRSA.h&quot;
+#include &quot;ExceptionCode.h&quot;
+
+namespace WebCore {
+
+const char* const CryptoAlgorithmRSA_OAEP::s_name = &quot;rsa-oaep&quot;;
+
+CryptoAlgorithmRSA_OAEP::CryptoAlgorithmRSA_OAEP()
+{
+}
+
+CryptoAlgorithmRSA_OAEP::~CryptoAlgorithmRSA_OAEP()
+{
+}
+
+std::unique_ptr&lt;CryptoAlgorithm&gt; CryptoAlgorithmRSA_OAEP::create()
+{
+    return std::unique_ptr&lt;CryptoAlgorithm&gt;(new CryptoAlgorithmRSA_OAEP);
+}
+
+CryptoAlgorithmIdentifier CryptoAlgorithmRSA_OAEP::identifier() const
+{
+    return s_identifier;
+}
+
+bool CryptoAlgorithmRSA_OAEP::keyAlgorithmMatches(const CryptoAlgorithmRsaOaepParams&amp; algorithmParameters, const CryptoKey&amp; key) const
+{
+    if (key.algorithmIdentifier() != s_identifier)
+        return false;
+    ASSERT(isCryptoKeyRSA(key));
+
+    CryptoAlgorithmIdentifier keyHash;
+    if (toCryptoKeyRSA(key).isRestrictedToHash(keyHash) &amp;&amp; keyHash != algorithmParameters.hash)
+        return false;
+
+    return true;
+}
+
+void CryptoAlgorithmRSA_OAEP::encrypt(const CryptoAlgorithmParameters&amp; parameters, const CryptoKey&amp; key, const CryptoOperationData&amp; data, VectorCallback callback, VoidCallback failureCallback, ExceptionCode&amp; ec)
+{
+    const CryptoAlgorithmRsaOaepParams&amp; rsaOAEPParameters = toCryptoAlgorithmRsaOaepParams(parameters);
+
+    if (!keyAlgorithmMatches(rsaOAEPParameters, key)) {
+        ec = NOT_SUPPORTED_ERR;
+        return;
+    }
+
+    platformEncrypt(rsaOAEPParameters, toCryptoKeyRSA(key), data, std::move(callback), std::move(failureCallback), ec);
+}
+
+void CryptoAlgorithmRSA_OAEP::decrypt(const CryptoAlgorithmParameters&amp; parameters, const CryptoKey&amp; key, const CryptoOperationData&amp; data, VectorCallback callback, VoidCallback failureCallback, ExceptionCode&amp; ec)
+{
+    const CryptoAlgorithmRsaOaepParams&amp; rsaOAEPParameters = toCryptoAlgorithmRsaOaepParams(parameters);
+
+    if (!keyAlgorithmMatches(rsaOAEPParameters, key)) {
+        ec = NOT_SUPPORTED_ERR;
+        return;
+    }
+
+    platformDecrypt(rsaOAEPParameters, toCryptoKeyRSA(key), data, std::move(callback), std::move(failureCallback), ec);
+}
+
+void CryptoAlgorithmRSA_OAEP::generateKey(const CryptoAlgorithmParameters&amp; parameters, bool extractable, CryptoKeyUsage usages, KeyOrKeyPairCallback callback, VoidCallback failureCallback, ExceptionCode&amp;)
+{
+    const CryptoAlgorithmRsaKeyGenParams&amp; rsaParameters = toCryptoAlgorithmRsaKeyGenParams(parameters);
+
+    auto keyPairCallback = [callback](CryptoKeyPair&amp; pair) {
+        callback(nullptr, &amp;pair);
+    };
+
+    CryptoKeyRSA::generatePair(CryptoAlgorithmIdentifier::RSA_OAEP, rsaParameters.modulusLength, rsaParameters.publicExponent, extractable, usages, std::move(keyPairCallback), std::move(failureCallback));
+}
+
+void CryptoAlgorithmRSA_OAEP::importKey(const CryptoAlgorithmParameters&amp; parameters, const CryptoKeyData&amp; keyData, bool extractable, CryptoKeyUsage usage, KeyCallback callback, VoidCallback failureCallback, ExceptionCode&amp;)
+{
+    const CryptoAlgorithmRsaKeyParamsWithHash&amp; rsaKeyParameters = toCryptoAlgorithmRsaKeyParamsWithHash(parameters);
+    const CryptoKeyDataRSAComponents&amp; rsaComponents = toCryptoKeyDataRSAComponents(keyData);
+
+    RefPtr&lt;CryptoKeyRSA&gt; result = CryptoKeyRSA::create(CryptoAlgorithmIdentifier::RSA_OAEP, rsaComponents, extractable, usage);
+    if (!result) {
+        failureCallback();
+        return;
+    }
+
+    if (rsaKeyParameters.hasHash)
+        result-&gt;restrictToHash(rsaKeyParameters.hash);
+
+    callback(*result);
+}
+
+}
+
+#endif // ENABLE(SUBTLE_CRYPTO)
</ins><span class="cx">Property changes on: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmRSA_OAEPh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.h (0 => 159944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.h                                (rev 0)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.h        2013-12-02 19:50:51 UTC (rev 159944)
</span><span class="lines">@@ -0,0 +1,64 @@
</span><ins>+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CryptoAlgorithmRSA_OAEP_h
+#define CryptoAlgorithmRSA_OAEP_h
+
+#include &quot;CryptoAlgorithm.h&quot;
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+namespace WebCore {
+
+class CryptoAlgorithmRsaOaepParams;
+class CryptoKeyRSA;
+
+class CryptoAlgorithmRSA_OAEP FINAL : public CryptoAlgorithm {
+public:
+    static const char* const s_name;
+    static const CryptoAlgorithmIdentifier s_identifier = CryptoAlgorithmIdentifier::RSA_OAEP;
+
+    static std::unique_ptr&lt;CryptoAlgorithm&gt; create();
+
+    virtual CryptoAlgorithmIdentifier identifier() const OVERRIDE;
+
+    virtual void encrypt(const CryptoAlgorithmParameters&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback, VoidCallback failureCallback, ExceptionCode&amp;) OVERRIDE;
+    virtual void decrypt(const CryptoAlgorithmParameters&amp;, const CryptoKey&amp;, const CryptoOperationData&amp;, VectorCallback, VoidCallback failureCallback, ExceptionCode&amp;) OVERRIDE;
+    virtual void generateKey(const CryptoAlgorithmParameters&amp;, bool extractable, CryptoKeyUsage, KeyOrKeyPairCallback, VoidCallback failureCallback, ExceptionCode&amp;) OVERRIDE;
+    virtual void importKey(const CryptoAlgorithmParameters&amp;, const CryptoKeyData&amp;, bool extractable, CryptoKeyUsage, KeyCallback, VoidCallback failureCallback, ExceptionCode&amp;) OVERRIDE;
+
+private:
+    CryptoAlgorithmRSA_OAEP();
+    virtual ~CryptoAlgorithmRSA_OAEP();
+
+    bool keyAlgorithmMatches(const CryptoAlgorithmRsaOaepParams&amp; algorithmParameters, const CryptoKey&amp;) const;
+    void platformEncrypt(const CryptoAlgorithmRsaOaepParams&amp;, const CryptoKeyRSA&amp;, const CryptoOperationData&amp;, VectorCallback, VoidCallback failureCallback, ExceptionCode&amp;);
+    void platformDecrypt(const CryptoAlgorithmRsaOaepParams&amp;, const CryptoKeyRSA&amp;, const CryptoOperationData&amp;, VectorCallback, VoidCallback failureCallback, ExceptionCode&amp;);
+};
+
+}
+
+#endif // ENABLE(SUBTLE_CRYPTO)
+#endif // CryptoAlgorithmRSA_OAEP_h
</ins><span class="cx">Property changes on: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmRSA_OAEP.h
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkSourceWebCorecryptomacCryptoAlgorithmHMACMaccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/mac/CryptoAlgorithmHMACMac.cpp (159943 => 159944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/mac/CryptoAlgorithmHMACMac.cpp        2013-12-02 19:49:43 UTC (rev 159943)
+++ trunk/Source/WebCore/crypto/mac/CryptoAlgorithmHMACMac.cpp        2013-12-02 19:50:51 UTC (rev 159944)
</span><span class="lines">@@ -35,7 +35,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-static bool getCommonCryptoAlgorithm(CryptoAlgorithmIdentifier hashFunction, CCHmacAlgorithm&amp; algorithm)
</del><ins>+static bool getCommonCryptoHMACAlgorithm(CryptoAlgorithmIdentifier hashFunction, CCHmacAlgorithm&amp; algorithm)
</ins><span class="cx"> {
</span><span class="cx">     switch (hashFunction) {
</span><span class="cx">     case CryptoAlgorithmIdentifier::SHA_1:
</span><span class="lines">@@ -91,7 +91,7 @@
</span><span class="cx"> void CryptoAlgorithmHMAC::platformSign(const CryptoAlgorithmHmacParams&amp; parameters, const CryptoKeyHMAC&amp; key, const CryptoOperationData&amp; data, VectorCallback callback, VoidCallback, ExceptionCode&amp; ec)
</span><span class="cx"> {
</span><span class="cx">     CCHmacAlgorithm algorithm;
</span><del>-    if (!getCommonCryptoAlgorithm(parameters.hash, algorithm)) {
</del><ins>+    if (!getCommonCryptoHMACAlgorithm(parameters.hash, algorithm)) {
</ins><span class="cx">         ec = NOT_SUPPORTED_ERR;
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="lines">@@ -104,7 +104,7 @@
</span><span class="cx"> void CryptoAlgorithmHMAC::platformVerify(const CryptoAlgorithmHmacParams&amp; parameters, const CryptoKeyHMAC&amp; key, const CryptoOperationData&amp; expectedSignature, const CryptoOperationData&amp; data, BoolCallback callback, VoidCallback, ExceptionCode&amp; ec)
</span><span class="cx"> {
</span><span class="cx">     CCHmacAlgorithm algorithm;
</span><del>-    if (!getCommonCryptoAlgorithm(parameters.hash, algorithm)) {
</del><ins>+    if (!getCommonCryptoHMACAlgorithm(parameters.hash, algorithm)) {
</ins><span class="cx">         ec = NOT_SUPPORTED_ERR;
</span><span class="cx">         return;
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCorecryptomacCryptoAlgorithmRSASSA_PKCS1_v1_5Maccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp (159943 => 159944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp        2013-12-02 19:49:43 UTC (rev 159943)
+++ trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRSASSA_PKCS1_v1_5Mac.cpp        2013-12-02 19:50:51 UTC (rev 159944)
</span><span class="lines">@@ -28,66 +28,15 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SUBTLE_CRYPTO)
</span><span class="cx"> 
</span><ins>+#include &quot;CommonCryptoUtilities.h&quot;
</ins><span class="cx"> #include &quot;CryptoAlgorithmRsaSsaParams.h&quot;
</span><span class="cx"> #include &quot;CryptoDigest.h&quot;
</span><span class="cx"> #include &quot;CryptoKeyRSA.h&quot;
</span><span class="cx"> #include &quot;ExceptionCode.h&quot;
</span><span class="cx"> #include &lt;CommonCrypto/CommonCryptor.h&gt;
</span><span class="cx"> 
</span><del>-#if defined(__has_include)
-#if __has_include(&lt;CommonCrypto/CommonRSACryptor.h&gt;)
-#include &lt;CommonCrypto/CommonRSACryptor.h&gt;
-#endif
-#endif
-
-#ifndef _CC_RSACRYPTOR_H_
-enum {
-    ccPKCS1Padding = 1001
-};
-typedef uint32_t CCAsymmetricPadding;
-
-enum {
-    kCCDigestSHA1 = 8,
-    kCCDigestSHA224 = 9,
-    kCCDigestSHA256 = 10,
-    kCCDigestSHA384 = 11,
-    kCCDigestSHA512 = 12,
-};
-typedef uint32_t CCDigestAlgorithm;
-
-enum {
-    kCCNotVerified    = -4306
-};
-#endif
-
-extern &quot;C&quot; CCCryptorStatus CCRSACryptorSign(CCRSACryptorRef privateKey, CCAsymmetricPadding padding, const void *hashToSign, size_t hashSignLen, CCDigestAlgorithm digestType, size_t saltLen, void *signedData, size_t *signedDataLen);
-extern &quot;C&quot; CCCryptorStatus CCRSACryptorVerify(CCRSACryptorRef publicKey, CCAsymmetricPadding padding, const void *hash, size_t hashLen, CCDigestAlgorithm digestType, size_t saltLen, const void *signedData, size_t signedDataLen);
-
</del><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-static bool getCommonCryptoDigestAlgorithm(CryptoAlgorithmIdentifier hashFunction, CCDigestAlgorithm&amp; algorithm)
-{
-    switch (hashFunction) {
-    case CryptoAlgorithmIdentifier::SHA_1:
-        algorithm = kCCDigestSHA1;
-        return true;
-    case CryptoAlgorithmIdentifier::SHA_224:
-        algorithm = kCCDigestSHA224;
-        return true;
-    case CryptoAlgorithmIdentifier::SHA_256:
-        algorithm = kCCDigestSHA256;
-        return true;
-    case CryptoAlgorithmIdentifier::SHA_384:
-        algorithm = kCCDigestSHA384;
-        return true;
-    case CryptoAlgorithmIdentifier::SHA_512:
-        algorithm = kCCDigestSHA512;
-        return true;
-    default:
-        return false;
-    }
-}
-
</del><span class="cx"> void CryptoAlgorithmRSASSA_PKCS1_v1_5::platformSign(const CryptoAlgorithmRsaSsaParams&amp; parameters, const CryptoKeyRSA&amp; key, const CryptoOperationData&amp; data, VectorCallback callback, VoidCallback failureCallback, ExceptionCode&amp; ec)
</span><span class="cx"> {
</span><span class="cx">     CCDigestAlgorithm digestAlgorithm;
</span></span></pre></div>
<a id="trunkSourceWebCorecryptomacCryptoAlgorithmRSA_OAEPMaccpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp (0 => 159944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp                                (rev 0)
+++ trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp        2013-12-02 19:50:51 UTC (rev 159944)
</span><span class="lines">@@ -0,0 +1,81 @@
</span><ins>+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;CryptoAlgorithmRSA_OAEP.h&quot;
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+#include &quot;CommonCryptoUtilities.h&quot;
+#include &quot;CryptoAlgorithmRsaOaepParams.h&quot;
+#include &quot;CryptoKeyRSA.h&quot;
+#include &quot;ExceptionCode.h&quot;
+
+namespace WebCore {
+
+void CryptoAlgorithmRSA_OAEP::platformEncrypt(const CryptoAlgorithmRsaOaepParams&amp; parameters, const CryptoKeyRSA&amp; key, const CryptoOperationData&amp; data, VectorCallback callback, VoidCallback failureCallback, ExceptionCode&amp; ec)
+{
+    CCDigestAlgorithm digestAlgorithm;
+    if (!getCommonCryptoDigestAlgorithm(parameters.hash, digestAlgorithm)) {
+        ec = NOT_SUPPORTED_ERR;
+        return;
+    }
+
+    Vector&lt;uint8_t&gt; cipherText(1024);
+    size_t cipherTextLength = cipherText.size();
+    ASSERT(parameters.hasLabel || parameters.label.isEmpty());
+    CCCryptorStatus status = CCRSACryptorEncrypt(key.platformKey(), ccOAEPPadding, data.first, data.second, cipherText.data(), &amp;cipherTextLength, parameters.label.data(), parameters.label.size(), digestAlgorithm);
+    if (status) {
+        failureCallback();
+        return;
+    }
+
+    cipherText.resize(cipherTextLength);
+    callback(cipherText);
+}
+
+void CryptoAlgorithmRSA_OAEP::platformDecrypt(const CryptoAlgorithmRsaOaepParams&amp; parameters, const CryptoKeyRSA&amp; key, const CryptoOperationData&amp; data, VectorCallback callback, VoidCallback failureCallback, ExceptionCode&amp; ec)
+{
+    CCDigestAlgorithm digestAlgorithm;
+    if (!getCommonCryptoDigestAlgorithm(parameters.hash, digestAlgorithm)) {
+        ec = NOT_SUPPORTED_ERR;
+        return;
+    }
+
+    Vector&lt;uint8_t&gt; plainText(1024);
+    size_t plainTextLength = plainText.size();
+    CCCryptorStatus status = CCRSACryptorDecrypt(key.platformKey(), ccOAEPPadding, data.first, data.second, plainText.data(), &amp;plainTextLength, parameters.label.data(), parameters.label.size(), digestAlgorithm);
+    if (status) {
+        failureCallback();
+        return;
+    }
+
+    plainText.resize(plainTextLength);
+    callback(plainText);
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SUBTLE_CRYPTO)
</ins><span class="cx">Property changes on: trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRSA_OAEPMac.cpp
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkSourceWebCorecryptomacCryptoAlgorithmRegistryMaccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRegistryMac.cpp (159943 => 159944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRegistryMac.cpp        2013-12-02 19:49:43 UTC (rev 159943)
+++ trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRegistryMac.cpp        2013-12-02 19:50:51 UTC (rev 159944)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include &quot;CryptoAlgorithmAES_CBC.h&quot;
</span><span class="cx"> #include &quot;CryptoAlgorithmHMAC.h&quot;
</span><span class="cx"> #include &quot;CryptoAlgorithmRSASSA_PKCS1_v1_5.h&quot;
</span><ins>+#include &quot;CryptoAlgorithmRSA_OAEP.h&quot;
</ins><span class="cx"> #include &quot;CryptoAlgorithmSHA1.h&quot;
</span><span class="cx"> #include &quot;CryptoAlgorithmSHA224.h&quot;
</span><span class="cx"> #include &quot;CryptoAlgorithmSHA256.h&quot;
</span><span class="lines">@@ -44,6 +45,7 @@
</span><span class="cx">     registerAlgorithm&lt;CryptoAlgorithmAES_CBC&gt;();
</span><span class="cx">     registerAlgorithm&lt;CryptoAlgorithmHMAC&gt;();
</span><span class="cx">     registerAlgorithm&lt;CryptoAlgorithmRSASSA_PKCS1_v1_5&gt;();
</span><ins>+    registerAlgorithm&lt;CryptoAlgorithmRSA_OAEP&gt;();
</ins><span class="cx">     registerAlgorithm&lt;CryptoAlgorithmSHA1&gt;();
</span><span class="cx">     registerAlgorithm&lt;CryptoAlgorithmSHA224&gt;();
</span><span class="cx">     registerAlgorithm&lt;CryptoAlgorithmSHA256&gt;();
</span></span></pre></div>
<a id="trunkSourceWebCorecryptomacCryptoKeyMaccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/mac/CryptoKeyMac.cpp (159943 => 159944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/mac/CryptoKeyMac.cpp        2013-12-02 19:49:43 UTC (rev 159943)
+++ trunk/Source/WebCore/crypto/mac/CryptoKeyMac.cpp        2013-12-02 19:50:51 UTC (rev 159944)
</span><span class="lines">@@ -28,16 +28,8 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SUBTLE_CRYPTO)
</span><span class="cx"> 
</span><del>-#if defined(__has_include) &amp;&amp; (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 1090)
-#if __has_include(&lt;CommonCrypto/CommonRandomSPI.h&gt;)
-#include &lt;CommonCrypto/CommonRandomSPI.h&gt;
-#endif
-#endif
</del><ins>+#include &quot;CommonCryptoUtilities.h&quot;
</ins><span class="cx"> 
</span><del>-typedef struct __CCRandom *CCRandomRef;
-extern const CCRandomRef kCCRandomDefault;
-extern &quot;C&quot; int CCRandomCopyBytes(CCRandomRef rnd, void *bytes, size_t count);
-
</del><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> Vector&lt;uint8_t&gt; CryptoKey::randomData(size_t size)
</span></span></pre></div>
<a id="trunkSourceWebCorecryptomacCryptoKeyRSAMaccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp (159943 => 159944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp        2013-12-02 19:49:43 UTC (rev 159943)
+++ trunk/Source/WebCore/crypto/mac/CryptoKeyRSAMac.cpp        2013-12-02 19:50:51 UTC (rev 159944)
</span><span class="lines">@@ -28,33 +28,13 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SUBTLE_CRYPTO)
</span><span class="cx"> 
</span><ins>+#include &quot;CommonCryptoUtilities.h&quot;
</ins><span class="cx"> #include &quot;CryptoAlgorithmDescriptionBuilder.h&quot;
</span><span class="cx"> #include &quot;CryptoAlgorithmRegistry.h&quot;
</span><span class="cx"> #include &quot;CryptoKeyDataRSAComponents.h&quot;
</span><span class="cx"> #include &quot;CryptoKeyPair.h&quot;
</span><span class="cx"> #include &lt;CommonCrypto/CommonCryptor.h&gt;
</span><span class="cx"> 
</span><del>-#if defined(__has_include)
-#if __has_include(&lt;CommonCrypto/CommonRSACryptor.h&gt;)
-#include &lt;CommonCrypto/CommonRSACryptor.h&gt;
-#endif
-#endif
-
-#ifndef _CC_RSACRYPTOR_H_
-enum {
-    ccRSAKeyPublic          = 0,
-    ccRSAKeyPrivate         = 1
-};
-typedef uint32_t CCRSAKeyType;
-#endif
-
-extern &quot;C&quot; CCCryptorStatus CCRSACryptorCreateFromData(CCRSAKeyType keyType, uint8_t *modulus, size_t modulusLength, uint8_t *exponent, size_t exponentLength, uint8_t *p, size_t pLength, uint8_t *q, size_t qLength, CCRSACryptorRef *ref);
-extern &quot;C&quot; CCCryptorStatus CCRSACryptorGeneratePair(size_t keysize, uint32_t e, CCRSACryptorRef *publicKey, CCRSACryptorRef *privateKey);
-extern &quot;C&quot; CCRSACryptorRef CCRSACryptorGetPublicKeyFromPrivateKey(CCRSACryptorRef privkey);
-extern &quot;C&quot; void CCRSACryptorRelease(CCRSACryptorRef key);
-extern &quot;C&quot; CCCryptorStatus CCRSAGetKeyComponents(CCRSACryptorRef rsaKey, uint8_t *modulus, size_t *modulusLength, uint8_t *exponent, size_t *exponentLength, uint8_t *p, size_t *pLength, uint8_t *q, size_t *qLength);
-extern &quot;C&quot; CCRSAKeyType CCRSAGetKeyType(CCRSACryptorRef key);
-
</del><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> static CCCryptorStatus getPublicKeyComponents(CCRSACryptorRef rsaKey, Vector&lt;uint8_t&gt;&amp; modulus, Vector&lt;uint8_t&gt;&amp; publicExponent)
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoparametersCryptoAlgorithmRsaOaepParamsh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmRsaOaepParams.h (0 => 159944)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmRsaOaepParams.h                                (rev 0)
+++ trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmRsaOaepParams.h        2013-12-02 19:50:51 UTC (rev 159944)
</span><span class="lines">@@ -0,0 +1,59 @@
</span><ins>+/*
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CryptoAlgorithmRsaOaepParams_h
+#define CryptoAlgorithmRsaOaepParams_h
+
+#include &quot;CryptoAlgorithmIdentifier.h&quot;
+#include &quot;CryptoAlgorithmParameters.h&quot;
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+namespace WebCore {
+
+class CryptoAlgorithmRsaOaepParams FINAL : public CryptoAlgorithmParameters {
+public:
+    CryptoAlgorithmRsaOaepParams()
+        : hasLabel(false)
+    {
+    }
+
+    // The hash function to apply to the message.
+    CryptoAlgorithmIdentifier hash;
+
+    // The optional label/application data to associate with the message.
+    // FIXME: Is there a difference between a missing label and an empty one? Perhaps we don't need the hasLabel member.
+    bool hasLabel;
+    Vector&lt;uint8_t&gt; label;
+
+    virtual Class parametersClass() const OVERRIDE { return Class::RsaOaepParams; }
+};
+
+CRYPTO_ALGORITHM_PARAMETERS_CASTS(RsaOaepParams)
+
+}
+
+#endif // ENABLE(SUBTLE_CRYPTO)
+#endif // CryptoAlgorithmRsaOaepParams_h
</ins><span class="cx">Property changes on: trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmRsaOaepParams.h
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
</div>

</body>
</html>