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

Side by Side Diff: LayoutTests/crypto/subtle/hkdf-deriveKey.html

Issue 822083003: Webcrypto: add layout tests for HKDF algorithm (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
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("Test deriveKey() for HKDF");
13
14 jsTestIsAsync = true;
15
16 kHkdfKey = "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b";
17
18 var extractable = true;
19 Promise.resolve(null).then(function(result) {
20 // Create a key with only deriveKey usages.
eroman 2014/12/23 23:29:39 nit: This comment seems obvious, suggest removing
nharper 2015/01/06 23:51:59 Done.
21 return crypto.subtle.importKey("raw", hexStringToUint8Array(kHkdfKey), {name: "HKDF"}, extractable, ['deriveKey']);
22 }).then(function(result) {
23 baseKey = result;
24
25 return crypto.subtle.deriveKey({name: "HKDF", hash: "SHA-256", salt: new Uint8 Array(), info: new Uint8Array()}, baseKey, {name: "AES-GCM", length: 256}, extra ctable, ['encrypt']);
eroman 2014/12/23 23:29:39 Another test I would like to see is chaining ECDH
nharper 2015/01/06 23:51:59 ECDH currently doesn't support the get key length
eroman 2015/01/07 01:18:42 Other way around. ECDH derives a key for HKDF, and
nharper 2015/01/09 17:54:34 That makes more sense (both the order of chaining
eroman 2015/01/09 19:27:36 Not sure I understand your claim (1) HKDF _does_
nharper 2015/01/09 22:41:46 My claim was based on a) not realizing that HKDF d
26 }).then(function(result) {
27 derivedKey = result;
28
29 shouldEvaluateAs("derivedKey.type", "secret");
30 shouldEvaluateAs("derivedKey.extractable", true);
31 shouldEvaluateAs("derivedKey.algorithm.name", "AES-GCM");
32 shouldEvaluateAs("derivedKey.usages.join(',')", "encrypt");
33 }).then(finishJSTest, failAndFinishJSTest);
34
35 </script>
36
37 </body>
38 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698