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

Side by Side Diff: LayoutTests/crypto/subtle/pbkdf2-deriveBits-failures.html

Issue 820523003: [webcrypto] Implement PBKDF2 (blink-side) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: nit Created 5 years, 11 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
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 deriveBits() with various bad parameters for PBKDF2");
13
14 jsTestIsAsync = true;
15
16 var testCase = {
17 password: "password",
18 salt: "salt",
19 c: 1,
20 dkLen: 20,
21 hash: "SHA-1",
22 derived_key_full_length: "0c60c80f961f0e71f3a9b524af6012062fe037a6"
23 };
24
25 function importPbkdf2Key() {
26 var key = null;
27
28 debug("Importing the password...");
29
30 var algorithm = {name: 'PBKDF2'};
31
32 var password = asciiToUint8Array(testCase.password);
33 var usages = ['deriveBits', 'deriveKey'];
34 var extractable = false;
35
36 // (1) Import the password
37 return crypto.subtle.importKey('raw', password, algorithm, extractable, usag es).then(function(result) {
38 key = result;
39 return key;
40 });
41 }
42
43 var pbkdf2Key = null;
44
45 var params = {
46 name: 'PBKDF2',
47 salt: asciiToUint8Array(testCase.salt),
48 iterations: testCase.c,
49 hash: {name: testCase.hash}
50 };
51 importPbkdf2Key().then(function(result) {
52 pbkdf2Key = result;
53 debug("\nDeriving 100 bits...");
54 return crypto.subtle.deriveBits(params, pbkdf2Key, 100);
55 }).then(failAndFinishJSTest, function(result) {
56 logError(result);
57
58 debug("");
59 }).then(finishJSTest, failAndFinishJSTest);
60
61 </script>
62
63 </body>
64 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698