<!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>[212736] 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/212736">212736</a></dd>
<dt>Author</dt> <dd>jiewen_tan@apple.com</dd>
<dt>Date</dt> <dd>2017-02-21 12:04:44 -0800 (Tue, 21 Feb 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>[WebCrypto] Add support for AES-CFB
https://bugs.webkit.org/show_bug.cgi?id=168344
<rdar://problem/20940221>
Reviewed by Brent Fulgham.
Source/WebCore:
This patch adds support for AES-CFB. Operations of AES-CFB include: encrypt, decrypt, generateKey,
importKey, exportKey, wrapKey, and unwrapKey. This implementation follows a slightly old version
of WebCryptoAPI spec: https://www.w3.org/TR/2014/CR-WebCryptoAPI-20141211/#aes-cfb.
Tests: crypto/subtle/aes-cbc-cfb-decrypt-malformed-parameters.html
crypto/subtle/aes-cbc-cfb-encrypt-malformed-parameters.html
crypto/subtle/aes-cbc-import-key-unwrap-jwk-rsa-key-public.html
crypto/subtle/aes-cfb-generate-export-key-jwk-length-128.html
crypto/subtle/aes-cfb-generate-export-key-jwk-length-192.html
crypto/subtle/aes-cfb-generate-export-key-jwk-length-256.html
crypto/subtle/aes-cfb-generate-export-raw-key.html
crypto/subtle/aes-cfb-generate-key-encrypt-decrypt.html
crypto/subtle/aes-cfb-generate-key.html
crypto/subtle/aes-cfb-import-jwk-key-length-128.html
crypto/subtle/aes-cfb-import-jwk-key-length-192.html
crypto/subtle/aes-cfb-import-jwk-key-length-256.html
crypto/subtle/aes-cfb-import-key-decrypt.html
crypto/subtle/aes-cfb-import-key-encrypt.html
crypto/subtle/aes-cfb-import-key-unwrap-jwk-key.html
crypto/subtle/aes-cfb-import-key-unwrap-raw-key.html
crypto/subtle/aes-cfb-import-key-wrap-jwk-key.html
crypto/subtle/aes-cfb-import-key-wrap-raw-key.html
crypto/subtle/aes-cfb-import-raw-key.html
crypto/workers/subtle/aes-cfb-import-key-decrypt.html
crypto/workers/subtle/aes-cfb-import-key-encrypt.html
crypto/workers/subtle/aes-cfb-import-key-unwrap-key.html
crypto/workers/subtle/aes-cfb-import-key-wrap-key.html
* CMakeLists.txt:
* DerivedSources.make:
* PlatformGTK.cmake:
* PlatformMac.cmake:
* WebCore.xcodeproj/project.pbxproj:
Add CryptoAlgorithmAES_CFB.cpp,
change AesCbcParams.idl to AesCbcCfbParams.idl.
* bindings/js/JSSubtleCryptoCustom.cpp:
(WebCore::normalizeCryptoAlgorithmParameters):
Add support for AES-CFB.
* crypto/CryptoAlgorithm.h:
Include <wtf/Variant.h>.
* crypto/CryptoAlgorithmParameters.h:
Add support for AES-CFB.
* crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
(WebCore::CryptoAlgorithmAES_CBC::encrypt):
(WebCore::CryptoAlgorithmAES_CBC::decrypt):
Rename CryptoAlgorithmAesCbcParams to CryptoAlgorithmAesCbcCfbParams.
* crypto/algorithms/CryptoAlgorithmAES_CFB.cpp: Added.
(WebCore::usagesAreInvalidForCryptoAlgorithmAES_CFB):
(WebCore::CryptoAlgorithmAES_CFB::create):
(WebCore::CryptoAlgorithmAES_CFB::identifier):
(WebCore::CryptoAlgorithmAES_CFB::encrypt):
(WebCore::CryptoAlgorithmAES_CFB::decrypt):
(WebCore::CryptoAlgorithmAES_CFB::generateKey):
(WebCore::CryptoAlgorithmAES_CFB::importKey):
(WebCore::CryptoAlgorithmAES_CFB::exportKey):
* crypto/algorithms/CryptoAlgorithmAES_CFB.h: Added.
* crypto/gnutls/CryptoAlgorithmAES_CFBGnuTLS.cpp: Added.
(WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
(WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
Add dummy support of AES_CFB for GTK+.
* crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
(WebCore::transformAES_CBC):
Drop conditional PLATFORM(COCOA).
(WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
(WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
Rename CryptoAlgorithmAesCbcParams to CryptoAlgorithmAesCbcCfbParams.
* crypto/mac/CryptoAlgorithmAES_CFBMac.cpp: Added.
(WebCore::transformAES_CFB):
(WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
(WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
* crypto/mac/CryptoAlgorithmRegistryMac.cpp:
(WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
Add support for AES-CFB.
* crypto/parameters/AesCbcCfbParams.idl: Renamed from Source/WebCore/crypto/parameters/AesCbcParams.idl.
* crypto/parameters/CryptoAlgorithmAesCbcCfbParams.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmAesCbcParams.h.
Since dictionaries AesCbcParams and AesCfbParams are essentially the same, I combine them together in our implementations.
LayoutTests:
* crypto/subtle/aes-cbc-cfb-decrypt-malformed-parameters-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-cbc-decrypt-malformed-parameters-expected.txt.
* crypto/subtle/aes-cbc-cfb-decrypt-malformed-parameters.html: Renamed from LayoutTests/crypto/subtle/aes-cbc-decrypt-malformed-parameters.html.
* crypto/subtle/aes-cbc-cfb-encrypt-malformed-parameters-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-cbc-encrypt-malformed-parameters-expected.txt.
* crypto/subtle/aes-cbc-cfb-encrypt-malformed-parameters.html: Renamed from LayoutTests/crypto/subtle/aes-cbc-encrypt-malformed-parameters.html.
* crypto/subtle/aes-cbc-import-key-unwrap-jwk-rsa-key-public-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-cbc-import-key-uwrap-jwk-rsa-key-public-expected.txt.
* crypto/subtle/aes-cbc-import-key-unwrap-jwk-rsa-key-public.html: Renamed from LayoutTests/crypto/subtle/aes-cbc-import-key-uwrap-jwk-rsa-key-public.html.
* crypto/subtle/aes-cfb-generate-export-key-jwk-length-128-expected.txt: Added.
* crypto/subtle/aes-cfb-generate-export-key-jwk-length-128.html: Added.
* crypto/subtle/aes-cfb-generate-export-key-jwk-length-192-expected.txt: Added.
* crypto/subtle/aes-cfb-generate-export-key-jwk-length-192.html: Added.
* crypto/subtle/aes-cfb-generate-export-key-jwk-length-256-expected.txt: Added.
* crypto/subtle/aes-cfb-generate-export-key-jwk-length-256.html: Added.
* crypto/subtle/aes-cfb-generate-export-raw-key-expected.txt: Added.
* crypto/subtle/aes-cfb-generate-export-raw-key.html: Added.
* crypto/subtle/aes-cfb-generate-key-encrypt-decrypt-expected.txt: Added.
* crypto/subtle/aes-cfb-generate-key-encrypt-decrypt.html: Added.
* crypto/subtle/aes-cfb-generate-key-expected.txt: Added.
* crypto/subtle/aes-cfb-generate-key.html: Added.
* crypto/subtle/aes-cfb-import-jwk-key-length-128-expected.txt: Added.
* crypto/subtle/aes-cfb-import-jwk-key-length-128.html: Added.
* crypto/subtle/aes-cfb-import-jwk-key-length-192-expected.txt: Added.
* crypto/subtle/aes-cfb-import-jwk-key-length-192.html: Added.
* crypto/subtle/aes-cfb-import-jwk-key-length-256-expected.txt: Added.
* crypto/subtle/aes-cfb-import-jwk-key-length-256.html: Added.
* crypto/subtle/aes-cfb-import-key-decrypt-expected.txt: Added.
* crypto/subtle/aes-cfb-import-key-decrypt.html: Added.
* crypto/subtle/aes-cfb-import-key-encrypt-expected.txt: Added.
* crypto/subtle/aes-cfb-import-key-encrypt.html: Added.
* crypto/subtle/aes-cfb-import-key-unwrap-jwk-key-expected.txt: Added.
* crypto/subtle/aes-cfb-import-key-unwrap-jwk-key.html: Added.
* crypto/subtle/aes-cfb-import-key-unwrap-raw-key-expected.txt: Added.
* crypto/subtle/aes-cfb-import-key-unwrap-raw-key.html: Added.
* crypto/subtle/aes-cfb-import-key-wrap-jwk-key-expected.txt: Added.
* crypto/subtle/aes-cfb-import-key-wrap-jwk-key.html: Added.
* crypto/subtle/aes-cfb-import-key-wrap-raw-key-expected.txt: Added.
* crypto/subtle/aes-cfb-import-key-wrap-raw-key.html: Added.
* crypto/subtle/aes-cfb-import-raw-key-expected.txt: Added.
* crypto/subtle/aes-cfb-import-raw-key.html: Added.
* crypto/subtle/aes-generate-key-malformed-parameters-expected.txt:
* crypto/subtle/aes-generate-key-malformed-parameters.html:
* crypto/subtle/aes-import-key-malformed-parameters-expected.txt:
* crypto/subtle/aes-import-key-malformed-parameters.html:
* crypto/workers/subtle/aes-cfb-import-key-decrypt-expected.txt: Added.
* crypto/workers/subtle/aes-cfb-import-key-decrypt.html: Added.
* crypto/workers/subtle/aes-cfb-import-key-encrypt-expected.txt: Added.
* crypto/workers/subtle/aes-cfb-import-key-encrypt.html: Added.
* crypto/workers/subtle/aes-cfb-import-key-unwrap-key-expected.txt: Added.
* crypto/workers/subtle/aes-cfb-import-key-unwrap-key.html: Added.
* crypto/workers/subtle/aes-cfb-import-key-wrap-key-expected.txt: Added.
* crypto/workers/subtle/aes-cfb-import-key-wrap-key.html: Added.
* crypto/workers/subtle/resources/aes-cfb-import-key-decrypt.js: Added.
* crypto/workers/subtle/resources/aes-cfb-import-key-encrypt.js: Added.
* crypto/workers/subtle/resources/aes-cfb-import-key-unwrap-key.js: Added.
* crypto/workers/subtle/resources/aes-cfb-import-key-wrap-key.js: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaesgeneratekeymalformedparametersexpectedtxt">trunk/LayoutTests/crypto/subtle/aes-generate-key-malformed-parameters-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaesgeneratekeymalformedparametershtml">trunk/LayoutTests/crypto/subtle/aes-generate-key-malformed-parameters.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaesimportkeymalformedparametersexpectedtxt">trunk/LayoutTests/crypto/subtle/aes-import-key-malformed-parameters-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaesimportkeymalformedparametershtml">trunk/LayoutTests/crypto/subtle/aes-import-key-malformed-parameters.html</a></li>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreDerivedSourcesmake">trunk/Source/WebCore/DerivedSources.make</a></li>
<li><a href="#trunkSourceWebCorePlatformGTKcmake">trunk/Source/WebCore/PlatformGTK.cmake</a></li>
<li><a href="#trunkSourceWebCorePlatformMaccmake">trunk/Source/WebCore/PlatformMac.cmake</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSSubtleCryptoCustomcpp">trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoCryptoAlgorithmh">trunk/Source/WebCore/crypto/CryptoAlgorithm.h</a></li>
<li><a href="#trunkSourceWebCorecryptoCryptoAlgorithmParametersh">trunk/Source/WebCore/crypto/CryptoAlgorithmParameters.h</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmAES_CBCcpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptomacCryptoAlgorithmAES_CBCMaccpp">trunk/Source/WebCore/crypto/mac/CryptoAlgorithmAES_CBCMac.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptomacCryptoAlgorithmRegistryMaccpp">trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRegistryMac.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestscryptosubtleaescbccfbdecryptmalformedparametersexpectedtxt">trunk/LayoutTests/crypto/subtle/aes-cbc-cfb-decrypt-malformed-parameters-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescbccfbdecryptmalformedparametershtml">trunk/LayoutTests/crypto/subtle/aes-cbc-cfb-decrypt-malformed-parameters.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescbccfbencryptmalformedparametersexpectedtxt">trunk/LayoutTests/crypto/subtle/aes-cbc-cfb-encrypt-malformed-parameters-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescbccfbencryptmalformedparametershtml">trunk/LayoutTests/crypto/subtle/aes-cbc-cfb-encrypt-malformed-parameters.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescbcimportkeyunwrapjwkrsakeypublicexpectedtxt">trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-unwrap-jwk-rsa-key-public-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescbcimportkeyunwrapjwkrsakeypublichtml">trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-unwrap-jwk-rsa-key-public.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescfbgenerateexportkeyjwklength128expectedtxt">trunk/LayoutTests/crypto/subtle/aes-cfb-generate-export-key-jwk-length-128-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescfbgenerateexportkeyjwklength128html">trunk/LayoutTests/crypto/subtle/aes-cfb-generate-export-key-jwk-length-128.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescfbgenerateexportkeyjwklength192expectedtxt">trunk/LayoutTests/crypto/subtle/aes-cfb-generate-export-key-jwk-length-192-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescfbgenerateexportkeyjwklength192html">trunk/LayoutTests/crypto/subtle/aes-cfb-generate-export-key-jwk-length-192.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescfbgenerateexportkeyjwklength256expectedtxt">trunk/LayoutTests/crypto/subtle/aes-cfb-generate-export-key-jwk-length-256-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescfbgenerateexportkeyjwklength256html">trunk/LayoutTests/crypto/subtle/aes-cfb-generate-export-key-jwk-length-256.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescfbgenerateexportrawkeyexpectedtxt">trunk/LayoutTests/crypto/subtle/aes-cfb-generate-export-raw-key-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescfbgenerateexportrawkeyhtml">trunk/LayoutTests/crypto/subtle/aes-cfb-generate-export-raw-key.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescfbgeneratekeyencryptdecryptexpectedtxt">trunk/LayoutTests/crypto/subtle/aes-cfb-generate-key-encrypt-decrypt-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescfbgeneratekeyencryptdecrypthtml">trunk/LayoutTests/crypto/subtle/aes-cfb-generate-key-encrypt-decrypt.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescfbgeneratekeyexpectedtxt">trunk/LayoutTests/crypto/subtle/aes-cfb-generate-key-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescfbgeneratekeyhtml">trunk/LayoutTests/crypto/subtle/aes-cfb-generate-key.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescfbimportjwkkeylength128expectedtxt">trunk/LayoutTests/crypto/subtle/aes-cfb-import-jwk-key-length-128-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescfbimportjwkkeylength128html">trunk/LayoutTests/crypto/subtle/aes-cfb-import-jwk-key-length-128.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescfbimportjwkkeylength192expectedtxt">trunk/LayoutTests/crypto/subtle/aes-cfb-import-jwk-key-length-192-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescfbimportjwkkeylength192html">trunk/LayoutTests/crypto/subtle/aes-cfb-import-jwk-key-length-192.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescfbimportjwkkeylength256expectedtxt">trunk/LayoutTests/crypto/subtle/aes-cfb-import-jwk-key-length-256-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescfbimportjwkkeylength256html">trunk/LayoutTests/crypto/subtle/aes-cfb-import-jwk-key-length-256.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescfbimportkeydecryptexpectedtxt">trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-decrypt-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescfbimportkeydecrypthtml">trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-decrypt.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescfbimportkeyencryptexpectedtxt">trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-encrypt-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescfbimportkeyencrypthtml">trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-encrypt.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescfbimportkeyunwrapjwkkeyexpectedtxt">trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-unwrap-jwk-key-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescfbimportkeyunwrapjwkkeyhtml">trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-unwrap-jwk-key.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescfbimportkeyunwraprawkeyexpectedtxt">trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-unwrap-raw-key-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescfbimportkeyunwraprawkeyhtml">trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-unwrap-raw-key.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescfbimportkeywrapjwkkeyexpectedtxt">trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-wrap-jwk-key-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescfbimportkeywrapjwkkeyhtml">trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-wrap-jwk-key.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescfbimportkeywraprawkeyexpectedtxt">trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-wrap-raw-key-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescfbimportkeywraprawkeyhtml">trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-wrap-raw-key.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescfbimportrawkeyexpectedtxt">trunk/LayoutTests/crypto/subtle/aes-cfb-import-raw-key-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescfbimportrawkeyhtml">trunk/LayoutTests/crypto/subtle/aes-cfb-import-raw-key.html</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtleaescfbimportkeydecryptexpectedtxt">trunk/LayoutTests/crypto/workers/subtle/aes-cfb-import-key-decrypt-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtleaescfbimportkeydecrypthtml">trunk/LayoutTests/crypto/workers/subtle/aes-cfb-import-key-decrypt.html</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtleaescfbimportkeyencryptexpectedtxt">trunk/LayoutTests/crypto/workers/subtle/aes-cfb-import-key-encrypt-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtleaescfbimportkeyencrypthtml">trunk/LayoutTests/crypto/workers/subtle/aes-cfb-import-key-encrypt.html</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtleaescfbimportkeyunwrapkeyexpectedtxt">trunk/LayoutTests/crypto/workers/subtle/aes-cfb-import-key-unwrap-key-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtleaescfbimportkeyunwrapkeyhtml">trunk/LayoutTests/crypto/workers/subtle/aes-cfb-import-key-unwrap-key.html</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtleaescfbimportkeywrapkeyexpectedtxt">trunk/LayoutTests/crypto/workers/subtle/aes-cfb-import-key-wrap-key-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtleaescfbimportkeywrapkeyhtml">trunk/LayoutTests/crypto/workers/subtle/aes-cfb-import-key-wrap-key.html</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtleresourcesaescfbimportkeydecryptjs">trunk/LayoutTests/crypto/workers/subtle/resources/aes-cfb-import-key-decrypt.js</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtleresourcesaescfbimportkeyencryptjs">trunk/LayoutTests/crypto/workers/subtle/resources/aes-cfb-import-key-encrypt.js</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtleresourcesaescfbimportkeyunwrapkeyjs">trunk/LayoutTests/crypto/workers/subtle/resources/aes-cfb-import-key-unwrap-key.js</a></li>
<li><a href="#trunkLayoutTestscryptoworkerssubtleresourcesaescfbimportkeywrapkeyjs">trunk/LayoutTests/crypto/workers/subtle/resources/aes-cfb-import-key-wrap-key.js</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmAES_CFBcpp">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CFB.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmAES_CFBh">trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CFB.h</a></li>
<li><a href="#trunkSourceWebCorecryptognutlsCryptoAlgorithmAES_CFBGnuTLScpp">trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_CFBGnuTLS.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptomacCryptoAlgorithmAES_CFBMaccpp">trunk/Source/WebCore/crypto/mac/CryptoAlgorithmAES_CFBMac.cpp</a></li>
<li><a href="#trunkSourceWebCorecryptoparametersAesCbcCfbParamsidl">trunk/Source/WebCore/crypto/parameters/AesCbcCfbParams.idl</a></li>
<li><a href="#trunkSourceWebCorecryptoparametersCryptoAlgorithmAesCbcCfbParamsh">trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmAesCbcCfbParams.h</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestscryptosubtleaescbcdecryptmalformedparametersexpectedtxt">trunk/LayoutTests/crypto/subtle/aes-cbc-decrypt-malformed-parameters-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescbcdecryptmalformedparametershtml">trunk/LayoutTests/crypto/subtle/aes-cbc-decrypt-malformed-parameters.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescbcencryptmalformedparametersexpectedtxt">trunk/LayoutTests/crypto/subtle/aes-cbc-encrypt-malformed-parameters-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescbcencryptmalformedparametershtml">trunk/LayoutTests/crypto/subtle/aes-cbc-encrypt-malformed-parameters.html</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescbcimportkeyuwrapjwkrsakeypublicexpectedtxt">trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-uwrap-jwk-rsa-key-public-expected.txt</a></li>
<li><a href="#trunkLayoutTestscryptosubtleaescbcimportkeyuwrapjwkrsakeypublichtml">trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-uwrap-jwk-rsa-key-public.html</a></li>
<li><a href="#trunkSourceWebCorecryptoparametersAesCbcParamsidl">trunk/Source/WebCore/crypto/parameters/AesCbcParams.idl</a></li>
<li><a href="#trunkSourceWebCorecryptoparametersCryptoAlgorithmAesCbcParamsh">trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmAesCbcParams.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (212735 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-02-21 20:00:52 UTC (rev 212735)
+++ trunk/LayoutTests/ChangeLog        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -1,3 +1,66 @@
</span><ins>+2017-02-21 Jiewen Tan <jiewen_tan@apple.com>
+
+ [WebCrypto] Add support for AES-CFB
+ https://bugs.webkit.org/show_bug.cgi?id=168344
+ <rdar://problem/20940221>
+
+ Reviewed by Brent Fulgham.
+
+ * crypto/subtle/aes-cbc-cfb-decrypt-malformed-parameters-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-cbc-decrypt-malformed-parameters-expected.txt.
+ * crypto/subtle/aes-cbc-cfb-decrypt-malformed-parameters.html: Renamed from LayoutTests/crypto/subtle/aes-cbc-decrypt-malformed-parameters.html.
+ * crypto/subtle/aes-cbc-cfb-encrypt-malformed-parameters-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-cbc-encrypt-malformed-parameters-expected.txt.
+ * crypto/subtle/aes-cbc-cfb-encrypt-malformed-parameters.html: Renamed from LayoutTests/crypto/subtle/aes-cbc-encrypt-malformed-parameters.html.
+ * crypto/subtle/aes-cbc-import-key-unwrap-jwk-rsa-key-public-expected.txt: Renamed from LayoutTests/crypto/subtle/aes-cbc-import-key-uwrap-jwk-rsa-key-public-expected.txt.
+ * crypto/subtle/aes-cbc-import-key-unwrap-jwk-rsa-key-public.html: Renamed from LayoutTests/crypto/subtle/aes-cbc-import-key-uwrap-jwk-rsa-key-public.html.
+ * crypto/subtle/aes-cfb-generate-export-key-jwk-length-128-expected.txt: Added.
+ * crypto/subtle/aes-cfb-generate-export-key-jwk-length-128.html: Added.
+ * crypto/subtle/aes-cfb-generate-export-key-jwk-length-192-expected.txt: Added.
+ * crypto/subtle/aes-cfb-generate-export-key-jwk-length-192.html: Added.
+ * crypto/subtle/aes-cfb-generate-export-key-jwk-length-256-expected.txt: Added.
+ * crypto/subtle/aes-cfb-generate-export-key-jwk-length-256.html: Added.
+ * crypto/subtle/aes-cfb-generate-export-raw-key-expected.txt: Added.
+ * crypto/subtle/aes-cfb-generate-export-raw-key.html: Added.
+ * crypto/subtle/aes-cfb-generate-key-encrypt-decrypt-expected.txt: Added.
+ * crypto/subtle/aes-cfb-generate-key-encrypt-decrypt.html: Added.
+ * crypto/subtle/aes-cfb-generate-key-expected.txt: Added.
+ * crypto/subtle/aes-cfb-generate-key.html: Added.
+ * crypto/subtle/aes-cfb-import-jwk-key-length-128-expected.txt: Added.
+ * crypto/subtle/aes-cfb-import-jwk-key-length-128.html: Added.
+ * crypto/subtle/aes-cfb-import-jwk-key-length-192-expected.txt: Added.
+ * crypto/subtle/aes-cfb-import-jwk-key-length-192.html: Added.
+ * crypto/subtle/aes-cfb-import-jwk-key-length-256-expected.txt: Added.
+ * crypto/subtle/aes-cfb-import-jwk-key-length-256.html: Added.
+ * crypto/subtle/aes-cfb-import-key-decrypt-expected.txt: Added.
+ * crypto/subtle/aes-cfb-import-key-decrypt.html: Added.
+ * crypto/subtle/aes-cfb-import-key-encrypt-expected.txt: Added.
+ * crypto/subtle/aes-cfb-import-key-encrypt.html: Added.
+ * crypto/subtle/aes-cfb-import-key-unwrap-jwk-key-expected.txt: Added.
+ * crypto/subtle/aes-cfb-import-key-unwrap-jwk-key.html: Added.
+ * crypto/subtle/aes-cfb-import-key-unwrap-raw-key-expected.txt: Added.
+ * crypto/subtle/aes-cfb-import-key-unwrap-raw-key.html: Added.
+ * crypto/subtle/aes-cfb-import-key-wrap-jwk-key-expected.txt: Added.
+ * crypto/subtle/aes-cfb-import-key-wrap-jwk-key.html: Added.
+ * crypto/subtle/aes-cfb-import-key-wrap-raw-key-expected.txt: Added.
+ * crypto/subtle/aes-cfb-import-key-wrap-raw-key.html: Added.
+ * crypto/subtle/aes-cfb-import-raw-key-expected.txt: Added.
+ * crypto/subtle/aes-cfb-import-raw-key.html: Added.
+ * crypto/subtle/aes-generate-key-malformed-parameters-expected.txt:
+ * crypto/subtle/aes-generate-key-malformed-parameters.html:
+ * crypto/subtle/aes-import-key-malformed-parameters-expected.txt:
+ * crypto/subtle/aes-import-key-malformed-parameters.html:
+ * crypto/workers/subtle/aes-cfb-import-key-decrypt-expected.txt: Added.
+ * crypto/workers/subtle/aes-cfb-import-key-decrypt.html: Added.
+ * crypto/workers/subtle/aes-cfb-import-key-encrypt-expected.txt: Added.
+ * crypto/workers/subtle/aes-cfb-import-key-encrypt.html: Added.
+ * crypto/workers/subtle/aes-cfb-import-key-unwrap-key-expected.txt: Added.
+ * crypto/workers/subtle/aes-cfb-import-key-unwrap-key.html: Added.
+ * crypto/workers/subtle/aes-cfb-import-key-wrap-key-expected.txt: Added.
+ * crypto/workers/subtle/aes-cfb-import-key-wrap-key.html: Added.
+ * crypto/workers/subtle/resources/aes-cfb-import-key-decrypt.js: Added.
+ * crypto/workers/subtle/resources/aes-cfb-import-key-encrypt.js: Added.
+ * crypto/workers/subtle/resources/aes-cfb-import-key-unwrap-key.js: Added.
+ * crypto/workers/subtle/resources/aes-cfb-import-key-wrap-key.js: Added.
+
</ins><span class="cx"> 2017-02-21 Alex Christensen <achristensen@webkit.org>
</span><span class="cx">
</span><span class="cx"> Unreviewed, rolling out r212699.
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescbccfbdecryptmalformedparametersexpectedtxtfromrev212735trunkLayoutTestscryptosubtleaescbcdecryptmalformedparametersexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/crypto/subtle/aes-cbc-cfb-decrypt-malformed-parameters-expected.txt (from rev 212735, trunk/LayoutTests/crypto/subtle/aes-cbc-decrypt-malformed-parameters-expected.txt) (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cbc-cfb-decrypt-malformed-parameters-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cbc-cfb-decrypt-malformed-parameters-expected.txt        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+Test decrypting using AES-CBC/AES-CFB with malformed parameters
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS crypto.subtle.decrypt({name: "aes-cbc", iv: asciiToUint8Array("")}, key, cipherText) rejected promise with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
+PASS crypto.subtle.decrypt({name: "aes-cbc", iv: asciiToUint8Array("j")}, key, cipherText) rejected promise with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
+PASS crypto.subtle.decrypt({name: "aes-cbc", iv: asciiToUint8Array("jnOw99oOZFLIEPMrd")}, key, cipherText) rejected promise with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
+PASS crypto.subtle.decrypt({name: "aes-cfb-8", iv: asciiToUint8Array("")}, key, cipherText) rejected promise with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
+PASS crypto.subtle.decrypt({name: "aes-cfb-8", iv: asciiToUint8Array("j")}, key, cipherText) rejected promise with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
+PASS crypto.subtle.decrypt({name: "aes-cfb-8", iv: asciiToUint8Array("jnOw99oOZFLIEPMrd")}, key, cipherText) rejected promise with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescbccfbdecryptmalformedparametershtmlfromrev212735trunkLayoutTestscryptosubtleaescbcdecryptmalformedparametershtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/crypto/subtle/aes-cbc-cfb-decrypt-malformed-parameters.html (from rev 212735, trunk/LayoutTests/crypto/subtle/aes-cbc-decrypt-malformed-parameters.html) (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cbc-cfb-decrypt-malformed-parameters.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cbc-cfb-decrypt-malformed-parameters.html        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,44 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test decrypting using AES-CBC/AES-CFB with malformed parameters");
+
+jsTestIsAsync = true;
+
+var extractable = false;
+var cipherText = hexStringToUint8Array("2ffa4618784dfd414b22c40c6330d022");
+var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
+
+crypto.subtle.importKey("raw", rawKey, "aes-cbc", extractable, ["decrypt"]).then(function(result) {
+ key = result;
+ // Wrong iv length
+ shouldReject('crypto.subtle.decrypt({name: "aes-cbc", iv: asciiToUint8Array("")}, key, cipherText)');
+ shouldReject('crypto.subtle.decrypt({name: "aes-cbc", iv: asciiToUint8Array("j")}, key, cipherText)');
+ shouldReject('crypto.subtle.decrypt({name: "aes-cbc", iv: asciiToUint8Array("jnOw99oOZFLIEPMrd")}, key, cipherText)');
+
+ finishJSTest();
+});
+
+crypto.subtle.importKey("raw", rawKey, "aes-cfb-8", extractable, ["decrypt"]).then(function(result) {
+ key = result;
+ // Wrong iv length
+ shouldReject('crypto.subtle.decrypt({name: "aes-cfb-8", iv: asciiToUint8Array("")}, key, cipherText)');
+ shouldReject('crypto.subtle.decrypt({name: "aes-cfb-8", iv: asciiToUint8Array("j")}, key, cipherText)');
+ shouldReject('crypto.subtle.decrypt({name: "aes-cfb-8", iv: asciiToUint8Array("jnOw99oOZFLIEPMrd")}, key, cipherText)');
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescbccfbencryptmalformedparametersexpectedtxtfromrev212735trunkLayoutTestscryptosubtleaescbcencryptmalformedparametersexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/crypto/subtle/aes-cbc-cfb-encrypt-malformed-parameters-expected.txt (from rev 212735, trunk/LayoutTests/crypto/subtle/aes-cbc-encrypt-malformed-parameters-expected.txt) (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cbc-cfb-encrypt-malformed-parameters-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cbc-cfb-encrypt-malformed-parameters-expected.txt        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,26 @@
</span><ins>+Test encrypting using AES-CBC/AES-CFB with malformed parameters
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS crypto.subtle.encrypt("aes-cbc", key, plainText) rejected promise with TypeError: Member AesCbcCfbParams.iv is required and must be an instance of BufferSource.
+PASS crypto.subtle.encrypt({name: "aes-cbc"}, key, plainText) rejected promise with TypeError: Member AesCbcCfbParams.iv is required and must be an instance of BufferSource.
+PASS crypto.subtle.encrypt({name: "aes-cbc", iv: true}, key, plainText) rejected promise with TypeError: Type error.
+PASS crypto.subtle.encrypt({name: "aes-cbc", iv: 1}, key, plainText) rejected promise with TypeError: Type error.
+PASS crypto.subtle.encrypt({name: "aes-cbc", iv: null}, key, plainText) rejected promise with TypeError: Type error.
+PASS crypto.subtle.encrypt({name: "aes-cbc", iv: undefined}, key, plainText) rejected promise with TypeError: Member AesCbcCfbParams.iv is required and must be an instance of BufferSource.
+PASS crypto.subtle.encrypt({name: "aes-cbc", iv: Symbol()}, key, plainText) rejected promise with TypeError: Type error.
+PASS crypto.subtle.encrypt({name: "aes-cbc", iv: { }}, key, plainText) rejected promise with TypeError: Type error.
+PASS crypto.subtle.encrypt({name: "aes-cbc", iv: "foo"}, key, plainText) rejected promise with TypeError: Type error.
+PASS crypto.subtle.encrypt({name: "aes-cbc", iv: asciiToUint8Array("")}, key, plainText) rejected promise with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
+PASS crypto.subtle.encrypt({name: "aes-cbc", iv: asciiToUint8Array("j")}, key, plainText) rejected promise with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
+PASS crypto.subtle.encrypt({name: "aes-cbc", iv: asciiToUint8Array("jnOw99oOZFLIEPMrd")}, key, plainText) rejected promise with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
+PASS crypto.subtle.encrypt("aes-cfb-8", key, plainText) rejected promise with TypeError: Member AesCbcCfbParams.iv is required and must be an instance of BufferSource.
+PASS crypto.subtle.encrypt({name: "aes-cfb-8"}, key, plainText) rejected promise with TypeError: Member AesCbcCfbParams.iv is required and must be an instance of BufferSource.
+PASS crypto.subtle.encrypt({name: "aes-cfb-8", iv: asciiToUint8Array("")}, key, plainText) rejected promise with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
+PASS crypto.subtle.encrypt({name: "aes-cfb-8", iv: asciiToUint8Array("j")}, key, plainText) rejected promise with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
+PASS crypto.subtle.encrypt({name: "aes-cfb-8", iv: asciiToUint8Array("jnOw99oOZFLIEPMrd")}, key, plainText) rejected promise with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescbccfbencryptmalformedparametershtmlfromrev212735trunkLayoutTestscryptosubtleaescbcencryptmalformedparametershtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/crypto/subtle/aes-cbc-cfb-encrypt-malformed-parameters.html (from rev 212735, trunk/LayoutTests/crypto/subtle/aes-cbc-encrypt-malformed-parameters.html) (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cbc-cfb-encrypt-malformed-parameters.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cbc-cfb-encrypt-malformed-parameters.html        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,57 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test encrypting using AES-CBC/AES-CFB with malformed parameters");
+
+jsTestIsAsync = true;
+
+var extractable = false;
+var plainText = asciiToUint8Array("Hello, World!");
+var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
+
+crypto.subtle.importKey("raw", rawKey, "aes-cbc", extractable, ["encrypt"]).then(function(result) {
+ key = result;
+ // Malformed AlgorithmIdentifiers
+ shouldReject('crypto.subtle.encrypt("aes-cbc", key, plainText)');
+ shouldReject('crypto.subtle.encrypt({name: "aes-cbc"}, key, plainText)');
+ shouldReject('crypto.subtle.encrypt({name: "aes-cbc", iv: true}, key, plainText)');
+ shouldReject('crypto.subtle.encrypt({name: "aes-cbc", iv: 1}, key, plainText)');
+ shouldReject('crypto.subtle.encrypt({name: "aes-cbc", iv: null}, key, plainText)');
+ shouldReject('crypto.subtle.encrypt({name: "aes-cbc", iv: undefined}, key, plainText)');
+ shouldReject('crypto.subtle.encrypt({name: "aes-cbc", iv: Symbol()}, key, plainText)');
+ shouldReject('crypto.subtle.encrypt({name: "aes-cbc", iv: { }}, key, plainText)');
+ shouldReject('crypto.subtle.encrypt({name: "aes-cbc", iv: "foo"}, key, plainText)');
+ // Wrong iv length
+ shouldReject('crypto.subtle.encrypt({name: "aes-cbc", iv: asciiToUint8Array("")}, key, plainText)');
+ shouldReject('crypto.subtle.encrypt({name: "aes-cbc", iv: asciiToUint8Array("j")}, key, plainText)');
+ shouldReject('crypto.subtle.encrypt({name: "aes-cbc", iv: asciiToUint8Array("jnOw99oOZFLIEPMrd")}, key, plainText)');
+
+ finishJSTest();
+});
+
+crypto.subtle.importKey("raw", rawKey, "aes-cfb-8", extractable, ["encrypt"]).then(function(result) {
+ key = result;
+ // Malformed AlgorithmIdentifiers
+ shouldReject('crypto.subtle.encrypt("aes-cfb-8", key, plainText)');
+ shouldReject('crypto.subtle.encrypt({name: "aes-cfb-8"}, key, plainText)');
+ // Wrong iv length
+ shouldReject('crypto.subtle.encrypt({name: "aes-cfb-8", iv: asciiToUint8Array("")}, key, plainText)');
+ shouldReject('crypto.subtle.encrypt({name: "aes-cfb-8", iv: asciiToUint8Array("j")}, key, plainText)');
+ shouldReject('crypto.subtle.encrypt({name: "aes-cfb-8", iv: asciiToUint8Array("jnOw99oOZFLIEPMrd")}, key, plainText)');
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescbcdecryptmalformedparametersexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/crypto/subtle/aes-cbc-decrypt-malformed-parameters-expected.txt (212735 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cbc-decrypt-malformed-parameters-expected.txt        2017-02-21 20:00:52 UTC (rev 212735)
+++ trunk/LayoutTests/crypto/subtle/aes-cbc-decrypt-malformed-parameters-expected.txt        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -1,12 +0,0 @@
</span><del>-Test decrypting using AES-CBC with malformed parameters
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS crypto.subtle.decrypt({name: "aes-cbc", iv: asciiToUint8Array("")}, key, cipherText) rejected promise with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
-PASS crypto.subtle.decrypt({name: "aes-cbc", iv: asciiToUint8Array("j")}, key, cipherText) rejected promise with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
-PASS crypto.subtle.decrypt({name: "aes-cbc", iv: asciiToUint8Array("jnOw99oOZFLIEPMrd")}, key, cipherText) rejected promise with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
</del></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescbcdecryptmalformedparametershtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/crypto/subtle/aes-cbc-decrypt-malformed-parameters.html (212735 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cbc-decrypt-malformed-parameters.html        2017-02-21 20:00:52 UTC (rev 212735)
+++ trunk/LayoutTests/crypto/subtle/aes-cbc-decrypt-malformed-parameters.html        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -1,34 +0,0 @@
</span><del>-<!DOCTYPE html>
-<html>
-<head>
-<script src="../../resources/js-test-pre.js"></script>
-<script src="../resources/common.js"></script>
-</head>
-<body>
-<p id="description"></p>
-<div id="console"></div>
-
-<script>
-description("Test decrypting using AES-CBC with malformed parameters");
-
-jsTestIsAsync = true;
-
-var extractable = false;
-var cipherText = hexStringToUint8Array("2ffa4618784dfd414b22c40c6330d022");
-var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
-
-crypto.subtle.importKey("raw", rawKey, "aes-cbc", extractable, ["decrypt"]).then(function(result) {
- key = result;
- // Wrong iv length
- shouldReject('crypto.subtle.decrypt({name: "aes-cbc", iv: asciiToUint8Array("")}, key, cipherText)');
- shouldReject('crypto.subtle.decrypt({name: "aes-cbc", iv: asciiToUint8Array("j")}, key, cipherText)');
- shouldReject('crypto.subtle.decrypt({name: "aes-cbc", iv: asciiToUint8Array("jnOw99oOZFLIEPMrd")}, key, cipherText)');
-
- finishJSTest();
-});
-
-</script>
-
-<script src="../../resources/js-test-post.js"></script>
-</body>
-</html>
</del></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescbcencryptmalformedparametersexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/crypto/subtle/aes-cbc-encrypt-malformed-parameters-expected.txt (212735 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cbc-encrypt-malformed-parameters-expected.txt        2017-02-21 20:00:52 UTC (rev 212735)
+++ trunk/LayoutTests/crypto/subtle/aes-cbc-encrypt-malformed-parameters-expected.txt        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -1,21 +0,0 @@
</span><del>-Test encrypting using AES-CBC with malformed parameters
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS crypto.subtle.encrypt("aes-cbc", key, plainText) rejected promise with TypeError: Member AesCbcParams.iv is required and must be an instance of BufferSource.
-PASS crypto.subtle.encrypt({name: "aes-cbc"}, key, plainText) rejected promise with TypeError: Member AesCbcParams.iv is required and must be an instance of BufferSource.
-PASS crypto.subtle.encrypt({name: "aes-cbc", iv: true}, key, plainText) rejected promise with TypeError: Type error.
-PASS crypto.subtle.encrypt({name: "aes-cbc", iv: 1}, key, plainText) rejected promise with TypeError: Type error.
-PASS crypto.subtle.encrypt({name: "aes-cbc", iv: null}, key, plainText) rejected promise with TypeError: Type error.
-PASS crypto.subtle.encrypt({name: "aes-cbc", iv: undefined}, key, plainText) rejected promise with TypeError: Member AesCbcParams.iv is required and must be an instance of BufferSource.
-PASS crypto.subtle.encrypt({name: "aes-cbc", iv: Symbol()}, key, plainText) rejected promise with TypeError: Type error.
-PASS crypto.subtle.encrypt({name: "aes-cbc", iv: { }}, key, plainText) rejected promise with TypeError: Type error.
-PASS crypto.subtle.encrypt({name: "aes-cbc", iv: "foo"}, key, plainText) rejected promise with TypeError: Type error.
-PASS crypto.subtle.encrypt({name: "aes-cbc", iv: asciiToUint8Array("")}, key, plainText) rejected promise with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
-PASS crypto.subtle.encrypt({name: "aes-cbc", iv: asciiToUint8Array("j")}, key, plainText) rejected promise with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
-PASS crypto.subtle.encrypt({name: "aes-cbc", iv: asciiToUint8Array("jnOw99oOZFLIEPMrd")}, key, plainText) rejected promise with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
</del></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescbcencryptmalformedparametershtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/crypto/subtle/aes-cbc-encrypt-malformed-parameters.html (212735 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cbc-encrypt-malformed-parameters.html        2017-02-21 20:00:52 UTC (rev 212735)
+++ trunk/LayoutTests/crypto/subtle/aes-cbc-encrypt-malformed-parameters.html        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -1,44 +0,0 @@
</span><del>-<!DOCTYPE html>
-<html>
-<head>
-<script src="../../resources/js-test-pre.js"></script>
-<script src="../resources/common.js"></script>
-</head>
-<body>
-<p id="description"></p>
-<div id="console"></div>
-
-<script>
-description("Test encrypting using AES-CBC with malformed parameters");
-
-jsTestIsAsync = true;
-
-var extractable = false;
-var plainText = asciiToUint8Array("Hello, World!");
-var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
-
-crypto.subtle.importKey("raw", rawKey, "aes-cbc", extractable, ["encrypt"]).then(function(result) {
- key = result;
- // Malformed AlgorithmIdentifiers
- shouldReject('crypto.subtle.encrypt("aes-cbc", key, plainText)');
- shouldReject('crypto.subtle.encrypt({name: "aes-cbc"}, key, plainText)');
- shouldReject('crypto.subtle.encrypt({name: "aes-cbc", iv: true}, key, plainText)');
- shouldReject('crypto.subtle.encrypt({name: "aes-cbc", iv: 1}, key, plainText)');
- shouldReject('crypto.subtle.encrypt({name: "aes-cbc", iv: null}, key, plainText)');
- shouldReject('crypto.subtle.encrypt({name: "aes-cbc", iv: undefined}, key, plainText)');
- shouldReject('crypto.subtle.encrypt({name: "aes-cbc", iv: Symbol()}, key, plainText)');
- shouldReject('crypto.subtle.encrypt({name: "aes-cbc", iv: { }}, key, plainText)');
- shouldReject('crypto.subtle.encrypt({name: "aes-cbc", iv: "foo"}, key, plainText)');
- // Wrong iv length
- shouldReject('crypto.subtle.encrypt({name: "aes-cbc", iv: asciiToUint8Array("")}, key, plainText)');
- shouldReject('crypto.subtle.encrypt({name: "aes-cbc", iv: asciiToUint8Array("j")}, key, plainText)');
- shouldReject('crypto.subtle.encrypt({name: "aes-cbc", iv: asciiToUint8Array("jnOw99oOZFLIEPMrd")}, key, plainText)');
-
- finishJSTest();
-});
-
-</script>
-
-<script src="../../resources/js-test-post.js"></script>
-</body>
-</html>
</del></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescbcimportkeyunwrapjwkrsakeypublicexpectedtxtfromrev212735trunkLayoutTestscryptosubtleaescbcimportkeyuwrapjwkrsakeypublicexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-unwrap-jwk-rsa-key-public-expected.txt (from rev 212735, trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-uwrap-jwk-rsa-key-public-expected.txt) (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-unwrap-jwk-rsa-key-public-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-unwrap-jwk-rsa-key-public-expected.txt        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+Test unwrapping a JWK RSA public key with AES-CBC using an imported key
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS unwrappedKey.kty is jwkKey.kty
+PASS unwrappedKey.alg is jwkKey.alg
+PASS unwrappedKey.key_ops is jwkKey.key_ops
+PASS unwrappedKey.ext is jwkKey.ext
+PASS unwrappedKey.n is jwkKey.n
+PASS unwrappedKey.e is jwkKey.e
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescbcimportkeyunwrapjwkrsakeypublichtmlfromrev212735trunkLayoutTestscryptosubtleaescbcimportkeyuwrapjwkrsakeypublichtml"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-unwrap-jwk-rsa-key-public.html (from rev 212735, trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-uwrap-jwk-rsa-key-public.html) (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-unwrap-jwk-rsa-key-public.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-unwrap-jwk-rsa-key-public.html        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,55 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test unwrapping a JWK RSA public key with AES-CBC using an imported key");
+
+jsTestIsAsync = true;
+
+var extractable = true;
+var jwkKey = {
+ kty: "RSA",
+ alg: "RSA-OAEP",
+ use: "enc",
+ key_ops: ["encrypt"],
+ ext: true,
+ n: "rcCUCv7Oc1HVam1DIhCzqknThWawOp8QLk8Ziy2p10ByjQFCajoFiyuAWl-R1WXZaf4xitLRracT9agpzIzc-MbLSHIGgWQGO21lGiImy5ftZ-D8bHAqRz2y15pzD4c4CEou7XSSLDoRnR0QG5MsDhD6s2gV9mwHkrtkCxtMWdBi-77as8wGmlNRldcOSgZDLK8UnCSgA1OguZ989bFyc8tOOEIb0xUSfPSz3LPSCnyYz68aDjmKVeNH-ig857OScyWbGyEy3Biw64qun3juUlNWsJ3zngkOdteYWytx5Qr4XKNs6R-Myyq72KUp02mJDZiiyiglxML_i3-_CeecCw",
+ e: "AQAB"
+};
+var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
+var aesCbcParams = {
+ name: "aes-cbc",
+ iv: asciiToUint8Array("jnOw99oOZFLIEPMr"),
+}
+var wrappedKey = hexStringToUint8Array( "848aa2f70ee18e2953520132a79cf47946e00c99362340bb690edc9ab5315757462c128278c6232e770e7437c56ed722a8e1703855f7f3e565394e1a6a0305c4ef1b30fa4c7f72d1a239cc6c6ba067898798a36a75132c66b4a2d3fb942886affd3ea3b2756b0ddc886c01e3b93107469b82124468408ef8ab548b85aa8f206c312d74ce4f2c679eb147a275cefda64d5bdc4a2b5b90a4ac9ad3eb5f2cf19f5f87653211f59b4731ba61125582a233951097dea65db05899d587d1dcfccab9ab7410ab3010b89066506dbacbc6b73e4b564792751388fa0f58d55c59c14a08c9dfb0f78100b0f5cc29d62328822636d30a6a153ec5cd4727ad5e47b419c48544565637ac5789863d43b7da78cf4383d09d66e9d458e436dbfbee75e382b2bab49eec2c7491ff93cf099fe92feaf4658e30889fd12d3ae61cd5e8c8e1e56a079b662f90cd10cdbdbb4d12eefb36d825e1a043e82f5a98f8960d655d3f9ed5af31e581fa846cc582f6cee5c25e0b3c32050534ae957ce27860d470ba26da2c7d6fa621b0faa8becad58e9e55bb2a9d984b042f25df21482529870d271cbf5508a0edfc3cb37316c11f16b342bc1f1f98aa");
+
+
+crypto.subtle.importKey("raw", rawKey, "aes-cbc", extractable, ["unwrapKey"]).then(function(unwrappingKey) {
+ return crypto.subtle.unwrapKey("jwk", wrappedKey, unwrappingKey, aesCbcParams, {name: "rsa-oaep", hash: "sha-1"}, extractable, ["encrypt"]);
+}).then(function(cryptoKey) {
+ return crypto.subtle.exportKey("jwk", cryptoKey);
+}).then(function(result) {
+ unwrappedKey = result;
+
+ shouldBe("unwrappedKey.kty", "jwkKey.kty");
+ shouldBe("unwrappedKey.alg", "jwkKey.alg");
+ shouldBe("unwrappedKey.key_ops", "jwkKey.key_ops");
+ shouldBe("unwrappedKey.ext", "jwkKey.ext");
+ shouldBe("unwrappedKey.n", "jwkKey.n");
+ shouldBe("unwrappedKey.e", "jwkKey.e");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescbcimportkeyuwrapjwkrsakeypublicexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-uwrap-jwk-rsa-key-public-expected.txt (212735 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-uwrap-jwk-rsa-key-public-expected.txt        2017-02-21 20:00:52 UTC (rev 212735)
+++ trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-uwrap-jwk-rsa-key-public-expected.txt        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -1,15 +0,0 @@
</span><del>-Test unwrapping a JWK RSA public key with AES-CBC using an imported key
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS unwrappedKey.kty is jwkKey.kty
-PASS unwrappedKey.alg is jwkKey.alg
-PASS unwrappedKey.key_ops is jwkKey.key_ops
-PASS unwrappedKey.ext is jwkKey.ext
-PASS unwrappedKey.n is jwkKey.n
-PASS unwrappedKey.e is jwkKey.e
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
</del></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescbcimportkeyuwrapjwkrsakeypublichtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-uwrap-jwk-rsa-key-public.html (212735 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-uwrap-jwk-rsa-key-public.html        2017-02-21 20:00:52 UTC (rev 212735)
+++ trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-uwrap-jwk-rsa-key-public.html        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -1,55 +0,0 @@
</span><del>-<!DOCTYPE html>
-<html>
-<head>
-<script src="../../resources/js-test-pre.js"></script>
-<script src="../resources/common.js"></script>
-</head>
-<body>
-<p id="description"></p>
-<div id="console"></div>
-
-<script>
-description("Test unwrapping a JWK RSA public key with AES-CBC using an imported key");
-
-jsTestIsAsync = true;
-
-var extractable = true;
-var jwkKey = {
- kty: "RSA",
- alg: "RSA-OAEP",
- use: "enc",
- key_ops: ["encrypt"],
- ext: true,
- n: "rcCUCv7Oc1HVam1DIhCzqknThWawOp8QLk8Ziy2p10ByjQFCajoFiyuAWl-R1WXZaf4xitLRracT9agpzIzc-MbLSHIGgWQGO21lGiImy5ftZ-D8bHAqRz2y15pzD4c4CEou7XSSLDoRnR0QG5MsDhD6s2gV9mwHkrtkCxtMWdBi-77as8wGmlNRldcOSgZDLK8UnCSgA1OguZ989bFyc8tOOEIb0xUSfPSz3LPSCnyYz68aDjmKVeNH-ig857OScyWbGyEy3Biw64qun3juUlNWsJ3zngkOdteYWytx5Qr4XKNs6R-Myyq72KUp02mJDZiiyiglxML_i3-_CeecCw",
- e: "AQAB"
-};
-var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
-var aesCbcParams = {
- name: "aes-cbc",
- iv: asciiToUint8Array("jnOw99oOZFLIEPMr"),
-}
-var wrappedKey = hexStringToUint8Array( "848aa2f70ee18e2953520132a79cf47946e00c99362340bb690edc9ab5315757462c128278c6232e770e7437c56ed722a8e1703855f7f3e565394e1a6a0305c4ef1b30fa4c7f72d1a239cc6c6ba067898798a36a75132c66b4a2d3fb942886affd3ea3b2756b0ddc886c01e3b93107469b82124468408ef8ab548b85aa8f206c312d74ce4f2c679eb147a275cefda64d5bdc4a2b5b90a4ac9ad3eb5f2cf19f5f87653211f59b4731ba61125582a233951097dea65db05899d587d1dcfccab9ab7410ab3010b89066506dbacbc6b73e4b564792751388fa0f58d55c59c14a08c9dfb0f78100b0f5cc29d62328822636d30a6a153ec5cd4727ad5e47b419c48544565637ac5789863d43b7da78cf4383d09d66e9d458e436dbfbee75e382b2bab49eec2c7491ff93cf099fe92feaf4658e30889fd12d3ae61cd5e8c8e1e56a079b662f90cd10cdbdbb4d12eefb36d825e1a043e82f5a98f8960d655d3f9ed5af31e581fa846cc582f6cee5c25e0b3c32050534ae957ce27860d470ba26da2c7d6fa621b0faa8becad58e9e55bb2a9d984b042f25df21482529870d271cbf5508a0edfc3cb37316c11f16b342bc1f1f98aa");
-
-
-crypto.subtle.importKey("raw", rawKey, "aes-cbc", extractable, ["unwrapKey"]).then(function(unwrappingKey) {
- return crypto.subtle.unwrapKey("jwk", wrappedKey, unwrappingKey, aesCbcParams, {name: "rsa-oaep", hash: "sha-1"}, extractable, ["encrypt"]);
-}).then(function(cryptoKey) {
- return crypto.subtle.exportKey("jwk", cryptoKey);
-}).then(function(result) {
- unwrappedKey = result;
-
- shouldBe("unwrappedKey.kty", "jwkKey.kty");
- shouldBe("unwrappedKey.alg", "jwkKey.alg");
- shouldBe("unwrappedKey.key_ops", "jwkKey.key_ops");
- shouldBe("unwrappedKey.ext", "jwkKey.ext");
- shouldBe("unwrappedKey.n", "jwkKey.n");
- shouldBe("unwrappedKey.e", "jwkKey.e");
-
- finishJSTest();
-});
-
-</script>
-
-<script src="../../resources/js-test-post.js"></script>
-</body>
-</html>
</del></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescfbgenerateexportkeyjwklength128expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/aes-cfb-generate-export-key-jwk-length-128-expected.txt (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cfb-generate-export-key-jwk-length-128-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cfb-generate-export-key-jwk-length-128-expected.txt        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+Test exporting a 128 bits AES-CFB key with JWK format
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Generating a key...
+Exporting a key...
+PASS key.kty is 'oct'
+PASS key.key_ops is ['decrypt', 'encrypt', 'unwrapKey', 'wrapKey']
+PASS key.alg is 'A128CFB8'
+PASS key.ext is true
+PASS Base64URL.parse(key.k).byteLength is 16
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescfbgenerateexportkeyjwklength128html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/aes-cfb-generate-export-key-jwk-length-128.html (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cfb-generate-export-key-jwk-length-128.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cfb-generate-export-key-jwk-length-128.html        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test exporting a 128 bits AES-CFB key with JWK format");
+
+jsTestIsAsync = true;
+
+var extractable = true;
+
+debug("Generating a key...");
+crypto.subtle.generateKey({name: "aes-cfb-8", length: 128}, extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]).then(function(key) {
+ debug("Exporting a key...");
+ return crypto.subtle.exportKey("jwk", key);
+}).then(function(result) {
+ key = result;
+
+ shouldBe("key.kty", "'oct'");
+ shouldBe("key.key_ops", "['decrypt', 'encrypt', 'unwrapKey', 'wrapKey']");
+ shouldBe("key.alg", "'A128CFB8'");
+ shouldBe("key.ext", "true");
+ shouldBe("Base64URL.parse(key.k).byteLength", "16");
+
+ finishJSTest();
+});
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescfbgenerateexportkeyjwklength192expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/aes-cfb-generate-export-key-jwk-length-192-expected.txt (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cfb-generate-export-key-jwk-length-192-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cfb-generate-export-key-jwk-length-192-expected.txt        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+Test exporting a 192 bits AES-CFB key with JWK format
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Generating a key...
+Exporting a key...
+PASS key.kty is 'oct'
+PASS key.key_ops is ['decrypt', 'encrypt', 'unwrapKey', 'wrapKey']
+PASS key.alg is 'A192CFB8'
+PASS key.ext is true
+PASS Base64URL.parse(key.k).byteLength is 24
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescfbgenerateexportkeyjwklength192html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/aes-cfb-generate-export-key-jwk-length-192.html (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cfb-generate-export-key-jwk-length-192.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cfb-generate-export-key-jwk-length-192.html        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test exporting a 192 bits AES-CFB key with JWK format");
+
+jsTestIsAsync = true;
+
+var extractable = true;
+
+debug("Generating a key...");
+crypto.subtle.generateKey({name: "aes-cfb-8", length: 192}, extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]).then(function(key) {
+ debug("Exporting a key...");
+ return crypto.subtle.exportKey("jwk", key);
+}).then(function(result) {
+ key = result;
+
+ shouldBe("key.kty", "'oct'");
+ shouldBe("key.key_ops", "['decrypt', 'encrypt', 'unwrapKey', 'wrapKey']");
+ shouldBe("key.alg", "'A192CFB8'");
+ shouldBe("key.ext", "true");
+ shouldBe("Base64URL.parse(key.k).byteLength", "24");
+
+ finishJSTest();
+});
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescfbgenerateexportkeyjwklength256expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/aes-cfb-generate-export-key-jwk-length-256-expected.txt (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cfb-generate-export-key-jwk-length-256-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cfb-generate-export-key-jwk-length-256-expected.txt        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+Test exporting a 256 bits AES-CFB key with JWK format
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Generating a key...
+Exporting a key...
+PASS key.kty is 'oct'
+PASS key.key_ops is ['decrypt', 'encrypt', 'unwrapKey', 'wrapKey']
+PASS key.alg is 'A256CFB8'
+PASS key.ext is true
+PASS Base64URL.parse(key.k).byteLength is 32
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescfbgenerateexportkeyjwklength256html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/aes-cfb-generate-export-key-jwk-length-256.html (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cfb-generate-export-key-jwk-length-256.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cfb-generate-export-key-jwk-length-256.html        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,37 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test exporting a 256 bits AES-CFB key with JWK format");
+
+jsTestIsAsync = true;
+
+var extractable = true;
+
+debug("Generating a key...");
+crypto.subtle.generateKey({name: "aes-cfb-8", length: 256}, extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]).then(function(key) {
+ debug("Exporting a key...");
+ return crypto.subtle.exportKey("jwk", key);
+}).then(function(result) {
+ key = result;
+
+ shouldBe("key.kty", "'oct'");
+ shouldBe("key.key_ops", "['decrypt', 'encrypt', 'unwrapKey', 'wrapKey']");
+ shouldBe("key.alg", "'A256CFB8'");
+ shouldBe("key.ext", "true");
+ shouldBe("Base64URL.parse(key.k).byteLength", "32");
+
+ finishJSTest();
+});
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescfbgenerateexportrawkeyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/aes-cfb-generate-export-raw-key-expected.txt (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cfb-generate-export-raw-key-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cfb-generate-export-raw-key-expected.txt        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+Test exporting a 256 bits AES-CFB key with raw format
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Generating a key...
+Exporting a key...
+PASS key.byteLength is 32
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescfbgenerateexportrawkeyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/aes-cfb-generate-export-raw-key.html (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cfb-generate-export-raw-key.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cfb-generate-export-raw-key.html        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,33 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test exporting a 256 bits AES-CFB key with raw format");
+
+jsTestIsAsync = true;
+
+var extractable = true;
+
+debug("Generating a key...");
+crypto.subtle.generateKey({name: "aes-cfb-8", length: 256}, extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]).then(function(key) {
+ debug("Exporting a key...");
+ return crypto.subtle.exportKey("raw", key);
+}).then(function(result) {
+ key = result;
+
+ shouldBe("key.byteLength", "32");
+
+ finishJSTest();
+});
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescfbgeneratekeyencryptdecryptexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/aes-cfb-generate-key-encrypt-decrypt-expected.txt (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cfb-generate-key-encrypt-decrypt-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cfb-generate-key-encrypt-decrypt-expected.txt        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+Test encrypting&decrypting using AES-CFB algorithm with a generated 256bit key
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Generating a key...
+Encrypting...
+PASS bytesToASCIIString(cipherText) is not "Hello, World!"
+Decrypting...
+PASS bytesToASCIIString(decryptedText) is plainText
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescfbgeneratekeyencryptdecrypthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/aes-cfb-generate-key-encrypt-decrypt.html (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cfb-generate-key-encrypt-decrypt.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cfb-generate-key-encrypt-decrypt.html        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,42 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test encrypting&decrypting using AES-CFB algorithm with a generated 256bit key");
+
+jsTestIsAsync = true;
+var plainText = "Hello, World!";
+var aesCfbParams = {
+ name: "aes-cfb-8",
+ iv: asciiToUint8Array("jnOw99oOZFLIEPMr"),
+}
+
+debug("Generating a key...");
+crypto.subtle.generateKey({name: "aes-cfb-8", length: 256}, true, ["decrypt", "encrypt"]).then(function(result) {
+ key = result;
+ debug("Encrypting...");
+ return crypto.subtle.encrypt(aesCfbParams, key, asciiToUint8Array(plainText));
+}).then(function(result) {
+ cipherText = result;
+ shouldNotBeEqualToString("bytesToASCIIString(cipherText)", plainText);
+ debug("Decrypting...");
+ return crypto.subtle.decrypt(aesCfbParams, key, cipherText);
+}).then(function(result) {
+ decryptedText = result;
+
+ shouldBe("bytesToASCIIString(decryptedText)", "plainText");
+
+ finishJSTest();
+});
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescfbgeneratekeyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/aes-cfb-generate-key-expected.txt (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cfb-generate-key-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cfb-generate-key-expected.txt        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+Test generating an AES key with length 128 using AES-CFB algorithm.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Generating a key...
+PASS key.type is 'secret'
+PASS key.extractable is true
+PASS key.algorithm.name is 'AES-CFB-8'
+PASS key.algorithm.length is 128
+PASS key.usages is ['decrypt', 'encrypt', 'unwrapKey', 'wrapKey']
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescfbgeneratekeyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/aes-cfb-generate-key.html (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cfb-generate-key.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cfb-generate-key.html        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,32 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test generating an AES key with length 128 using AES-CFB algorithm.");
+
+jsTestIsAsync = true;
+
+debug("Generating a key...");
+crypto.subtle.generateKey({name: "aes-cfb-8", length: 128}, true, ["encrypt", "decrypt", "unwrapKey", "wrapKey"]).then(function(result) {
+ key = result;
+
+ shouldBe("key.type", "'secret'");
+ shouldBe("key.extractable", "true");
+ shouldBe("key.algorithm.name", "'AES-CFB-8'");
+ shouldBe("key.algorithm.length", "128");
+ shouldBe("key.usages", "['decrypt', 'encrypt', 'unwrapKey', 'wrapKey']");
+
+ finishJSTest();
+});
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescfbimportjwkkeylength128expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/aes-cfb-import-jwk-key-length-128-expected.txt (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cfb-import-jwk-key-length-128-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cfb-import-jwk-key-length-128-expected.txt        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+Test importing a JWK AES-CFB key with legnth 128
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Importing a key...
+PASS key.type is 'secret'
+PASS key.extractable is true
+PASS key.algorithm.name is 'AES-CFB-8'
+PASS key.algorithm.length is 128
+PASS key.usages is ['decrypt', 'encrypt', 'unwrapKey', 'wrapKey']
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescfbimportjwkkeylength128html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/aes-cfb-import-jwk-key-length-128.html (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cfb-import-jwk-key-length-128.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cfb-import-jwk-key-length-128.html        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test importing a JWK AES-CFB key with legnth 128");
+
+jsTestIsAsync = true;
+
+var jwkKey = {
+ kty: "oct",
+ k: "YWJjZGVmZ2gxMjM0NTY3OA",
+ alg: "A128CFB8",
+};
+var extractable = true;
+
+debug("Importing a key...");
+crypto.subtle.importKey("jwk", jwkKey, "aes-cfb-8", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]).then(function(result) {
+ key = result;
+
+ shouldBe("key.type", "'secret'");
+ shouldBe("key.extractable", "true");
+ shouldBe("key.algorithm.name", "'AES-CFB-8'");
+ shouldBe("key.algorithm.length", "128");
+ shouldBe("key.usages", "['decrypt', 'encrypt', 'unwrapKey', 'wrapKey']");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescfbimportjwkkeylength192expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/aes-cfb-import-jwk-key-length-192-expected.txt (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cfb-import-jwk-key-length-192-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cfb-import-jwk-key-length-192-expected.txt        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+Test importing a JWK AES-CFB key with legnth 192
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Importing a key...
+PASS key.type is 'secret'
+PASS key.extractable is true
+PASS key.algorithm.name is 'AES-CFB-8'
+PASS key.algorithm.length is 192
+PASS key.usages is ['decrypt', 'encrypt', 'unwrapKey', 'wrapKey']
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescfbimportjwkkeylength192html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/aes-cfb-import-jwk-key-length-192.html (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cfb-import-jwk-key-length-192.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cfb-import-jwk-key-length-192.html        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test importing a JWK AES-CFB key with legnth 192");
+
+jsTestIsAsync = true;
+
+var jwkKey = {
+ kty: "oct",
+ k: "A72FD48989ED7E92A3B3A080F74FA80B",
+ alg: "A192CFB8",
+};
+var extractable = true;
+
+debug("Importing a key...");
+crypto.subtle.importKey("jwk", jwkKey, "aes-cfb-8", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]).then(function(result) {
+ key = result;
+
+ shouldBe("key.type", "'secret'");
+ shouldBe("key.extractable", "true");
+ shouldBe("key.algorithm.name", "'AES-CFB-8'");
+ shouldBe("key.algorithm.length", "192");
+ shouldBe("key.usages", "['decrypt', 'encrypt', 'unwrapKey', 'wrapKey']");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescfbimportjwkkeylength256expectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/aes-cfb-import-jwk-key-length-256-expected.txt (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cfb-import-jwk-key-length-256-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cfb-import-jwk-key-length-256-expected.txt        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+Test importing a JWK AES-CFB key with legnth 256
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Importing a key...
+PASS key.type is 'secret'
+PASS key.extractable is true
+PASS key.algorithm.name is 'AES-CFB-8'
+PASS key.algorithm.length is 256
+PASS key.usages is ['decrypt', 'encrypt', 'unwrapKey', 'wrapKey']
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescfbimportjwkkeylength256html"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/aes-cfb-import-jwk-key-length-256.html (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cfb-import-jwk-key-length-256.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cfb-import-jwk-key-length-256.html        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test importing a JWK AES-CFB key with legnth 256");
+
+jsTestIsAsync = true;
+
+var jwkKey = {
+ kty: "oct",
+ k: "YWJjZGVmZ2gxMjM0NTY3OGFiY2RlZmdoMTIzNDU2Nzg",
+ alg: "A256CFB8",
+};
+var extractable = true;
+
+debug("Importing a key...");
+crypto.subtle.importKey("jwk", jwkKey, "aes-cfb-8", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]).then(function(result) {
+ key = result;
+
+ shouldBe("key.type", "'secret'");
+ shouldBe("key.extractable", "true");
+ shouldBe("key.algorithm.name", "'AES-CFB-8'");
+ shouldBe("key.algorithm.length", "256");
+ shouldBe("key.usages", "['decrypt', 'encrypt', 'unwrapKey', 'wrapKey']");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescfbimportkeydecryptexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-decrypt-expected.txt (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-decrypt-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-decrypt-expected.txt        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test decrypting using AES-CFB with an imported 128bit key
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS bytesToASCIIString(plainText) is expectedPlainText
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescfbimportkeydecrypthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-decrypt.html (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-decrypt.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-decrypt.html        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test decrypting using AES-CFB with an imported 128bit key");
+
+jsTestIsAsync = true;
+
+var extractable = false;
+var cipherText = hexStringToUint8Array("a572525a0baef88e6f5b198c6f");
+var aesCfbParams = {
+ name: "aes-cfb-8",
+ iv: asciiToUint8Array("jnOw99oOZFLIEPMr"),
+}
+var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
+var expectedPlainText = "Hello, World!";
+
+crypto.subtle.importKey("raw", rawKey, "aes-cfb-8", extractable, ["decrypt"]).then(function(key) {
+ return crypto.subtle.decrypt(aesCfbParams, key, cipherText);
+}).then(function(result) {
+ plainText = result;
+
+ shouldBe("bytesToASCIIString(plainText)", "expectedPlainText");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescfbimportkeyencryptexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-encrypt-expected.txt (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-encrypt-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-encrypt-expected.txt        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test encrypting using AES-CFB with an imported 128bit key
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS bytesToHexString(cipherText) is expectedCipherText
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescfbimportkeyencrypthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-encrypt.html (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-encrypt.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-encrypt.html        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test encrypting using AES-CFB with an imported 128bit key");
+
+jsTestIsAsync = true;
+
+var extractable = false;
+var plainText = asciiToUint8Array("Hello, World!");
+var aesCfbParams = {
+ name: "aes-cfb-8",
+ iv: asciiToUint8Array("jnOw99oOZFLIEPMr"),
+}
+var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
+var expectedCipherText = "a572525a0baef88e6f5b198c6f";
+
+crypto.subtle.importKey("raw", rawKey, "aes-cfb-8", extractable, ["encrypt"]).then(function(key) {
+ return crypto.subtle.encrypt(aesCfbParams, key, plainText);
+}).then(function(result) {
+ cipherText = result;
+
+ shouldBe("bytesToHexString(cipherText)", "expectedCipherText");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescfbimportkeyunwrapjwkkeyexpectedtxtfromrev212735trunkLayoutTestscryptosubtleaescbcimportkeyuwrapjwkrsakeypublicexpectedtxt"></a>
<div class="copfile"><h4>Copied: trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-unwrap-jwk-key-expected.txt (from rev 212735, trunk/LayoutTests/crypto/subtle/aes-cbc-import-key-uwrap-jwk-rsa-key-public-expected.txt) (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-unwrap-jwk-key-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-unwrap-jwk-key-expected.txt        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,14 @@
</span><ins>+Test unwrapping a JWK key with AES-CFB using an imported key
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS unwrappedKey.kty is jwkKey.kty
+PASS unwrappedKey.alg is jwkKey.alg
+PASS unwrappedKey.key_ops is jwkKey.key_ops
+PASS unwrappedKey.ext is jwkKey.ext
+PASS unwrappedKey.k is jwkKey.k
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescfbimportkeyunwrapjwkkeyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-unwrap-jwk-key.html (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-unwrap-jwk-key.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-unwrap-jwk-key.html        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test unwrapping a JWK key with AES-CFB using an imported key");
+
+jsTestIsAsync = true;
+
+var extractable = true;
+var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
+var jwkKey = {
+ kty: "oct",
+ alg: "A128CBC",
+ use: "enc",
+ key_ops: ["encrypt"],
+ ext: true,
+ k: "am5Pdzk5b09aRkxJRVBNcg",
+};
+var aesCfbParams = {
+ name: "aes-cfb-8",
+ iv: asciiToUint8Array("jnOw99oOZFLIEPMr"),
+}
+var wrappedKey = hexStringToUint8Array("96a1740c58cb039ce9d3f77c4031efc6e3c16adbc1ce9a1b0d5bc5b953e2d9de3f5413b01b940477fd80cee9f49e09c38ce965c2040a3fc1449ba4f2b6c03386acd2b2a145e335e1890c4ac351b4702d07b6ea330cce9d44af7e2a");
+
+
+crypto.subtle.importKey("raw", rawKey, "aes-cfb-8", extractable, ["unwrapKey"]).then(function(unwrappingKey) {
+ return crypto.subtle.unwrapKey("jwk", wrappedKey, unwrappingKey, aesCfbParams, {name: "aes-cbc"}, extractable, ["encrypt"]);
+}).then(function(cryptoKey) {
+ return crypto.subtle.exportKey("jwk", cryptoKey);
+}).then(function(result) {
+ unwrappedKey = result;
+
+ shouldBe("unwrappedKey.kty", "jwkKey.kty");
+ shouldBe("unwrappedKey.alg", "jwkKey.alg");
+ shouldBe("unwrappedKey.key_ops", "jwkKey.key_ops");
+ shouldBe("unwrappedKey.ext", "jwkKey.ext");
+ shouldBe("unwrappedKey.k", "jwkKey.k");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescfbimportkeyunwraprawkeyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-unwrap-raw-key-expected.txt (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-unwrap-raw-key-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-unwrap-raw-key-expected.txt        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test unwrapping a raw key with AES-CFB using an imported key
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS bytesToASCIIString(unwrappedKey) is expectedRawKey
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescfbimportkeyunwraprawkeyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-unwrap-raw-key.html (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-unwrap-raw-key.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-unwrap-raw-key.html        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,42 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test unwrapping a raw key with AES-CFB using an imported key");
+
+jsTestIsAsync = true;
+
+var extractable = true;
+var expectedRawKey = "jnOw99oOZFLIEPMr";
+var rawKey = asciiToUint8Array(expectedRawKey);
+var aesCfbParams = {
+ name: "aes-cfb-8",
+ iv: asciiToUint8Array("jnOw99oOZFLIEPMr"),
+}
+var wrappedKey = hexStringToUint8Array("8707ee311f6e8ed157885a7fc25f0ee7");
+
+
+crypto.subtle.importKey("raw", rawKey, "aes-cfb-8", extractable, ["unwrapKey"]).then(function(unwrappingKey) {
+ return crypto.subtle.unwrapKey("raw", wrappedKey, unwrappingKey, aesCfbParams, {name: "aes-cbc"}, extractable, ["encrypt"]);
+}).then(function(cryptoKey) {
+ return crypto.subtle.exportKey("raw", cryptoKey);
+}).then(function(result) {
+ unwrappedKey = result;
+
+ shouldBe("bytesToASCIIString(unwrappedKey)", "expectedRawKey");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescfbimportkeywrapjwkkeyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-wrap-jwk-key-expected.txt (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-wrap-jwk-key-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-wrap-jwk-key-expected.txt        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test wrapping a JWK key with AES-CFB using an imported key
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS bytesToHexString(wrappedKey) is expectWrappedKey
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescfbimportkeywrapjwkkeyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-wrap-jwk-key.html (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-wrap-jwk-key.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-wrap-jwk-key.html        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,42 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test wrapping a JWK key with AES-CFB using an imported key");
+
+jsTestIsAsync = true;
+
+var extractable = true;
+var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
+var aesCfbParams = {
+ name: "aes-cfb-8",
+ iv: asciiToUint8Array("jnOw99oOZFLIEPMr"),
+}
+var expectWrappedKey = "96a17ede3414d990741d2fe5f1d93e74999ed6ca6071db6dc0cf0bcf9178b1ac037076d18ffe0e247ee570c2d551bc7621b0d791df9c7bc7c021ea1fda83e4c41d8704112777a86413dd7b20088479a615b83942d3903ef08f81f4";
+
+crypto.subtle.importKey("raw", rawKey, "aes-cfb-8", extractable, ["wrapKey"]).then(function(result) {
+ wrappingKey = result;
+ return crypto.subtle.importKey("raw", rawKey, "aes-cbc", extractable, ["encrypt"]);
+}).then(function(result) {
+ key = result;
+ return crypto.subtle.wrapKey("jwk", key, wrappingKey, aesCfbParams);
+}).then(function(result) {
+ wrappedKey = result;
+
+ shouldBe("bytesToHexString(wrappedKey)", "expectWrappedKey");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescfbimportkeywraprawkeyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-wrap-raw-key-expected.txt (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-wrap-raw-key-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-wrap-raw-key-expected.txt        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+Test wrapping a raw key with AES-CFB using an imported key
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS bytesToHexString(wrappedKey) is expectWrappedKey
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescfbimportkeywraprawkeyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-wrap-raw-key.html (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-wrap-raw-key.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cfb-import-key-wrap-raw-key.html        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,42 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test wrapping a raw key with AES-CFB using an imported key");
+
+jsTestIsAsync = true;
+
+var extractable = true;
+var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
+var aesCfbParams = {
+ name: "aes-cfb-8",
+ iv: asciiToUint8Array("jnOw99oOZFLIEPMr"),
+}
+var expectWrappedKey = "8707ee311f6e8ed157885a7fc25f0ee7";
+
+crypto.subtle.importKey("raw", rawKey, "aes-cfb-8", extractable, ["wrapKey"]).then(function(result) {
+ wrappingKey = result;
+ return crypto.subtle.importKey("raw", rawKey, "aes-cbc", extractable, ["encrypt"]);
+}).then(function(result) {
+ key = result;
+ return crypto.subtle.wrapKey("raw", key, wrappingKey, aesCfbParams);
+}).then(function(result) {
+ wrappedKey = result;
+
+ shouldBe("bytesToHexString(wrappedKey)", "expectWrappedKey");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescfbimportrawkeyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/aes-cfb-import-raw-key-expected.txt (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cfb-import-raw-key-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cfb-import-raw-key-expected.txt        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,15 @@
</span><ins>+Test importing a raw AES-CFB key with legnth 128
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Importing a key...
+PASS key.type is 'secret'
+PASS key.extractable is true
+PASS key.algorithm.name is 'AES-CFB-8'
+PASS key.algorithm.length is 128
+PASS key.usages is ['decrypt', 'encrypt', 'unwrapKey', 'wrapKey']
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaescfbimportrawkeyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/subtle/aes-cfb-import-raw-key.html (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-cfb-import-raw-key.html         (rev 0)
+++ trunk/LayoutTests/crypto/subtle/aes-cfb-import-raw-key.html        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,36 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/js-test-pre.js"></script>
+<script src="../resources/common.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test importing a raw AES-CFB key with legnth 128");
+
+jsTestIsAsync = true;
+
+var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
+var extractable = true;
+
+debug("Importing a key...");
+crypto.subtle.importKey("raw", rawKey, "aes-cfb-8", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]).then(function(result) {
+ key = result;
+
+ shouldBe("key.type", "'secret'");
+ shouldBe("key.extractable", "true");
+ shouldBe("key.algorithm.name", "'AES-CFB-8'");
+ shouldBe("key.algorithm.length", "128");
+ shouldBe("key.usages", "['decrypt', 'encrypt', 'unwrapKey', 'wrapKey']");
+
+ finishJSTest();
+});
+
+</script>
+
+<script src="../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaesgeneratekeymalformedparametersexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/crypto/subtle/aes-generate-key-malformed-parameters-expected.txt (212735 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-generate-key-malformed-parameters-expected.txt        2017-02-21 20:00:52 UTC (rev 212735)
+++ trunk/LayoutTests/crypto/subtle/aes-generate-key-malformed-parameters-expected.txt        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -21,6 +21,10 @@
</span><span class="cx"> PASS crypto.subtle.generateKey({name: "aes-kw", length: 128}, extractable, ["verify"]) rejected promise with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
</span><span class="cx"> PASS crypto.subtle.generateKey({name: "aes-kw", length: 128}, extractable, ["deriveKey"]) rejected promise with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
</span><span class="cx"> PASS crypto.subtle.generateKey({name: "aes-kw", length: 128}, extractable, ["deriveBits"]) rejected promise with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
</span><ins>+PASS crypto.subtle.generateKey({name: "aes-cfb-8", length: 128}, extractable, ["sign"]) rejected promise with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
+PASS crypto.subtle.generateKey({name: "aes-cfb-8", length: 128}, extractable, ["verify"]) rejected promise with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
+PASS crypto.subtle.generateKey({name: "aes-cfb-8", length: 128}, extractable, ["deriveKey"]) rejected promise with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
+PASS crypto.subtle.generateKey({name: "aes-cfb-8", length: 128}, extractable, ["deriveBits"]) rejected promise with SyntaxError (DOM Exception 12): A required parameter was missing or out-of-range.
</ins><span class="cx"> PASS crypto.subtle.generateKey({name: "aes-cbc", length: 111}, extractable, ["encrypt"]) rejected promise with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
</span><span class="cx"> PASS crypto.subtle.generateKey({name: "aes-kw", length: 111}, extractable, ["wrapKey"]) rejected promise with OperationError (DOM Exception 34): The operation failed for an operation-specific reason.
</span><span class="cx"> PASS successfullyParsed is true
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaesgeneratekeymalformedparametershtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/crypto/subtle/aes-generate-key-malformed-parameters.html (212735 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-generate-key-malformed-parameters.html        2017-02-21 20:00:52 UTC (rev 212735)
+++ trunk/LayoutTests/crypto/subtle/aes-generate-key-malformed-parameters.html        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -33,6 +33,10 @@
</span><span class="cx"> shouldReject('crypto.subtle.generateKey({name: "aes-kw", length: 128}, extractable, ["verify"])');
</span><span class="cx"> shouldReject('crypto.subtle.generateKey({name: "aes-kw", length: 128}, extractable, ["deriveKey"])');
</span><span class="cx"> shouldReject('crypto.subtle.generateKey({name: "aes-kw", length: 128}, extractable, ["deriveBits"])');
</span><ins>+shouldReject('crypto.subtle.generateKey({name: "aes-cfb-8", length: 128}, extractable, ["sign"])');
+shouldReject('crypto.subtle.generateKey({name: "aes-cfb-8", length: 128}, extractable, ["verify"])');
+shouldReject('crypto.subtle.generateKey({name: "aes-cfb-8", length: 128}, extractable, ["deriveKey"])');
+shouldReject('crypto.subtle.generateKey({name: "aes-cfb-8", length: 128}, extractable, ["deriveBits"])');
</ins><span class="cx"> // Wrong length
</span><span class="cx"> shouldReject('crypto.subtle.generateKey({name: "aes-cbc", length: 111}, extractable, ["encrypt"])');
</span><span class="cx"> shouldReject('crypto.subtle.generateKey({name: "aes-kw", length: 111}, extractable, ["wrapKey"])');
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaesimportkeymalformedparametersexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/crypto/subtle/aes-import-key-malformed-parameters-expected.txt (212735 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-import-key-malformed-parameters-expected.txt        2017-02-21 20:00:52 UTC (rev 212735)
+++ trunk/LayoutTests/crypto/subtle/aes-import-key-malformed-parameters-expected.txt        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -20,6 +20,10 @@
</span><span class="cx"> PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k128, alg: ""}, "aes-kw", extractable, ["wrapKey", "unwrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><span class="cx"> PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k192, alg: ""}, "aes-kw", extractable, ["wrapKey", "unwrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><span class="cx"> PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k256, alg: ""}, "aes-kw", extractable, ["wrapKey", "unwrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><ins>+PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k128, alg: "A192CFB8"}, "aes-cfb-8", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
+PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k192, alg: "A256CFB8"}, "aes-cfb-8", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
+PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k256, alg: "A128CFB8"}, "aes-cfb-8", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
+PASS crypto.subtle.importKey("jwk", {kty: "oct", k: "A72F", alg: "foo"}, "aes-cbc", extractable, ["wrapKey", "unwrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</ins><span class="cx"> PASS crypto.subtle.importKey("jwk", {kty: "oct", k: "!!!", alg: "foo"}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><span class="cx"> PASS crypto.subtle.importKey("jwk", {kty: "oct", k: "", alg: "foo"}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span><span class="cx"> PASS crypto.subtle.importKey("jwk", {kty: "oct", k: k128, alg: "A128CBC", use: "sig"}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"]) rejected promise with DataError (DOM Exception 30): Data provided to an operation does not meet requirements.
</span></span></pre></div>
<a id="trunkLayoutTestscryptosubtleaesimportkeymalformedparametershtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/crypto/subtle/aes-import-key-malformed-parameters.html (212735 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/subtle/aes-import-key-malformed-parameters.html        2017-02-21 20:00:52 UTC (rev 212735)
+++ trunk/LayoutTests/crypto/subtle/aes-import-key-malformed-parameters.html        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -37,6 +37,10 @@
</span><span class="cx"> shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k128, alg: ""}, "aes-kw", extractable, ["wrapKey", "unwrapKey"])');
</span><span class="cx"> shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k192, alg: ""}, "aes-kw", extractable, ["wrapKey", "unwrapKey"])');
</span><span class="cx"> shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k256, alg: ""}, "aes-kw", extractable, ["wrapKey", "unwrapKey"])');
</span><ins>+shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k128, alg: "A192CFB8"}, "aes-cfb-8", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])');
+shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k192, alg: "A256CFB8"}, "aes-cfb-8", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])');
+shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: k256, alg: "A128CFB8"}, "aes-cfb-8", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])');
+shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: "A72F", alg: "foo"}, "aes-cbc", extractable, ["wrapKey", "unwrapKey"])');
</ins><span class="cx"> // Jwk: wrong k format
</span><span class="cx"> shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: "!!!", alg: "foo"}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])');
</span><span class="cx"> shouldReject('crypto.subtle.importKey("jwk", {kty: "oct", k: "", alg: "foo"}, "aes-cbc", extractable, ["encrypt", "decrypt", "wrapKey", "unwrapKey"])');
</span></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtleaescfbimportkeydecryptexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/aes-cfb-import-key-decrypt-expected.txt (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/aes-cfb-import-key-decrypt-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/aes-cfb-import-key-decrypt-expected.txt        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+[Worker] Test decrypting using AES-CFB with an imported 128bit key in workers
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Starting worker: resources/aes-cfb-import-key-decrypt.js
+PASS [Worker] bytesToASCIIString(plainText) is expectedPlainText
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtleaescfbimportkeydecrypthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/aes-cfb-import-key-decrypt.html (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/aes-cfb-import-key-decrypt.html         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/aes-cfb-import-key-decrypt.html        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+ <script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+ <script>
+ worker = startWorker('resources/aes-cfb-import-key-decrypt.js');
+ </script>
+ <script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtleaescfbimportkeyencryptexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/aes-cfb-import-key-encrypt-expected.txt (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/aes-cfb-import-key-encrypt-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/aes-cfb-import-key-encrypt-expected.txt        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+[Worker] Test encrypting using AES-CFB with an imported 128bit key in workers
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Starting worker: resources/aes-cfb-import-key-encrypt.js
+PASS [Worker] bytesToHexString(cipherText) is expectedCipherText
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtleaescfbimportkeyencrypthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/aes-cfb-import-key-encrypt.html (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/aes-cfb-import-key-encrypt.html         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/aes-cfb-import-key-encrypt.html        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+ <script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+ <script>
+ worker = startWorker('resources/aes-cfb-import-key-encrypt.js');
+ </script>
+ <script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtleaescfbimportkeyunwrapkeyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/aes-cfb-import-key-unwrap-key-expected.txt (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/aes-cfb-import-key-unwrap-key-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/aes-cfb-import-key-unwrap-key-expected.txt        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+[Worker] Test unwrapping a raw key with AES-CFB using an imported key in workers
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Starting worker: resources/aes-cfb-import-key-unwrap-key.js
+PASS [Worker] bytesToASCIIString(unwrappedKey) is expectedRawKey
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtleaescfbimportkeyunwrapkeyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/aes-cfb-import-key-unwrap-key.html (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/aes-cfb-import-key-unwrap-key.html         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/aes-cfb-import-key-unwrap-key.html        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+ <script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+ <script>
+ worker = startWorker('resources/aes-cfb-import-key-unwrap-key.js');
+ </script>
+ <script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtleaescfbimportkeywrapkeyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/aes-cfb-import-key-wrap-key-expected.txt (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/aes-cfb-import-key-wrap-key-expected.txt         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/aes-cfb-import-key-wrap-key-expected.txt        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+[Worker] Test wrapping a raw key with AES-CFB using an imported key in workers
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Starting worker: resources/aes-cfb-import-key-wrap-key.js
+PASS [Worker] bytesToHexString(wrappedKey) is expectWrappedKey
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtleaescfbimportkeywrapkeyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/aes-cfb-import-key-wrap-key.html (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/aes-cfb-import-key-wrap-key.html         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/aes-cfb-import-key-wrap-key.html        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+ <script src="../../../resources/js-test-pre.js"></script>
+</head>
+<body>
+ <script>
+ worker = startWorker('resources/aes-cfb-import-key-wrap-key.js');
+ </script>
+ <script src="../../../resources/js-test-post.js"></script>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtleresourcesaescfbimportkeydecryptjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/resources/aes-cfb-import-key-decrypt.js (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/resources/aes-cfb-import-key-decrypt.js         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/resources/aes-cfb-import-key-decrypt.js        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+importScripts('../../../../resources/js-test-pre.js');
+importScripts('../../../resources/common.js');
+
+description("Test decrypting using AES-CFB with an imported 128bit key in workers");
+
+jsTestIsAsync = true;
+
+var extractable = false;
+var cipherText = hexStringToUint8Array("a572525a0baef88e6f5b198c6f");
+var aesCfbParams = {
+ name: "aes-cfb-8",
+ iv: asciiToUint8Array("jnOw99oOZFLIEPMr"),
+}
+var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
+var expectedPlainText = "Hello, World!";
+
+crypto.subtle.importKey("raw", rawKey, "aes-cfb-8", extractable, ["decrypt"]).then(function(key) {
+ return crypto.subtle.decrypt(aesCfbParams, key, cipherText);
+}).then(function(result) {
+ plainText = result;
+
+ shouldBe("bytesToASCIIString(plainText)", "expectedPlainText");
+
+ finishJSTest();
+});
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtleresourcesaescfbimportkeyencryptjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/resources/aes-cfb-import-key-encrypt.js (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/resources/aes-cfb-import-key-encrypt.js         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/resources/aes-cfb-import-key-encrypt.js        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+importScripts('../../../../resources/js-test-pre.js');
+importScripts('../../../resources/common.js');
+
+description("Test encrypting using AES-CFB with an imported 128bit key in workers");
+
+jsTestIsAsync = true;
+
+var extractable = false;
+var plainText = asciiToUint8Array("Hello, World!");
+var aesCfbParams = {
+ name: "aes-cfb-8",
+ iv: asciiToUint8Array("jnOw99oOZFLIEPMr"),
+}
+var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
+var expectedCipherText = "a572525a0baef88e6f5b198c6f";
+
+crypto.subtle.importKey("raw", rawKey, "aes-cfb-8", extractable, ["encrypt"]).then(function(key) {
+ return crypto.subtle.encrypt(aesCfbParams, key, plainText);
+}).then(function(result) {
+ cipherText = result;
+
+ shouldBe("bytesToHexString(cipherText)", "expectedCipherText");
+
+ finishJSTest();
+});
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtleresourcesaescfbimportkeyunwrapkeyjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/resources/aes-cfb-import-key-unwrap-key.js (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/resources/aes-cfb-import-key-unwrap-key.js         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/resources/aes-cfb-import-key-unwrap-key.js        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+importScripts('../../../../resources/js-test-pre.js');
+importScripts('../../../resources/common.js');
+
+description("Test unwrapping a raw key with AES-CFB using an imported key in workers");
+
+jsTestIsAsync = true;
+
+var extractable = true;
+var expectedRawKey = "jnOw99oOZFLIEPMr";
+var rawKey = asciiToUint8Array(expectedRawKey);
+var aesCfbParams = {
+ name: "aes-cfb-8",
+ iv: asciiToUint8Array("jnOw99oOZFLIEPMr"),
+}
+var wrappedKey = hexStringToUint8Array("8707ee311f6e8ed157885a7fc25f0ee7");
+
+
+crypto.subtle.importKey("raw", rawKey, "aes-cfb-8", extractable, ["unwrapKey"]).then(function(unwrappingKey) {
+ return crypto.subtle.unwrapKey("raw", wrappedKey, unwrappingKey, aesCfbParams, {name: "aes-cbc"}, extractable, ["encrypt"]);
+}).then(function(cryptoKey) {
+ return crypto.subtle.exportKey("raw", cryptoKey);
+}).then(function(result) {
+ unwrappedKey = result;
+
+ shouldBe("bytesToASCIIString(unwrappedKey)", "expectedRawKey");
+
+ finishJSTest();
+});
</ins></span></pre></div>
<a id="trunkLayoutTestscryptoworkerssubtleresourcesaescfbimportkeywrapkeyjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/crypto/workers/subtle/resources/aes-cfb-import-key-wrap-key.js (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/crypto/workers/subtle/resources/aes-cfb-import-key-wrap-key.js         (rev 0)
+++ trunk/LayoutTests/crypto/workers/subtle/resources/aes-cfb-import-key-wrap-key.js        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+importScripts('../../../../resources/js-test-pre.js');
+importScripts('../../../resources/common.js');
+
+description("Test wrapping a raw key with AES-CFB using an imported key in workers");
+
+jsTestIsAsync = true;
+
+var extractable = true;
+var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr");
+var aesCfbParams = {
+ name: "aes-cfb-8",
+ iv: asciiToUint8Array("jnOw99oOZFLIEPMr"),
+}
+var expectWrappedKey = "8707ee311f6e8ed157885a7fc25f0ee7";
+
+crypto.subtle.importKey("raw", rawKey, "aes-cfb-8", extractable, ["wrapKey"]).then(function(result) {
+ wrappingKey = result;
+ return crypto.subtle.importKey("raw", rawKey, "aes-cbc", extractable, ["encrypt"]);
+}).then(function(result) {
+ key = result;
+ return crypto.subtle.wrapKey("raw", key, wrappingKey, aesCfbParams);
+}).then(function(result) {
+ wrappedKey = result;
+
+ shouldBe("bytesToHexString(wrappedKey)", "expectWrappedKey");
+
+ finishJSTest();
+});
</ins></span></pre></div>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (212735 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2017-02-21 20:00:52 UTC (rev 212735)
+++ trunk/Source/WebCore/CMakeLists.txt        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -331,7 +331,7 @@
</span><span class="cx"> crypto/SubtleCrypto.idl
</span><span class="cx"> crypto/WebKitSubtleCrypto.idl
</span><span class="cx">
</span><del>- crypto/parameters/AesCbcParams.idl
</del><ins>+ crypto/parameters/AesCbcCfbParams.idl
</ins><span class="cx"> crypto/parameters/AesKeyGenParams.idl
</span><span class="cx"> crypto/parameters/HmacKeyParams.idl
</span><span class="cx"> crypto/parameters/RsaHashedImportParams.idl
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (212735 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-02-21 20:00:52 UTC (rev 212735)
+++ trunk/Source/WebCore/ChangeLog        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -1,3 +1,88 @@
</span><ins>+2017-02-21 Jiewen Tan <jiewen_tan@apple.com>
+
+ [WebCrypto] Add support for AES-CFB
+ https://bugs.webkit.org/show_bug.cgi?id=168344
+ <rdar://problem/20940221>
+
+ Reviewed by Brent Fulgham.
+
+ This patch adds support for AES-CFB. Operations of AES-CFB include: encrypt, decrypt, generateKey,
+ importKey, exportKey, wrapKey, and unwrapKey. This implementation follows a slightly old version
+ of WebCryptoAPI spec: https://www.w3.org/TR/2014/CR-WebCryptoAPI-20141211/#aes-cfb.
+
+ Tests: crypto/subtle/aes-cbc-cfb-decrypt-malformed-parameters.html
+ crypto/subtle/aes-cbc-cfb-encrypt-malformed-parameters.html
+ crypto/subtle/aes-cbc-import-key-unwrap-jwk-rsa-key-public.html
+ crypto/subtle/aes-cfb-generate-export-key-jwk-length-128.html
+ crypto/subtle/aes-cfb-generate-export-key-jwk-length-192.html
+ crypto/subtle/aes-cfb-generate-export-key-jwk-length-256.html
+ crypto/subtle/aes-cfb-generate-export-raw-key.html
+ crypto/subtle/aes-cfb-generate-key-encrypt-decrypt.html
+ crypto/subtle/aes-cfb-generate-key.html
+ crypto/subtle/aes-cfb-import-jwk-key-length-128.html
+ crypto/subtle/aes-cfb-import-jwk-key-length-192.html
+ crypto/subtle/aes-cfb-import-jwk-key-length-256.html
+ crypto/subtle/aes-cfb-import-key-decrypt.html
+ crypto/subtle/aes-cfb-import-key-encrypt.html
+ crypto/subtle/aes-cfb-import-key-unwrap-jwk-key.html
+ crypto/subtle/aes-cfb-import-key-unwrap-raw-key.html
+ crypto/subtle/aes-cfb-import-key-wrap-jwk-key.html
+ crypto/subtle/aes-cfb-import-key-wrap-raw-key.html
+ crypto/subtle/aes-cfb-import-raw-key.html
+ crypto/workers/subtle/aes-cfb-import-key-decrypt.html
+ crypto/workers/subtle/aes-cfb-import-key-encrypt.html
+ crypto/workers/subtle/aes-cfb-import-key-unwrap-key.html
+ crypto/workers/subtle/aes-cfb-import-key-wrap-key.html
+
+ * CMakeLists.txt:
+ * DerivedSources.make:
+ * PlatformGTK.cmake:
+ * PlatformMac.cmake:
+ * WebCore.xcodeproj/project.pbxproj:
+ Add CryptoAlgorithmAES_CFB.cpp,
+ change AesCbcParams.idl to AesCbcCfbParams.idl.
+ * bindings/js/JSSubtleCryptoCustom.cpp:
+ (WebCore::normalizeCryptoAlgorithmParameters):
+ Add support for AES-CFB.
+ * crypto/CryptoAlgorithm.h:
+ Include <wtf/Variant.h>.
+ * crypto/CryptoAlgorithmParameters.h:
+ Add support for AES-CFB.
+ * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp:
+ (WebCore::CryptoAlgorithmAES_CBC::encrypt):
+ (WebCore::CryptoAlgorithmAES_CBC::decrypt):
+ Rename CryptoAlgorithmAesCbcParams to CryptoAlgorithmAesCbcCfbParams.
+ * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp: Added.
+ (WebCore::usagesAreInvalidForCryptoAlgorithmAES_CFB):
+ (WebCore::CryptoAlgorithmAES_CFB::create):
+ (WebCore::CryptoAlgorithmAES_CFB::identifier):
+ (WebCore::CryptoAlgorithmAES_CFB::encrypt):
+ (WebCore::CryptoAlgorithmAES_CFB::decrypt):
+ (WebCore::CryptoAlgorithmAES_CFB::generateKey):
+ (WebCore::CryptoAlgorithmAES_CFB::importKey):
+ (WebCore::CryptoAlgorithmAES_CFB::exportKey):
+ * crypto/algorithms/CryptoAlgorithmAES_CFB.h: Added.
+ * crypto/gnutls/CryptoAlgorithmAES_CFBGnuTLS.cpp: Added.
+ (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
+ (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
+ Add dummy support of AES_CFB for GTK+.
+ * crypto/mac/CryptoAlgorithmAES_CBCMac.cpp:
+ (WebCore::transformAES_CBC):
+ Drop conditional PLATFORM(COCOA).
+ (WebCore::CryptoAlgorithmAES_CBC::platformEncrypt):
+ (WebCore::CryptoAlgorithmAES_CBC::platformDecrypt):
+ Rename CryptoAlgorithmAesCbcParams to CryptoAlgorithmAesCbcCfbParams.
+ * crypto/mac/CryptoAlgorithmAES_CFBMac.cpp: Added.
+ (WebCore::transformAES_CFB):
+ (WebCore::CryptoAlgorithmAES_CFB::platformEncrypt):
+ (WebCore::CryptoAlgorithmAES_CFB::platformDecrypt):
+ * crypto/mac/CryptoAlgorithmRegistryMac.cpp:
+ (WebCore::CryptoAlgorithmRegistry::platformRegisterAlgorithms):
+ Add support for AES-CFB.
+ * crypto/parameters/AesCbcCfbParams.idl: Renamed from Source/WebCore/crypto/parameters/AesCbcParams.idl.
+ * crypto/parameters/CryptoAlgorithmAesCbcCfbParams.h: Renamed from Source/WebCore/crypto/parameters/CryptoAlgorithmAesCbcParams.h.
+ Since dictionaries AesCbcParams and AesCfbParams are essentially the same, I combine them together in our implementations.
+
</ins><span class="cx"> 2017-02-21 Wenson Hsieh <wenson_hsieh@apple.com>
</span><span class="cx">
</span><span class="cx"> Unreviewed, fix the ToT iOS build
</span></span></pre></div>
<a id="trunkSourceWebCoreDerivedSourcesmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/DerivedSources.make (212735 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/DerivedSources.make        2017-02-21 20:00:52 UTC (rev 212735)
+++ trunk/Source/WebCore/DerivedSources.make        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -265,7 +265,7 @@
</span><span class="cx"> $(WebCore)/crypto/RsaOtherPrimesInfo.idl \
</span><span class="cx"> $(WebCore)/crypto/SubtleCrypto.idl \
</span><span class="cx"> $(WebCore)/crypto/WebKitSubtleCrypto.idl \
</span><del>- $(WebCore)/crypto/parameters/AesCbcParams.idl \
</del><ins>+ $(WebCore)/crypto/parameters/AesCbcCfbParams.idl \
</ins><span class="cx"> $(WebCore)/crypto/parameters/AesKeyGenParams.idl \
</span><span class="cx"> $(WebCore)/crypto/parameters/HmacKeyParams.idl \
</span><span class="cx"> $(WebCore)/crypto/parameters/RsaHashedImportParams.idl \
</span></span></pre></div>
<a id="trunkSourceWebCorePlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PlatformGTK.cmake (212735 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PlatformGTK.cmake        2017-02-21 20:00:52 UTC (rev 212735)
+++ trunk/Source/WebCore/PlatformGTK.cmake        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -383,6 +383,7 @@
</span><span class="cx"> crypto/WebKitSubtleCrypto.cpp
</span><span class="cx">
</span><span class="cx"> crypto/algorithms/CryptoAlgorithmAES_CBC.cpp
</span><ins>+ crypto/algorithms/CryptoAlgorithmAES_CFB.cpp
</ins><span class="cx"> crypto/algorithms/CryptoAlgorithmAES_KW.cpp
</span><span class="cx"> crypto/algorithms/CryptoAlgorithmHMAC.cpp
</span><span class="cx"> crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp
</span><span class="lines">@@ -397,6 +398,7 @@
</span><span class="cx"> crypto/gcrypt/CryptoAlgorithmHMACGCrypt.cpp
</span><span class="cx">
</span><span class="cx"> crypto/gnutls/CryptoAlgorithmAES_CBCGnuTLS.cpp
</span><ins>+ crypto/gnutls/CryptoAlgorithmAES_CFBGnuTLS.cpp
</ins><span class="cx"> crypto/gnutls/CryptoAlgorithmAES_KWGnuTLS.cpp
</span><span class="cx"> crypto/gnutls/CryptoAlgorithmRSAES_PKCS1_v1_5GnuTLS.cpp
</span><span class="cx"> crypto/gnutls/CryptoAlgorithmRSASSA_PKCS1_v1_5GnuTLS.cpp
</span></span></pre></div>
<a id="trunkSourceWebCorePlatformMaccmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/PlatformMac.cmake (212735 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/PlatformMac.cmake        2017-02-21 20:00:52 UTC (rev 212735)
+++ trunk/Source/WebCore/PlatformMac.cmake        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -179,6 +179,7 @@
</span><span class="cx"> crypto/WebKitSubtleCrypto.cpp
</span><span class="cx">
</span><span class="cx"> crypto/algorithms/CryptoAlgorithmAES_CBC.cpp
</span><ins>+ crypto/algorithms/CryptoAlgorithmAES_CFB.cpp
</ins><span class="cx"> crypto/algorithms/CryptoAlgorithmAES_KW.cpp
</span><span class="cx"> crypto/algorithms/CryptoAlgorithmHMAC.cpp
</span><span class="cx"> crypto/algorithms/CryptoAlgorithmRSAES_PKCS1_v1_5.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (212735 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2017-02-21 20:00:52 UTC (rev 212735)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -2326,6 +2326,10 @@
</span><span class="cx">                 5597F8271D91C3130066BC21 /* ImageFrameCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 5597F8251D91C3130066BC21 /* ImageFrameCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 55A336F71D8209F40022C4C7 /* NativeImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 55A336F61D8209F40022C4C7 /* NativeImage.h */; };
</span><span class="cx">                 55A336F91D821E3C0022C4C7 /* ImageBackingStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 55A336F81D821E3C0022C4C7 /* ImageBackingStore.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                570440531E5278B200356601 /* CryptoAlgorithmAES_CFB.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5712526A1E52527C008FF369 /* CryptoAlgorithmAES_CFB.cpp */; };
+                570440581E53851600356601 /* CryptoAlgorithmAES_CFBMac.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 570440571E53851600356601 /* CryptoAlgorithmAES_CFBMac.cpp */; };
+                5704405A1E53936200356601 /* JSAesCbcCfbParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 570440591E53936200356601 /* JSAesCbcCfbParams.h */; };
+                5704405C1E53937900356601 /* JSAesCbcCfbParams.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5704405B1E53937900356601 /* JSAesCbcCfbParams.cpp */; };
</ins><span class="cx">                 5706A6961DDE5C9500A03B14 /* CryptoAlgorithmRsaOaepParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 5706A6951DDE5C9500A03B14 /* CryptoAlgorithmRsaOaepParams.h */; };
</span><span class="cx">                 5706A6981DDE5E4600A03B14 /* JSRsaOaepParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 5706A6971DDE5E4600A03B14 /* JSRsaOaepParams.h */; };
</span><span class="cx">                 5706A69A1DDE5E8500A03B14 /* JSRsaOaepParams.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5706A6991DDE5E8500A03B14 /* JSRsaOaepParams.cpp */; };
</span><span class="lines">@@ -2334,11 +2338,10 @@
</span><span class="cx">                 5709E8CF1D413D9A003244AC /* WebKitSubtleCrypto.h in Headers */ = {isa = PBXBuildFile; fileRef = 5709E8CB1D413CE3003244AC /* WebKitSubtleCrypto.h */; };
</span><span class="cx">                 570A99DA1D417408004EC630 /* JSWebKitSubtleCrypto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1FF8F62180745D800132674 /* JSWebKitSubtleCrypto.cpp */; };
</span><span class="cx">                 570A99DB1D41A2F3004EC630 /* JSWebKitSubtleCrypto.h in Headers */ = {isa = PBXBuildFile; fileRef = E1FF8F63180745D800132674 /* JSWebKitSubtleCrypto.h */; };
</span><ins>+                571252691E524EB1008FF369 /* CryptoAlgorithmAES_CFB.h in Headers */ = {isa = PBXBuildFile; fileRef = 571252681E524EB1008FF369 /* CryptoAlgorithmAES_CFB.h */; };
</ins><span class="cx">                 571F21891DA57C54005C9EFD /* JSSubtleCrypto.h in Headers */ = {isa = PBXBuildFile; fileRef = 571F21881DA57C54005C9EFD /* JSSubtleCrypto.h */; };
</span><span class="cx">                 571F218B1DA57C7B005C9EFD /* JSSubtleCrypto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 571F218A1DA57C7A005C9EFD /* JSSubtleCrypto.cpp */; };
</span><del>-                572093D31DDCEB9A00310AB0 /* CryptoAlgorithmAesCbcParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 572093D21DDCEB9A00310AB0 /* CryptoAlgorithmAesCbcParams.h */; };
-                572093D51DDCED8E00310AB0 /* JSAesCbcParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 572093D41DDCED8E00310AB0 /* JSAesCbcParams.h */; };
-                572093D71DDCEDA700310AB0 /* JSAesCbcParams.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 572093D61DDCEDA700310AB0 /* JSAesCbcParams.cpp */; };
</del><ins>+                572093D31DDCEB9A00310AB0 /* CryptoAlgorithmAesCbcCfbParams.h in Headers */ = {isa = PBXBuildFile; fileRef = 572093D21DDCEB9A00310AB0 /* CryptoAlgorithmAesCbcCfbParams.h */; };
</ins><span class="cx">                 572A7F211C6E5719009C6149 /* SimulatedClick.h in Headers */ = {isa = PBXBuildFile; fileRef = 572A7F201C6E5719009C6149 /* SimulatedClick.h */; };
</span><span class="cx">                 572A7F231C6E5A66009C6149 /* SimulatedClick.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 572A7F221C6E5A66009C6149 /* SimulatedClick.cpp */; };
</span><span class="cx">                 573489391DAC6B6E00DC0667 /* CryptoAlgorithmParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 573489381DAC6B6D00DC0667 /* CryptoAlgorithmParameters.h */; };
</span><span class="lines">@@ -9684,6 +9687,9 @@
</span><span class="cx">                 55A336F61D8209F40022C4C7 /* NativeImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeImage.h; sourceTree = "<group>"; };
</span><span class="cx">                 55A336F81D821E3C0022C4C7 /* ImageBackingStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageBackingStore.h; sourceTree = "<group>"; };
</span><span class="cx">                 55D408F71A7C631800C78450 /* SVGImageClients.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGImageClients.h; sourceTree = "<group>"; };
</span><ins>+                570440571E53851600356601 /* CryptoAlgorithmAES_CFBMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoAlgorithmAES_CFBMac.cpp; sourceTree = "<group>"; };
+                570440591E53936200356601 /* JSAesCbcCfbParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAesCbcCfbParams.h; sourceTree = "<group>"; };
+                5704405B1E53937900356601 /* JSAesCbcCfbParams.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAesCbcCfbParams.cpp; sourceTree = "<group>"; };
</ins><span class="cx">                 5706A6941DDE5BF800A03B14 /* RsaOaepParams.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = RsaOaepParams.idl; sourceTree = "<group>"; };
</span><span class="cx">                 5706A6951DDE5C9500A03B14 /* CryptoAlgorithmRsaOaepParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmRsaOaepParams.h; sourceTree = "<group>"; };
</span><span class="cx">                 5706A6971DDE5E4600A03B14 /* JSRsaOaepParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSRsaOaepParams.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -9691,12 +9697,12 @@
</span><span class="cx">                 5709E8CA1D413CE3003244AC /* WebKitSubtleCrypto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitSubtleCrypto.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 5709E8CB1D413CE3003244AC /* WebKitSubtleCrypto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitSubtleCrypto.h; sourceTree = "<group>"; };
</span><span class="cx">                 5709E8CC1D413CE3003244AC /* WebKitSubtleCrypto.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebKitSubtleCrypto.idl; sourceTree = "<group>"; };
</span><ins>+                571252681E524EB1008FF369 /* CryptoAlgorithmAES_CFB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmAES_CFB.h; sourceTree = "<group>"; };
+                5712526A1E52527C008FF369 /* CryptoAlgorithmAES_CFB.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoAlgorithmAES_CFB.cpp; sourceTree = "<group>"; };
</ins><span class="cx">                 571F21881DA57C54005C9EFD /* JSSubtleCrypto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSubtleCrypto.h; sourceTree = "<group>"; };
</span><span class="cx">                 571F218A1DA57C7A005C9EFD /* JSSubtleCrypto.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSubtleCrypto.cpp; sourceTree = "<group>"; };
</span><del>-                572093D11DDCEA4B00310AB0 /* AesCbcParams.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = AesCbcParams.idl; sourceTree = "<group>"; };
-                572093D21DDCEB9A00310AB0 /* CryptoAlgorithmAesCbcParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmAesCbcParams.h; sourceTree = "<group>"; };
-                572093D41DDCED8E00310AB0 /* JSAesCbcParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSAesCbcParams.h; sourceTree = "<group>"; };
-                572093D61DDCEDA700310AB0 /* JSAesCbcParams.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSAesCbcParams.cpp; sourceTree = "<group>"; };
</del><ins>+                572093D11DDCEA4B00310AB0 /* AesCbcCfbParams.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = AesCbcCfbParams.idl; sourceTree = "<group>"; };
+                572093D21DDCEB9A00310AB0 /* CryptoAlgorithmAesCbcCfbParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmAesCbcCfbParams.h; sourceTree = "<group>"; };
</ins><span class="cx">                 572A7F201C6E5719009C6149 /* SimulatedClick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimulatedClick.h; sourceTree = "<group>"; };
</span><span class="cx">                 572A7F221C6E5A66009C6149 /* SimulatedClick.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SimulatedClick.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 573489381DAC6B6D00DC0667 /* CryptoAlgorithmParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmParameters.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -23380,6 +23386,7 @@
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="cx">                                 E125F843182425C900D84CD9 /* CryptoAlgorithmAES_CBCMac.cpp */,
</span><ins>+                                570440571E53851600356601 /* CryptoAlgorithmAES_CFBMac.cpp */,
</ins><span class="cx">                                 E1FE137C184D270200892F13 /* CryptoAlgorithmAES_KWMac.cpp */,
</span><span class="cx">                                 E125F8371822F1EB00D84CD9 /* CryptoAlgorithmHMACMac.cpp */,
</span><span class="cx">                                 E1BB84AC1822CA7400525043 /* CryptoAlgorithmRegistryMac.cpp */,
</span><span class="lines">@@ -23398,6 +23405,8 @@
</span><span class="cx">                         children = (
</span><span class="cx">                                 E125F83F1824253A00D84CD9 /* CryptoAlgorithmAES_CBC.cpp */,
</span><span class="cx">                                 E125F8401824253A00D84CD9 /* CryptoAlgorithmAES_CBC.h */,
</span><ins>+                                5712526A1E52527C008FF369 /* CryptoAlgorithmAES_CFB.cpp */,
+                                571252681E524EB1008FF369 /* CryptoAlgorithmAES_CFB.h */,
</ins><span class="cx">                                 E1FE1378184D21BB00892F13 /* CryptoAlgorithmAES_KW.cpp */,
</span><span class="cx">                                 E1FE1379184D21BB00892F13 /* CryptoAlgorithmAES_KW.h */,
</span><span class="cx">                                 E125F82F1822F11B00D84CD9 /* CryptoAlgorithmHMAC.cpp */,
</span><span class="lines">@@ -23444,9 +23453,9 @@
</span><span class="cx">                 E1C657141816015F00256CDD /* parameters */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><del>-                                572093D11DDCEA4B00310AB0 /* AesCbcParams.idl */,
</del><ins>+                                572093D11DDCEA4B00310AB0 /* AesCbcCfbParams.idl */,
</ins><span class="cx">                                 577483101DADC49900716EF9 /* AesKeyGenParams.idl */,
</span><del>-                                572093D21DDCEB9A00310AB0 /* CryptoAlgorithmAesCbcParams.h */,
</del><ins>+                                572093D21DDCEB9A00310AB0 /* CryptoAlgorithmAesCbcCfbParams.h */,
</ins><span class="cx">                                 E125F8391824104800D84CD9 /* CryptoAlgorithmAesCbcParamsDeprecated.h */,
</span><span class="cx">                                 577483111DADC55D00716EF9 /* CryptoAlgorithmAesKeyGenParams.h */,
</span><span class="cx">                                 E19AC3F61824E5D100349426 /* CryptoAlgorithmAesKeyGenParamsDeprecated.h */,
</span><span class="lines">@@ -23621,8 +23630,8 @@
</span><span class="cx">                 E1FF8F61180745C600132674 /* Crypto */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><del>-                                572093D61DDCEDA700310AB0 /* JSAesCbcParams.cpp */,
-                                572093D41DDCED8E00310AB0 /* JSAesCbcParams.h */,
</del><ins>+                                5704405B1E53937900356601 /* JSAesCbcCfbParams.cpp */,
+                                570440591E53936200356601 /* JSAesCbcCfbParams.h */,
</ins><span class="cx">                                 577483151DAEC32200716EF9 /* JSAesKeyGenParams.cpp */,
</span><span class="cx">                                 577483131DAEC2EA00716EF9 /* JSAesKeyGenParams.h */,
</span><span class="cx">                                 5739E1301DAC7FD100E14383 /* JSCryptoAlgorithmParameters.cpp */,
</span><span class="lines">@@ -25425,6 +25434,7 @@
</span><span class="cx">                                 7C77C3D11DEE472400A50BFA /* BlobPropertyBag.h in Headers */,
</span><span class="cx">                                 2EDEF1F5121B0EFC00726DB2 /* BlobRegistry.h in Headers */,
</span><span class="cx">                                 2EDEF1F7121B0EFC00726DB2 /* BlobRegistryImpl.h in Headers */,
</span><ins>+                                5704405A1E53936200356601 /* JSAesCbcCfbParams.h in Headers */,
</ins><span class="cx">                                 2EB4BCD3121F03E300EC4885 /* BlobResourceHandle.h in Headers */,
</span><span class="cx">                                 976D6C7F122B8A3D001FD1F7 /* BlobURL.h in Headers */,
</span><span class="cx">                                 BC5EB5E10E81BE8700B25965 /* BorderData.h in Headers */,
</span><span class="lines">@@ -25617,7 +25627,7 @@
</span><span class="cx">                                 E172AF6E180F24C600FBADB9 /* CryptoAlgorithm.h in Headers */,
</span><span class="cx">                                 E125F8421824253A00D84CD9 /* CryptoAlgorithmAES_CBC.h in Headers */,
</span><span class="cx">                                 E1FE137B184D21BB00892F13 /* CryptoAlgorithmAES_KW.h in Headers */,
</span><del>-                                572093D31DDCEB9A00310AB0 /* CryptoAlgorithmAesCbcParams.h in Headers */,
</del><ins>+                                572093D31DDCEB9A00310AB0 /* CryptoAlgorithmAesCbcCfbParams.h in Headers */,
</ins><span class="cx">                                 E125F83A1824104800D84CD9 /* CryptoAlgorithmAesCbcParamsDeprecated.h in Headers */,
</span><span class="cx">                                 577483121DADC55D00716EF9 /* CryptoAlgorithmAesKeyGenParams.h in Headers */,
</span><span class="cx">                                 E19AC3F71824E5D100349426 /* CryptoAlgorithmAesKeyGenParamsDeprecated.h in Headers */,
</span><span class="lines">@@ -26468,7 +26478,6 @@
</span><span class="cx">                                 44EFF6431A6FF92700D45EEC /* IOTypesSPI.h in Headers */,
</span><span class="cx">                                 07AC47021952102100EE9723 /* ISOVTTCue.h in Headers */,
</span><span class="cx">                                 418F88050FF957AF0080F045 /* JSAbstractWorker.h in Headers */,
</span><del>-                                572093D51DDCED8E00310AB0 /* JSAesCbcParams.h in Headers */,
</del><span class="cx">                                 577483141DAEC2EB00716EF9 /* JSAesKeyGenParams.h in Headers */,
</span><span class="cx">                                 FDA15ECA12B03F50003A583A /* JSAnalyserNode.h in Headers */,
</span><span class="cx">                                 12A253E31C8FFF6600C22295 /* JSAnimatable.h in Headers */,
</span><span class="lines">@@ -27846,6 +27855,7 @@
</span><span class="cx">                                 083DAEA90F01A7FB00342754 /* RenderTextControlSingleLine.h in Headers */,
</span><span class="cx">                                 BCEA488E097D93020094C9E4 /* RenderTextFragment.h in Headers */,
</span><span class="cx">                                 E4C91A16180999F100A17F6D /* RenderTextLineBoxes.h in Headers */,
</span><ins>+                                571252691E524EB1008FF369 /* CryptoAlgorithmAES_CFB.h in Headers */,
</ins><span class="cx">                                 BCEA488A097D93020094C9E4 /* RenderTheme.h in Headers */,
</span><span class="cx">                                 1A299FE81D7F5FA600A60093 /* RenderThemeCocoa.h in Headers */,
</span><span class="cx">                                 FED13D520CEA949700D89466 /* RenderThemeIOS.h in Headers */,
</span><span class="lines">@@ -29228,6 +29238,7 @@
</span><span class="cx">                         isa = PBXSourcesBuildPhase;
</span><span class="cx">                         buildActionMask = 2147483647;
</span><span class="cx">                         files = (
</span><ins>+                                570440531E5278B200356601 /* CryptoAlgorithmAES_CFB.cpp in Sources */,
</ins><span class="cx">                                 41E1B1D00FF5986900576B3B /* AbstractWorker.cpp in Sources */,
</span><span class="cx">                                 37F57AB91A50726900876F98 /* AccessibilityARIAGrid.cpp in Sources */,
</span><span class="cx">                                 37F57ABA1A50726F00876F98 /* AccessibilityARIAGridCell.cpp in Sources */,
</span><span class="lines">@@ -29942,6 +29953,7 @@
</span><span class="cx">                                 D000EBA211BDAFD400C47726 /* FrameLoaderStateMachine.cpp in Sources */,
</span><span class="cx">                                 86BA766E166427A8005BE5D1 /* FrameLoadRequest.cpp in Sources */,
</span><span class="cx">                                 93309E0D099E64920056E581 /* FrameSelection.cpp in Sources */,
</span><ins>+                                570440581E53851600356601 /* CryptoAlgorithmAES_CFBMac.cpp in Sources */,
</ins><span class="cx">                                 4A8C96EB0BE69032004EEFF0 /* FrameSelectionMac.mm in Sources */,
</span><span class="cx">                                 C4CD629A18383766007EBAF1 /* FrameSnapshotting.cpp in Sources */,
</span><span class="cx">                                 65A21484097A3F5300B9050A /* FrameTree.cpp in Sources */,
</span><span class="lines">@@ -30264,7 +30276,6 @@
</span><span class="cx">                                 AD9FF6E11908391D003B61E0 /* IOSurfacePoolCocoa.mm in Sources */,
</span><span class="cx">                                 07AC47011952102100EE9723 /* ISOVTTCue.cpp in Sources */,
</span><span class="cx">                                 418F88040FF957AE0080F045 /* JSAbstractWorker.cpp in Sources */,
</span><del>-                                572093D71DDCEDA700310AB0 /* JSAesCbcParams.cpp in Sources */,
</del><span class="cx">                                 577483161DAEC32300716EF9 /* JSAesKeyGenParams.cpp in Sources */,
</span><span class="cx">                                 FDA15EC912B03F50003A583A /* JSAnalyserNode.cpp in Sources */,
</span><span class="cx">                                 31A795C61888BADC00382F90 /* JSANGLEInstancedArrays.cpp in Sources */,
</span><span class="lines">@@ -31338,6 +31349,7 @@
</span><span class="cx">                                 1A8A646C1D19FF8700D0E00F /* PaymentCocoa.mm in Sources */,
</span><span class="cx">                                 1A8A646D1D19FF8700D0E00F /* PaymentContactCocoa.mm in Sources */,
</span><span class="cx">                                 1A58E86D1D19E42D00C0EA73 /* PaymentCoordinator.cpp in Sources */,
</span><ins>+                                5704405C1E53937900356601 /* JSAesCbcCfbParams.cpp in Sources */,
</ins><span class="cx">                                 1ADA4A1C1D22F2C0005A9A15 /* PaymentMerchantSessionCocoa.mm in Sources */,
</span><span class="cx">                                 1A8A646E1D19FF8700D0E00F /* PaymentMethodCocoa.mm in Sources */,
</span><span class="cx">                                 1A58E8671D19D80E00C0EA73 /* PaymentRequest.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSSubtleCryptoCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp (212735 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp        2017-02-21 20:00:52 UTC (rev 212735)
+++ trunk/Source/WebCore/bindings/js/JSSubtleCryptoCustom.cpp        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -30,7 +30,7 @@
</span><span class="cx">
</span><span class="cx"> #include "CryptoAlgorithm.h"
</span><span class="cx"> #include "CryptoAlgorithmRegistry.h"
</span><del>-#include "JSAesCbcParams.h"
</del><ins>+#include "JSAesCbcCfbParams.h"
</ins><span class="cx"> #include "JSAesKeyGenParams.h"
</span><span class="cx"> #include "JSCryptoAlgorithmParameters.h"
</span><span class="cx"> #include "JSCryptoKey.h"
</span><span class="lines">@@ -113,10 +113,11 @@
</span><span class="cx"> result = std::make_unique<CryptoAlgorithmRsaOaepParams>(params);
</span><span class="cx"> break;
</span><span class="cx"> }
</span><del>- case CryptoAlgorithmIdentifier::AES_CBC: {
- auto params = convertDictionary<CryptoAlgorithmAesCbcParams>(state, value);
</del><ins>+ case CryptoAlgorithmIdentifier::AES_CBC:
+ case CryptoAlgorithmIdentifier::AES_CFB: {
+ auto params = convertDictionary<CryptoAlgorithmAesCbcCfbParams>(state, value);
</ins><span class="cx"> RETURN_IF_EXCEPTION(scope, nullptr);
</span><del>- result = std::make_unique<CryptoAlgorithmAesCbcParams>(params);
</del><ins>+ result = std::make_unique<CryptoAlgorithmAesCbcCfbParams>(params);
</ins><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx"> default:
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoCryptoAlgorithmh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/CryptoAlgorithm.h (212735 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/CryptoAlgorithm.h        2017-02-21 20:00:52 UTC (rev 212735)
+++ trunk/Source/WebCore/crypto/CryptoAlgorithm.h        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #include "JsonWebKey.h"
</span><span class="cx"> #include "SubtleCrypto.h"
</span><span class="cx"> #include <wtf/Function.h>
</span><ins>+#include <wtf/Variant.h>
</ins><span class="cx"> #include <wtf/Vector.h>
</span><span class="cx"> #include <wtf/WorkQueue.h>
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoCryptoAlgorithmParametersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/CryptoAlgorithmParameters.h (212735 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/CryptoAlgorithmParameters.h        2017-02-21 20:00:52 UTC (rev 212735)
+++ trunk/Source/WebCore/crypto/CryptoAlgorithmParameters.h        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -37,7 +37,7 @@
</span><span class="cx"> public:
</span><span class="cx"> enum class Class {
</span><span class="cx"> None,
</span><del>- AesCbcParams,
</del><ins>+ AesCbcCfbParams,
</ins><span class="cx"> AesKeyGenParams,
</span><span class="cx"> HmacKeyParams,
</span><span class="cx"> RsaHashedKeyGenParams,
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmAES_CBCcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.cpp (212735 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.cpp        2017-02-21 20:00:52 UTC (rev 212735)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.cpp        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(SUBTLE_CRYPTO)
</span><span class="cx">
</span><del>-#include "CryptoAlgorithmAesCbcParams.h"
</del><ins>+#include "CryptoAlgorithmAesCbcCfbParams.h"
</ins><span class="cx"> #include "CryptoAlgorithmAesCbcParamsDeprecated.h"
</span><span class="cx"> #include "CryptoAlgorithmAesKeyGenParams.h"
</span><span class="cx"> #include "CryptoAlgorithmAesKeyGenParamsDeprecated.h"
</span><span class="lines">@@ -69,7 +69,7 @@
</span><span class="cx"> void CryptoAlgorithmAES_CBC::encrypt(std::unique_ptr<CryptoAlgorithmParameters>&& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& plainText, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(parameters);
</span><del>- auto& aesParameters = downcast<CryptoAlgorithmAesCbcParams>(*parameters);
</del><ins>+ auto& aesParameters = downcast<CryptoAlgorithmAesCbcCfbParams>(*parameters);
</ins><span class="cx"> if (aesParameters.ivVector().size() != IVSIZE) {
</span><span class="cx"> exceptionCallback(OperationError);
</span><span class="cx"> return;
</span><span class="lines">@@ -80,7 +80,7 @@
</span><span class="cx"> void CryptoAlgorithmAES_CBC::decrypt(std::unique_ptr<CryptoAlgorithmParameters>&& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& cipherText, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(parameters);
</span><del>- auto& aesParameters = downcast<CryptoAlgorithmAesCbcParams>(*parameters);
</del><ins>+ auto& aesParameters = downcast<CryptoAlgorithmAesCbcCfbParams>(*parameters);
</ins><span class="cx"> if (aesParameters.ivVector().size() != IVSIZE) {
</span><span class="cx"> exceptionCallback(OperationError);
</span><span class="cx"> return;
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmAES_CFBcppfromrev212735trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmAES_CBCcpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CFB.cpp (from rev 212735, trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CBC.cpp) (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CFB.cpp         (rev 0)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CFB.cpp        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,180 @@
</span><ins>+/*
+ * Copyright (C) 2017 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 "config.h"
+#include "CryptoAlgorithmAES_CFB.h"
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+#include "CryptoAlgorithmAesCbcCfbParams.h"
+#include "CryptoAlgorithmAesKeyGenParams.h"
+#include "CryptoKeyAES.h"
+#include "ExceptionCode.h"
+
+namespace WebCore {
+
+static const char* const ALG128 = "A128CFB8";
+static const char* const ALG192 = "A192CFB8";
+static const char* const ALG256 = "A256CFB8";
+static const size_t IVSIZE = 16;
+
+static inline bool usagesAreInvalidForCryptoAlgorithmAES_CFB(CryptoKeyUsageBitmap usages)
+{
+ return usages & (CryptoKeyUsageSign | CryptoKeyUsageVerify | CryptoKeyUsageDeriveKey | CryptoKeyUsageDeriveBits);
+}
+
+Ref<CryptoAlgorithm> CryptoAlgorithmAES_CFB::create()
+{
+ return adoptRef(*new CryptoAlgorithmAES_CFB);
+}
+
+CryptoAlgorithmIdentifier CryptoAlgorithmAES_CFB::identifier() const
+{
+ return s_identifier;
+}
+
+void CryptoAlgorithmAES_CFB::encrypt(std::unique_ptr<CryptoAlgorithmParameters>&& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& plainText, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+{
+ ASSERT(parameters);
+ auto& aesParameters = downcast<CryptoAlgorithmAesCbcCfbParams>(*parameters);
+ if (aesParameters.ivVector().size() != IVSIZE) {
+ exceptionCallback(OperationError);
+ return;
+ }
+ platformEncrypt(WTFMove(parameters), WTFMove(key), WTFMove(plainText), WTFMove(callback), WTFMove(exceptionCallback), context, workQueue);
+}
+
+void CryptoAlgorithmAES_CFB::decrypt(std::unique_ptr<CryptoAlgorithmParameters>&& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& cipherText, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+{
+ ASSERT(parameters);
+ auto& aesParameters = downcast<CryptoAlgorithmAesCbcCfbParams>(*parameters);
+ if (aesParameters.ivVector().size() != IVSIZE) {
+ exceptionCallback(OperationError);
+ return;
+ }
+ platformDecrypt(WTFMove(parameters), WTFMove(key), WTFMove(cipherText), WTFMove(callback), WTFMove(exceptionCallback), context, workQueue);
+}
+
+void CryptoAlgorithmAES_CFB::generateKey(const CryptoAlgorithmParameters& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyOrKeyPairCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext&)
+{
+ const auto& aesParameters = downcast<CryptoAlgorithmAesKeyGenParams>(parameters);
+
+ if (usagesAreInvalidForCryptoAlgorithmAES_CFB(usages)) {
+ exceptionCallback(SYNTAX_ERR);
+ return;
+ }
+
+ auto result = CryptoKeyAES::generate(CryptoAlgorithmIdentifier::AES_CFB, aesParameters.length, extractable, usages);
+ if (!result) {
+ exceptionCallback(OperationError);
+ return;
+ }
+
+ callback(WTFMove(result));
+}
+
+void CryptoAlgorithmAES_CFB::importKey(SubtleCrypto::KeyFormat format, KeyData&& data, const std::unique_ptr<CryptoAlgorithmParameters>&& parameters, bool extractable, CryptoKeyUsageBitmap usages, KeyCallback&& callback, ExceptionCallback&& exceptionCallback)
+{
+ ASSERT(parameters);
+ if (usagesAreInvalidForCryptoAlgorithmAES_CFB(usages)) {
+ exceptionCallback(SYNTAX_ERR);
+ return;
+ }
+
+ RefPtr<CryptoKeyAES> result;
+ switch (format) {
+ case SubtleCrypto::KeyFormat::Raw:
+ result = CryptoKeyAES::importRaw(parameters->identifier, WTFMove(WTF::get<Vector<uint8_t>>(data)), extractable, usages);
+ break;
+ case SubtleCrypto::KeyFormat::Jwk: {
+ auto checkAlgCallback = [](size_t length, const String& alg) -> bool {
+ switch (length) {
+ case CryptoKeyAES::s_length128:
+ return alg.isNull() || alg == ALG128;
+ case CryptoKeyAES::s_length192:
+ return alg.isNull() || alg == ALG192;
+ case CryptoKeyAES::s_length256:
+ return alg.isNull() || alg == ALG256;
+ }
+ return false;
+ };
+ result = CryptoKeyAES::importJwk(parameters->identifier, WTFMove(WTF::get<JsonWebKey>(data)), extractable, usages, WTFMove(checkAlgCallback));
+ break;
+ }
+ default:
+ exceptionCallback(NOT_SUPPORTED_ERR);
+ return;
+ }
+ if (!result) {
+ exceptionCallback(DataError);
+ return;
+ }
+
+ callback(*result);
+}
+
+void CryptoAlgorithmAES_CFB::exportKey(SubtleCrypto::KeyFormat format, Ref<CryptoKey>&& key, KeyDataCallback&& callback, ExceptionCallback&& exceptionCallback)
+{
+ const auto& aesKey = downcast<CryptoKeyAES>(key.get());
+
+ if (aesKey.key().isEmpty()) {
+ exceptionCallback(OperationError);
+ return;
+ }
+
+ KeyData result;
+ switch (format) {
+ case SubtleCrypto::KeyFormat::Raw:
+ result = Vector<uint8_t>(aesKey.key());
+ break;
+ case SubtleCrypto::KeyFormat::Jwk: {
+ JsonWebKey jwk = aesKey.exportJwk();
+ switch (aesKey.key().size() * 8) {
+ case CryptoKeyAES::s_length128:
+ jwk.alg = String(ALG128);
+ break;
+ case CryptoKeyAES::s_length192:
+ jwk.alg = String(ALG192);
+ break;
+ case CryptoKeyAES::s_length256:
+ jwk.alg = String(ALG256);
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+ result = WTFMove(jwk);
+ break;
+ }
+ default:
+ exceptionCallback(NOT_SUPPORTED_ERR);
+ return;
+ }
+
+ callback(format, WTFMove(result));
+}
+
+}
+
+#endif // ENABLE(SUBTLE_CRYPTO)
</ins></span></pre></div>
<a id="trunkSourceWebCorecryptoalgorithmsCryptoAlgorithmAES_CFBh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CFB.h (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CFB.h         (rev 0)
+++ trunk/Source/WebCore/crypto/algorithms/CryptoAlgorithmAES_CFB.h        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,58 @@
</span><ins>+/*
+ * Copyright (C) 2017 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.
+ */
+
+#pragma once
+
+#include "CryptoAlgorithm.h"
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+namespace WebCore {
+
+class CryptoKeyAES;
+
+class CryptoAlgorithmAES_CFB final : public CryptoAlgorithm {
+public:
+ static constexpr const char* s_name = "AES-CFB-8";
+ static constexpr CryptoAlgorithmIdentifier s_identifier = CryptoAlgorithmIdentifier::AES_CFB;
+ static Ref<CryptoAlgorithm> create();
+
+private:
+ CryptoAlgorithmAES_CFB() = default;
+ CryptoAlgorithmIdentifier identifier() const final;
+
+ void encrypt(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
+ void decrypt(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&) final;
+ void generateKey(const CryptoAlgorithmParameters&, bool extractable, CryptoKeyUsageBitmap, KeyOrKeyPairCallback&&, ExceptionCallback&&, ScriptExecutionContext&) final;
+ void importKey(SubtleCrypto::KeyFormat, KeyData&&, const std::unique_ptr<CryptoAlgorithmParameters>&&, bool extractable, CryptoKeyUsageBitmap, KeyCallback&&, ExceptionCallback&&) final;
+ void exportKey(SubtleCrypto::KeyFormat, Ref<CryptoKey>&&, KeyDataCallback&&, ExceptionCallback&&) final;
+
+ void platformEncrypt(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&);
+ void platformDecrypt(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&);
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SUBTLE_CRYPTO)
</ins></span></pre></div>
<a id="trunkSourceWebCorecryptognutlsCryptoAlgorithmAES_CFBGnuTLScppfromrev212735trunkSourceWebCorecryptoparametersCryptoAlgorithmAesCbcParamsh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_CFBGnuTLS.cpp (from rev 212735, trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmAesCbcParams.h) (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_CFBGnuTLS.cpp         (rev 0)
+++ trunk/Source/WebCore/crypto/gnutls/CryptoAlgorithmAES_CFBGnuTLS.cpp        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,48 @@
</span><ins>+/*
+ * Copyright (C) 2017 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 "config.h"
+#include "CryptoAlgorithmAES_CFB.h"
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+#include "ExceptionCode.h"
+#include "NotImplemented.h"
+
+namespace WebCore {
+
+void CryptoAlgorithmAES_CFB::platformEncrypt(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&)
+{
+ notImplemented();
+}
+
+void CryptoAlgorithmAES_CFB::platformDecrypt(std::unique_ptr<CryptoAlgorithmParameters>&&, Ref<CryptoKey>&&, Vector<uint8_t>&&, VectorCallback&&, ExceptionCallback&&, ScriptExecutionContext&, WorkQueue&)
+{
+ notImplemented();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SUBTLE_CRYPTO)
</ins></span></pre></div>
<a id="trunkSourceWebCorecryptomacCryptoAlgorithmAES_CBCMaccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/mac/CryptoAlgorithmAES_CBCMac.cpp (212735 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/mac/CryptoAlgorithmAES_CBCMac.cpp        2017-02-21 20:00:52 UTC (rev 212735)
+++ trunk/Source/WebCore/crypto/mac/CryptoAlgorithmAES_CBCMac.cpp        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx">
</span><span class="cx"> #if ENABLE(SUBTLE_CRYPTO)
</span><span class="cx">
</span><del>-#include "CryptoAlgorithmAesCbcParams.h"
</del><ins>+#include "CryptoAlgorithmAesCbcCfbParams.h"
</ins><span class="cx"> #include "CryptoAlgorithmAesCbcParamsDeprecated.h"
</span><span class="cx"> #include "CryptoKeyAES.h"
</span><span class="cx"> #include "ExceptionCode.h"
</span><span class="lines">@@ -41,14 +41,8 @@
</span><span class="cx"> // https://bugs.webkit.org/show_bug.cgi?id=164939
</span><span class="cx"> static ExceptionOr<Vector<uint8_t>> transformAES_CBC(CCOperation operation, const uint8_t* iv, const Vector<uint8_t>& key, const uint8_t* data, size_t dataLength)
</span><span class="cx"> {
</span><del>- size_t keyLengthInBytes = key.size();
</del><span class="cx"> CCCryptorRef cryptor;
</span><del>-#if PLATFORM(COCOA)
- CCAlgorithm aesAlgorithm = kCCAlgorithmAES;
-#else
- CCAlgorithm aesAlgorithm = kCCAlgorithmAES128;
-#endif
- CCCryptorStatus status = CCCryptorCreate(operation, aesAlgorithm, kCCOptionPKCS7Padding, key.data(), keyLengthInBytes, iv, &cryptor);
</del><ins>+ CCCryptorStatus status = CCCryptorCreate(operation, kCCAlgorithmAES, kCCOptionPKCS7Padding, key.data(), key.size(), iv, &cryptor);
</ins><span class="cx"> if (status)
</span><span class="cx"> return Exception { OperationError };
</span><span class="cx">
</span><span class="lines">@@ -77,7 +71,7 @@
</span><span class="cx"> {
</span><span class="cx"> context.ref();
</span><span class="cx"> workQueue.dispatch([parameters = WTFMove(parameters), key = WTFMove(key), plainText = WTFMove(plainText), callback = WTFMove(callback), exceptionCallback = WTFMove(exceptionCallback), &context]() mutable {
</span><del>- auto& aesParameters = downcast<CryptoAlgorithmAesCbcParams>(*parameters);
</del><ins>+ auto& aesParameters = downcast<CryptoAlgorithmAesCbcCfbParams>(*parameters);
</ins><span class="cx"> auto& aesKey = downcast<CryptoKeyAES>(key.get());
</span><span class="cx"> ASSERT(aesParameters.ivVector().size() == kCCBlockSizeAES128);
</span><span class="cx"> auto result = transformAES_CBC(kCCEncrypt, aesParameters.ivVector().data(), aesKey.key(), plainText.data(), plainText.size());
</span><span class="lines">@@ -101,7 +95,7 @@
</span><span class="cx"> {
</span><span class="cx"> context.ref();
</span><span class="cx"> workQueue.dispatch([parameters = WTFMove(parameters), key = WTFMove(key), cipherText = WTFMove(cipherText), callback = WTFMove(callback), exceptionCallback = WTFMove(exceptionCallback), &context]() mutable {
</span><del>- auto& aesParameters = downcast<CryptoAlgorithmAesCbcParams>(*parameters);
</del><ins>+ auto& aesParameters = downcast<CryptoAlgorithmAesCbcCfbParams>(*parameters);
</ins><span class="cx"> auto& aesKey = downcast<CryptoKeyAES>(key.get());
</span><span class="cx"> assert(aesParameters.ivVector().size() == kCCBlockSizeAES128);
</span><span class="cx"> auto result = transformAES_CBC(kCCDecrypt, aesParameters.ivVector().data(), aesKey.key(), cipherText.data(), cipherText.size());
</span></span></pre></div>
<a id="trunkSourceWebCorecryptomacCryptoAlgorithmAES_CFBMaccppfromrev212735trunkSourceWebCorecryptomacCryptoAlgorithmAES_CBCMaccpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/crypto/mac/CryptoAlgorithmAES_CFBMac.cpp (from rev 212735, trunk/Source/WebCore/crypto/mac/CryptoAlgorithmAES_CBCMac.cpp) (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/mac/CryptoAlgorithmAES_CFBMac.cpp         (rev 0)
+++ trunk/Source/WebCore/crypto/mac/CryptoAlgorithmAES_CFBMac.cpp        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,117 @@
</span><ins>+/*
+ * Copyright (C) 2017 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 "config.h"
+#include "CryptoAlgorithmAES_CFB.h"
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+#include "CryptoAlgorithmAesCbcCfbParams.h"
+#include "CryptoKeyAES.h"
+#include "ExceptionCode.h"
+#include "ScriptExecutionContext.h"
+#include <CommonCrypto/CommonCrypto.h>
+
+namespace WebCore {
+
+static ExceptionOr<Vector<uint8_t>> transformAES_CFB(CCOperation operation, const Vector<uint8_t>& iv, const Vector<uint8_t>& key, const Vector<uint8_t>& data)
+{
+ CCCryptorRef cryptor;
+ CCCryptorStatus status = CCCryptorCreateWithMode(operation, kCCModeCFB8, kCCAlgorithmAES, ccNoPadding, iv.data(), key.data(), key.size(), 0, 0, 0, 0, &cryptor);
+ if (status)
+ return Exception { OperationError };
+
+ Vector<uint8_t> result(CCCryptorGetOutputLength(cryptor, data.size(), true));
+
+ size_t bytesWritten;
+ status = CCCryptorUpdate(cryptor, data.data(), data.size(), result.data(), result.size(), &bytesWritten);
+ if (status)
+ return Exception { OperationError };
+
+ uint8_t* p = result.data() + bytesWritten;
+ status = CCCryptorFinal(cryptor, p, result.end() - p, &bytesWritten);
+ p += bytesWritten;
+ if (status)
+ return Exception { OperationError };
+
+ ASSERT(p <= result.end());
+ result.shrink(p - result.begin());
+
+ CCCryptorRelease(cryptor);
+
+ return WTFMove(result);
+}
+
+void CryptoAlgorithmAES_CFB::platformEncrypt(std::unique_ptr<CryptoAlgorithmParameters>&& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& plainText, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+{
+ context.ref();
+ workQueue.dispatch([parameters = WTFMove(parameters), key = WTFMove(key), plainText = WTFMove(plainText), callback = WTFMove(callback), exceptionCallback = WTFMove(exceptionCallback), &context]() mutable {
+ auto& aesParameters = downcast<CryptoAlgorithmAesCbcCfbParams>(*parameters);
+ auto& aesKey = downcast<CryptoKeyAES>(key.get());
+ ASSERT(aesParameters.ivVector().size() == kCCBlockSizeAES128);
+ auto result = transformAES_CFB(kCCEncrypt, aesParameters.ivVector(), aesKey.key(), plainText);
+ if (result.hasException()) {
+ // We should only dereference callbacks after being back to the Document/Worker threads.
+ context.postTask([exceptionCallback = WTFMove(exceptionCallback), ec = result.releaseException().code(), callback = WTFMove(callback)](ScriptExecutionContext& context) {
+ exceptionCallback(ec);
+ context.deref();
+ });
+ return;
+ }
+ // We should only dereference callbacks after being back to the Document/Worker threads.
+ context.postTask([callback = WTFMove(callback), result = result.releaseReturnValue(), exceptionCallback = WTFMove(exceptionCallback)](ScriptExecutionContext& context) {
+ callback(result);
+ context.deref();
+ });
+ });
+}
+
+void CryptoAlgorithmAES_CFB::platformDecrypt(std::unique_ptr<CryptoAlgorithmParameters>&& parameters, Ref<CryptoKey>&& key, Vector<uint8_t>&& cipherText, VectorCallback&& callback, ExceptionCallback&& exceptionCallback, ScriptExecutionContext& context, WorkQueue& workQueue)
+{
+ context.ref();
+ workQueue.dispatch([parameters = WTFMove(parameters), key = WTFMove(key), cipherText = WTFMove(cipherText), callback = WTFMove(callback), exceptionCallback = WTFMove(exceptionCallback), &context]() mutable {
+ auto& aesParameters = downcast<CryptoAlgorithmAesCbcCfbParams>(*parameters);
+ auto& aesKey = downcast<CryptoKeyAES>(key.get());
+ assert(aesParameters.ivVector().size() == kCCBlockSizeAES128);
+ auto result = transformAES_CFB(kCCDecrypt, aesParameters.ivVector(), aesKey.key(), cipherText);
+ if (result.hasException()) {
+ // We should only dereference callbacks after being back to the Document/Worker threads.
+ context.postTask([exceptionCallback = WTFMove(exceptionCallback), ec = result.releaseException().code(), callback = WTFMove(callback)](ScriptExecutionContext& context) {
+ exceptionCallback(ec);
+ context.deref();
+ });
+ return;
+ }
+ // We should only dereference callbacks after being back to the Document/Worker threads.
+ context.postTask([callback = WTFMove(callback), result = result.releaseReturnValue(), exceptionCallback = WTFMove(exceptionCallback)](ScriptExecutionContext& context) {
+ callback(result);
+ context.deref();
+ });
+ });
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SUBTLE_CRYPTO)
</ins></span></pre></div>
<a id="trunkSourceWebCorecryptomacCryptoAlgorithmRegistryMaccpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRegistryMac.cpp (212735 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRegistryMac.cpp        2017-02-21 20:00:52 UTC (rev 212735)
+++ trunk/Source/WebCore/crypto/mac/CryptoAlgorithmRegistryMac.cpp        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #if ENABLE(SUBTLE_CRYPTO)
</span><span class="cx">
</span><span class="cx"> #include "CryptoAlgorithmAES_CBC.h"
</span><ins>+#include "CryptoAlgorithmAES_CFB.h"
</ins><span class="cx"> #include "CryptoAlgorithmAES_KW.h"
</span><span class="cx"> #include "CryptoAlgorithmHMAC.h"
</span><span class="cx"> #include "CryptoAlgorithmRSAES_PKCS1_v1_5.h"
</span><span class="lines">@@ -45,6 +46,7 @@
</span><span class="cx"> void CryptoAlgorithmRegistry::platformRegisterAlgorithms()
</span><span class="cx"> {
</span><span class="cx"> registerAlgorithm<CryptoAlgorithmAES_CBC>();
</span><ins>+ registerAlgorithm<CryptoAlgorithmAES_CFB>();
</ins><span class="cx"> registerAlgorithm<CryptoAlgorithmAES_KW>();
</span><span class="cx"> registerAlgorithm<CryptoAlgorithmHMAC>();
</span><span class="cx"> registerAlgorithm<CryptoAlgorithmRSAES_PKCS1_v1_5>();
</span></span></pre></div>
<a id="trunkSourceWebCorecryptoparametersAesCbcCfbParamsidlfromrev212735trunkSourceWebCorecryptoparametersAesCbcParamsidl"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/crypto/parameters/AesCbcCfbParams.idl (from rev 212735, trunk/Source/WebCore/crypto/parameters/AesCbcParams.idl) (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/parameters/AesCbcCfbParams.idl         (rev 0)
+++ trunk/Source/WebCore/crypto/parameters/AesCbcCfbParams.idl        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+/*
+ * Copyright (C) 2016 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.
+ */
+
+// This is a unified dictionary for AesCbcParams and AesCfbParams.
+// https://www.w3.org/TR/WebCryptoAPI/#dfn-AesCbcParams, and
+// https://www.w3.org/TR/2014/CR-WebCryptoAPI-20141211/#dfn-AesCfbParams
+[
+ Conditional=SUBTLE_CRYPTO,
+ ImplementedAs=CryptoAlgorithmAesCbcCfbParams
+] dictionary AesCbcCfbParams : CryptoAlgorithmParameters {
+ // The initialization vector. MUST be 16 bytes.
+ required BufferSource iv;
+};
</ins></span></pre></div>
<a id="trunkSourceWebCorecryptoparametersAesCbcParamsidl"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/crypto/parameters/AesCbcParams.idl (212735 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/parameters/AesCbcParams.idl        2017-02-21 20:00:52 UTC (rev 212735)
+++ trunk/Source/WebCore/crypto/parameters/AesCbcParams.idl        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -1,32 +0,0 @@
</span><del>-/*
- * Copyright (C) 2016 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.
- */
-
-[
- Conditional=SUBTLE_CRYPTO,
- ImplementedAs=CryptoAlgorithmAesCbcParams
-] dictionary AesCbcParams : CryptoAlgorithmParameters {
- // The initialization vector. MUST be 16 bytes.
- required BufferSource iv;
-};
</del></span></pre></div>
<a id="trunkSourceWebCorecryptoparametersCryptoAlgorithmAesCbcCfbParamshfromrev212735trunkSourceWebCorecryptoparametersCryptoAlgorithmAesCbcParamsh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmAesCbcCfbParams.h (from rev 212735, trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmAesCbcParams.h) (0 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmAesCbcCfbParams.h         (rev 0)
+++ trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmAesCbcCfbParams.h        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -0,0 +1,59 @@
</span><ins>+/*
+ * Copyright (C) 2016 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.
+ */
+
+#pragma once
+
+#include "BufferSource.h"
+#include "CryptoAlgorithmParameters.h"
+#include <wtf/Vector.h>
+
+#if ENABLE(SUBTLE_CRYPTO)
+
+namespace WebCore {
+
+class CryptoAlgorithmAesCbcCfbParams final : public CryptoAlgorithmParameters {
+public:
+ BufferSource iv;
+
+ Class parametersClass() const final { return Class::AesCbcCfbParams; }
+
+ const Vector<uint8_t>& ivVector()
+ {
+ if (!m_ivVector.isEmpty() || !iv.length())
+ return m_ivVector;
+
+ m_ivVector.append(iv.data(), iv.length());
+ return m_ivVector;
+ }
+
+private:
+ Vector<uint8_t> m_ivVector;
+};
+
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_CRYPTO_ALGORITHM_PARAMETERS(AesCbcCfbParams)
+
+#endif // ENABLE(SUBTLE_CRYPTO)
</ins></span></pre></div>
<a id="trunkSourceWebCorecryptoparametersCryptoAlgorithmAesCbcParamsh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmAesCbcParams.h (212735 => 212736)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmAesCbcParams.h        2017-02-21 20:00:52 UTC (rev 212735)
+++ trunk/Source/WebCore/crypto/parameters/CryptoAlgorithmAesCbcParams.h        2017-02-21 20:04:44 UTC (rev 212736)
</span><span class="lines">@@ -1,59 +0,0 @@
</span><del>-/*
- * Copyright (C) 2016 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.
- */
-
-#pragma once
-
-#include "BufferSource.h"
-#include "CryptoAlgorithmParameters.h"
-#include <wtf/Vector.h>
-
-#if ENABLE(SUBTLE_CRYPTO)
-
-namespace WebCore {
-
-class CryptoAlgorithmAesCbcParams final : public CryptoAlgorithmParameters {
-public:
- BufferSource iv;
-
- Class parametersClass() const final { return Class::AesCbcParams; }
-
- const Vector<uint8_t>& ivVector()
- {
- if (!m_ivVector.isEmpty() || !iv.length())
- return m_ivVector;
-
- m_ivVector.append(iv.data(), iv.length());
- return m_ivVector;
- }
-
-private:
- Vector<uint8_t> m_ivVector;
-};
-
-} // namespace WebCore
-
-SPECIALIZE_TYPE_TRAITS_CRYPTO_ALGORITHM_PARAMETERS(AesCbcParams)
-
-#endif // ENABLE(SUBTLE_CRYPTO)
</del></span></pre>
</div>
</div>
</body>
</html>