| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../resources/js-test-pre.js"></script> |
| <script src="../resources/common.js"></script> |
| </head> |
| <body> |
| <p id="description"></p> |
| <div id="console"></div> |
| |
| <script> |
| description("Test signing with HMAC SHA-224 using an imported key"); |
| |
| jsTestIsAsync = true; |
| |
| var extractable = false; |
| var text = asciiToUint8Array("Hello, World!"); |
| var hmacImportParams = { |
| name: "hmac", |
| hash: "sha-224", |
| } |
| var rawKey = asciiToUint8Array("jnOw99oOZFLIEPMr"); |
| var expectedSignature = "70b638e082fabc3bf391a1935c4b6a74168401214f4fb5c31e0cebf4"; |
| |
| crypto.subtle.importKey("raw", rawKey, hmacImportParams, extractable, ["sign", "verify"]).then(function(key) { |
| return crypto.subtle.sign("hmac", key, text); |
| }).then(function(result) { |
| signature = result; |
| |
| shouldBe("bytesToHexString(signature)", "expectedSignature"); |
| |
| finishJSTest(); |
| }); |
| |
| </script> |
| |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |