| <!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 importing a raw HMAC key with SHA-1 and then export it in raw format"); |
| |
| jsTestIsAsync = true; |
| |
| var rawKey = hexStringToUint8Array("192ff1e96a1399322db620760a738793ab6dfaf26bd2b3889bd81fc9d82ea25d11bb1b4763c0a9259512298e162dab2e6f505c9fc376fda1179a2a4055dd67f6"); |
| var extractable = true; |
| |
| debug("Importing a key..."); |
| crypto.subtle.importKey("raw", rawKey, {name: "hmac", hash: "sha-1"}, extractable, ["sign", "verify"]).then(function(cryptoKey) { |
| debug("Exporting a key..."); |
| return crypto.subtle.exportKey("raw", cryptoKey); |
| }).then(function(result) { |
| exportedRawKey = new Uint8Array(result); |
| |
| shouldBe("exportedRawKey", "rawKey"); |
| |
| finishJSTest(); |
| }); |
| |
| </script> |
| |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |