| 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..140248c580571cd0e44efcd3cbf1f0347a8c9656
|
| --- /dev/null
|
| +++ b/LayoutTests/crypto/subtle/hkdf-deriveBits.html
|
| @@ -0,0 +1,53 @@
|
| +<!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;
|
| +
|
| + shouldBe("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);
|
| +
|
| + shouldBe("derivedBits.byteLength", "1");
|
| + // The last 4 bits should be zeroes.
|
| + shouldBe("derivedBits.getUint8(0)", "0x80");
|
| +
|
| +}).then(finishJSTest, failAndFinishJSTest);
|
| +
|
| +</script>
|
| +
|
| +</body>
|
| +</html>
|
|
|