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

Side by Side Diff: LayoutTests/crypto/resources/common.js

Issue 180323002: [webcrypto] Add parameter parsing for AES-GCM. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove addition to Dictionary Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
1 function importTestKeys() 1 function importTestKeys()
2 { 2 {
3 var keyFormat = "raw"; 3 var keyFormat = "raw";
4 var data = asciiToUint8Array("16 bytes of key!"); 4 var data = asciiToUint8Array("16 bytes of key!");
5 var extractable = true; 5 var extractable = true;
6 var keyUsages = ['wrapKey', 'unwrapKey', 'encrypt', 'decrypt', 'sign', 'veri fy']; 6 var keyUsages = ['wrapKey', 'unwrapKey', 'encrypt', 'decrypt', 'sign', 'veri fy'];
7 7
8 var hmacPromise = crypto.subtle.importKey(keyFormat, data, {name: 'hmac', ha sh: {name: 'sha-1'}}, extractable, keyUsages); 8 var hmacPromise = crypto.subtle.importKey(keyFormat, data, {name: 'hmac', ha sh: {name: 'sha-1'}}, extractable, keyUsages);
9 var aesCbcPromise = crypto.subtle.importKey(keyFormat, data, {name: 'AES-CBC '}, extractable, keyUsages); 9 var aesCbcPromise = crypto.subtle.importKey(keyFormat, data, {name: 'AES-CBC '}, extractable, keyUsages);
10 var aesCbcJustDecrypt = crypto.subtle.importKey(keyFormat, data, {name: 'AES -CBC'}, false, ['decrypt']); 10 var aesCbcJustDecrypt = crypto.subtle.importKey(keyFormat, data, {name: 'AES -CBC'}, false, ['decrypt']);
11 // FIXME: use AES-CTR key type once it's implemented 11 // FIXME: use AES-CTR key type once it's implemented
12 var aesCtrPromise = crypto.subtle.importKey(keyFormat, data, {name: 'AES-CBC '}, extractable, keyUsages); 12 var aesCtrPromise = crypto.subtle.importKey(keyFormat, data, {name: 'AES-CBC '}, extractable, keyUsages);
13 var aesGcmPromise = crypto.subtle.importKey(keyFormat, data, {name: 'AES-GCM '}, extractable, keyUsages);
13 14
14 return Promise.all([hmacPromise, aesCbcPromise, aesCbcJustDecrypt, aesCtrPro mise]).then(function(results) { 15 return Promise.all([hmacPromise, aesCbcPromise, aesCbcJustDecrypt, aesCtrPro mise, aesGcmPromise]).then(function(results) {
15 return { 16 return {
16 hmacSha1: results[0], 17 hmacSha1: results[0],
17 aesCbc: results[1], 18 aesCbc: results[1],
18 aesCbcJustDecrypt: results[2], 19 aesCbcJustDecrypt: results[2],
19 aesCtr: results[3], 20 aesCtr: results[3],
21 aesGcm: results[4],
20 }; 22 };
21 }); 23 });
22 } 24 }
23 25
24 // Verifies that the given "bytes" holds the same value as "expectedHexString". 26 // Verifies that the given "bytes" holds the same value as "expectedHexString".
25 // "bytes" can be anything recognized by "bytesToHexString()". 27 // "bytes" can be anything recognized by "bytesToHexString()".
26 function bytesShouldMatchHexString(testDescription, expectedHexString, bytes) 28 function bytesShouldMatchHexString(testDescription, expectedHexString, bytes)
27 { 29 {
28 expectedHexString = "[" + expectedHexString.toLowerCase() + "]"; 30 expectedHexString = "[" + expectedHexString.toLowerCase() + "]";
29 var actualHexString = "[" + bytesToHexString(bytes) + "]"; 31 var actualHexString = "[" + bytesToHexString(bytes) + "]";
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 debug("PASS: '" + code + "' accepted with " + result); 141 debug("PASS: '" + code + "' accepted with " + result);
140 } 142 }
141 143
142 function rejectCallback(result) 144 function rejectCallback(result)
143 { 145 {
144 debug("FAIL: '" + code + "' rejected with " + result); 146 debug("FAIL: '" + code + "' rejected with " + result);
145 } 147 }
146 148
147 addTask(promise.then(acceptCallback, rejectCallback)); 149 addTask(promise.then(acceptCallback, rejectCallback));
148 } 150 }
OLDNEW
« no previous file with comments | « LayoutTests/crypto/encrypt-decrypt-expected.txt ('k') | Source/modules/crypto/NormalizeAlgorithm.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698