Chromium Code Reviews| Index: LayoutTests/crypto/subtle/hkdf-deriveBits.html |
| diff --git a/LayoutTests/crypto/subtle/hkdf-deriveBits.html b/LayoutTests/crypto/subtle/hkdf-deriveBits.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3b87243dc72f67a9abd22bff62580315ae8b0078 |
| --- /dev/null |
| +++ b/LayoutTests/crypto/subtle/hkdf-deriveBits.html |
| @@ -0,0 +1,52 @@ |
| +<!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 that HKDF does not support methods it should not support."); |
| + |
| +jsTestIsAsync = true; |
| + |
| +kHkdfKey = "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b"; |
| + |
| +kHkdfAlgorithm = { |
| + name: "HKDF", |
| + hash: "SHA-256", |
| + salt: new Uint8Array(), |
| + info: new Uint8Array() |
| +}; |
| + |
| +var extractable = true; |
| +Promise.resolve(null).then(function(result) { |
| + // Set up the test by creating an HKDF key. |
| + return crypto.subtle.importKey("raw", hexStringToUint8Array(kHkdfKey), {name: "HKDF"}, extractable, ['deriveKey', 'deriveBits']); |
| +}).then(function(result) { |
| + baseKey = result; |
| + |
| + debug("Derive 0 bits from the HKDF key"); |
| + return crypto.subtle.deriveBits(kHkdfAlgorithm, baseKey, 0); |
| +}).then(function(result) { |
| + derivedBits = result; |
| + |
| + shouldEvaluateAs("derivedBits.byteLength", 0); |
| + |
| + debug("Derive 4 bits from the HKDF key"); |
| + return crypto.subtle.deriveBits(kHkdfAlgorithm, baseKey, 4); |
| +}).then(function(result) { |
| + derivedBits = new DataView(result); |
| + |
| + shouldEvaluateAs("derivedBits.byteLength", 1); |
| + shouldEvaluateAs("derivedBits.getUint8(0) % 16", 0); |
|
eroman
2015/01/12 22:35:23
Can you do an equality test instead?
Should verif
nharper
2015/01/13 00:11:16
shouldEvaluateAs changed to shouldBe.
I have test
eroman
2015/01/13 00:45:34
If you keep the file please rename it as you sugge
|
| + |
| +}).then(finishJSTest, failAndFinishJSTest); |
| + |
| +</script> |
| + |
| +</body> |
| +</html> |