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

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

Issue 23592023: WebCrypto: Add interface for exportKey(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase, add test expectations, remove platformCrypto nullity check Created 7 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/crypto/exportKey-expected.txt ('k') | Source/modules/crypto/SubtleCrypto.h » ('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 = "spki"; 3 var keyFormat = "spki";
4 var data = new Uint8Array([]); 4 var data = new Uint8Array([]);
5 var extractable = false; 5 var extractable = true;
6 var keyUsages = ['encrypt', 'decrypt', 'sign', 'verify']; 6 var keyUsages = ['encrypt', 'decrypt', 'sign', 'verify'];
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 rsaSsaPromise = crypto.subtle.importKey(keyFormat, data, {name: 'RSASSA- PKCS1-v1_5', hash: {name: 'sha-1'}}, extractable, keyUsages); 9 var rsaSsaPromise = crypto.subtle.importKey(keyFormat, data, {name: 'RSASSA- PKCS1-v1_5', hash: {name: 'sha-1'}}, extractable, keyUsages);
10 var aesCbcPromise = crypto.subtle.importKey(keyFormat, data, {name: 'AES-CBC '}, extractable, keyUsages); 10 var aesCbcPromise = crypto.subtle.importKey(keyFormat, data, {name: 'AES-CBC '}, extractable, keyUsages);
11 var aesCbcJustDecrypt = crypto.subtle.importKey(keyFormat, data, {name: 'AES -CBC'}, extractable, ['decrypt']); 11 var aesCbcJustDecrypt = crypto.subtle.importKey(keyFormat, data, {name: 'AES -CBC'}, false, ['decrypt']);
12 12
13 return Promise.every(hmacPromise, rsaSsaPromise, aesCbcPromise, aesCbcJustDe crypt).then(function(results) { 13 return Promise.every(hmacPromise, rsaSsaPromise, aesCbcPromise, aesCbcJustDe crypt).then(function(results) {
14 return { 14 return {
15 hmacSha1: results[0], 15 hmacSha1: results[0],
16 rsaSsaSha1: results[1], 16 rsaSsaSha1: results[1],
17 aesCbc: results[2], 17 aesCbc: results[2],
18 aesCbcJustDecrypt: results[3], 18 aesCbcJustDecrypt: results[3],
19 }; 19 };
20 }); 20 });
21 } 21 }
(...skipping 22 matching lines...) Expand all
44 chars.push(str.charCodeAt(i)); 44 chars.push(str.charCodeAt(i));
45 return new Uint8Array(chars); 45 return new Uint8Array(chars);
46 } 46 }
47 47
48 function failAndFinishJSTest(error) 48 function failAndFinishJSTest(error)
49 { 49 {
50 if (error) 50 if (error)
51 debug(error); 51 debug(error);
52 finishJSTest(); 52 finishJSTest();
53 } 53 }
OLDNEW
« no previous file with comments | « LayoutTests/crypto/exportKey-expected.txt ('k') | Source/modules/crypto/SubtleCrypto.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698