Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: third_party/WebKit/LayoutTests/crypto/subtle/encrypt-neutered-data.html

Issue 2141843002: Copy array buffer data used by WebCrypto in the order expected by draft specification. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change FIXME --> TODO(eroman) Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/crypto/subtle/encrypt-neutered-data-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 <script src="resources/common.js"></script>
6 </head>
7 <body>
8 <p id="description"></p>
9 <div id="console"></div>
10
11 <script>
12 description("Tests crypto.subtle.encrypt() using a BufferSource that was neutere d (prior to encrypt())");
13
14 jsTestIsAsync = true;
15
16 data = null;
17 key = null;
18
19 var keyData = hexStringToUint8Array("2b7e151628aed2a6abf7158809cf4f3c");
20 var iv = hexStringToUint8Array("000102030405060708090a0b0c0d0e0f");
21 var kExpectedCipherTextHex = "c84af0b613435d5d9182801a9bd9320b";
22
23 var extractable = true;
24 var usages = ['encrypt', 'decrypt'];
25
26 debug("Importing key...");
27 crypto.subtle.importKey('raw', keyData, "aes-cbc", extractable, usages).then(fun ction(result) {
28 key = result;
29
30 debug("\nEncrypting empty plaintext (as a control group)...");
31 return crypto.subtle.encrypt({name: "aes-cbc", iv: iv}, key, new Uint8Array( ));
32 }).then(function(result) {
33 bytesShouldMatchHexString("Encryption", kExpectedCipherTextHex, result);
34
35 debug("\nCreating ArrayBuffer...");
36 plainText = new ArrayBuffer(1000);
37 shouldBe("plainText.byteLength", "1000");
38
39 debug("Neutering plainText...");
40 try { postMessage(plainText, "xxx", [plainText]); } catch (e) { }
41 shouldBe("plainText.byteLength", "0");
42
43 debug("\nEncrypting neutered plaintext...");
44 return crypto.subtle.encrypt({name: "aes-cbc", iv: iv}, key, plainText);
45 }).then(function(result) {
46 bytesShouldMatchHexString("Encryption", kExpectedCipherTextHex, result);
47 }).then(finishJSTest, failAndFinishJSTest);
48 </script>
49
50 </body>
51 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/crypto/subtle/encrypt-neutered-data-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698