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

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

Issue 109223002: [webcrypto] Add crypto.subtle.wrapKey() and crypto.subtle.unwrapKey() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase test expectations (to match latest changes I had made) Created 7 years 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
« no previous file with comments | « no previous file | LayoutTests/crypto/wrap-unwrap.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 = ['encrypt', 'decrypt', 'sign', 'verify']; 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 // TODO(ellyjones): 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 13
14 return Promise.all([hmacPromise, aesCbcPromise, aesCbcJustDecrypt, aesCtrPro mise]).then(function(results) { 14 return Promise.all([hmacPromise, aesCbcPromise, aesCbcJustDecrypt, aesCtrPro mise]).then(function(results) {
15 return { 15 return {
16 hmacSha1: results[0], 16 hmacSha1: results[0],
17 aesCbc: results[1], 17 aesCbc: results[1],
18 aesCbcJustDecrypt: results[2], 18 aesCbcJustDecrypt: results[2],
19 aesCtr: results[3], 19 aesCtr: results[3],
20 }; 20 };
21 }); 21 });
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 chars.push(str.charCodeAt(i)); 80 chars.push(str.charCodeAt(i));
81 return new Uint8Array(chars); 81 return new Uint8Array(chars);
82 } 82 }
83 83
84 function failAndFinishJSTest(error) 84 function failAndFinishJSTest(error)
85 { 85 {
86 if (error) 86 if (error)
87 debug(error); 87 debug(error);
88 finishJSTest(); 88 finishJSTest();
89 } 89 }
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/crypto/wrap-unwrap.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698