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/modify-importKey-data-during-normalization.html

Issue 2316633003: Copy data bytes in Web Crypto's importKey() and verify() operations (Closed)
Patch Set: add layout tests Created 4 years, 3 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/modify-importKey-data-during-normalization-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.importKey() using a BufferSource that is modifi ed during algorithm normalization");
13
14 jsTestIsAsync = true;
15
16 var kKeyDataHex = "30112233445566778899aabbccddeeff";
17
18 keyData = hexStringToUint8Array(kKeyDataHex);
19
20 function corruptKeyData()
21 {
22 debug("Corrupting keyData...");
23 keyData[0] = 0;
24 keyData[1] = 0;
25 }
26
27 // This algorithm has a custom getter that modifies the key data.
28 var importAlgorithm = {
29 get name() {
30 debug("Accessed name property");
31 corruptKeyData();
32 return 'aes-cbc';
33 }
34 };
35
36 var extractable = true;
37 var usages = ['encrypt', 'decrypt'];
38
39 debug("Importing key...");
40 crypto.subtle.importKey('raw', keyData, importAlgorithm, extractable, usages).th en(function(result) {
41 debug("Exporting key...");
42 return crypto.subtle.exportKey('raw', result);
43 }).then(function(result) {
44 bytesShouldMatchHexString("Exported data", kKeyDataHex, result);
45
46 debug("Importing key (again)...");
47 return crypto.subtle.importKey('raw', keyData, "AES-CBC", extractable, usage s);
48 }).then(function(result) {
49 debug("Importing second key...");
50 return crypto.subtle.exportKey('raw', result);
51 }).then(function(result) {
52 // This time the imported key should reflect the modified version.
53 bytesShouldMatchHexString("Exported data", "00002233445566778899aabbccddeeff ", result);
54 }).then(finishJSTest, failAndFinishJSTest);
55
56 </script>
57
58 </body>
59 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/crypto/subtle/modify-importKey-data-during-normalization-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698