Index: LayoutTests/crypto/subtle/hkdf-deriveKey.html |
diff --git a/LayoutTests/crypto/subtle/hkdf-deriveKey.html b/LayoutTests/crypto/subtle/hkdf-deriveKey.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4bedf218773cc0b554ec9bd54ef3ebb7fe4f7157 |
--- /dev/null |
+++ b/LayoutTests/crypto/subtle/hkdf-deriveKey.html |
@@ -0,0 +1,38 @@ |
+<!DOCTYPE html> |
+<html> |
+<head> |
+<script src="../../resources/js-test.js"></script> |
+<script src="resources/common.js"></script> |
+</head> |
+<body> |
+<p id="description"></p> |
+<div id="console"></div> |
+ |
+<script> |
+description("Test deriveKey() for HKDF"); |
+ |
+jsTestIsAsync = true; |
+ |
+kHkdfKey = "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"; |
+ |
+var extractable = true; |
+Promise.resolve(null).then(function(result) { |
+ // 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.
|
+ return crypto.subtle.importKey("raw", hexStringToUint8Array(kHkdfKey), {name: "HKDF"}, extractable, ['deriveKey']); |
+}).then(function(result) { |
+ baseKey = result; |
+ |
+ return crypto.subtle.deriveKey({name: "HKDF", hash: "SHA-256", salt: new Uint8Array(), info: new Uint8Array()}, baseKey, {name: "AES-GCM", length: 256}, extractable, ['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
|
+}).then(function(result) { |
+ derivedKey = result; |
+ |
+ shouldEvaluateAs("derivedKey.type", "secret"); |
+ shouldEvaluateAs("derivedKey.extractable", true); |
+ shouldEvaluateAs("derivedKey.algorithm.name", "AES-GCM"); |
+ shouldEvaluateAs("derivedKey.usages.join(',')", "encrypt"); |
+}).then(finishJSTest, failAndFinishJSTest); |
+ |
+</script> |
+ |
+</body> |
+</html> |