OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../resources/js-test.js"></script> | 4 <script src="../resources/js-test.js"></script> |
5 <script src="resources/common.js"></script> | 5 <script src="resources/common.js"></script> |
6 </head> | 6 </head> |
7 <body> | 7 <body> |
8 <p id="description"></p> | 8 <p id="description"></p> |
9 <div id="console"></div> | 9 <div id="console"></div> |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 debug("Exporting the key as raw data..."); | 44 debug("Exporting the key as raw data..."); |
45 return crypto.subtle.exportKey("raw", key); | 45 return crypto.subtle.exportKey("raw", key); |
46 }, failAndFinishJSTest).then(function(result) { | 46 }, failAndFinishJSTest).then(function(result) { |
47 exportedData = result; | 47 exportedData = result; |
48 shouldBe("bytesToHexString(new Uint8Array(exportedData))", "'6a18e49feff7f3b
7e09ec89b7f6deab2f6a18e49feff7f3b7e09ec89b7f6deab'"); | 48 shouldBe("bytesToHexString(new Uint8Array(exportedData))", "'6a18e49feff7f3b
7e09ec89b7f6deab2f6a18e49feff7f3b7e09ec89b7f6deab'"); |
49 | 49 |
50 debug("Exporting the key as JWK..."); | 50 debug("Exporting the key as JWK..."); |
51 return crypto.subtle.exportKey("jwk", key); | 51 return crypto.subtle.exportKey("jwk", key); |
52 }).then(function(result) { | 52 }).then(function(result) { |
53 exportedJWK = JSON.parse(bytesToASCIIString(result)); | 53 exportedJWK = result; |
54 shouldBe("exportedJWK.kty", "'oct'"); | 54 shouldBe("exportedJWK.kty", "'oct'"); |
55 shouldBe("exportedJWK.k", "'ahjkn-_387fgnsibf23qsvahjkn-_387fgnsibf23qs'"); | 55 shouldBe("exportedJWK.k", "'ahjkn-_387fgnsibf23qsvahjkn-_387fgnsibf23qs'"); |
56 shouldBe("exportedJWK.alg", "'HS256'"); | 56 shouldBe("exportedJWK.alg", "'HS256'"); |
57 shouldBe("exportedJWK.ext", "true"); | 57 shouldBe("exportedJWK.ext", "true"); |
58 shouldBe("exportedJWK.use", "undefined"); | 58 shouldBe("exportedJWK.use", "undefined"); |
59 shouldBe("exportedJWK.key_ops", "['sign', 'verify']"); | 59 shouldBe("exportedJWK.key_ops", "['sign', 'verify']"); |
60 | 60 |
61 debug("\nImporting a key that's not extractable..."); | 61 debug("\nImporting a key that's not extractable..."); |
62 return crypto.subtle.importKey("jwk", jwkKey, { name: "HMAC", hash: {name: "
SHA-256"} }, nonExtractable, ["sign", "verify"]); | 62 return crypto.subtle.importKey("jwk", jwkKey, { name: "HMAC", hash: {name: "
SHA-256"} }, nonExtractable, ["sign", "verify"]); |
63 }, failAndFinishJSTest).then(function(result) { | 63 }, failAndFinishJSTest).then(function(result) { |
(...skipping 16 matching lines...) Expand all Loading... |
80 }, function(result) { | 80 }, function(result) { |
81 logError(result); | 81 logError(result); |
82 testPassed("Rejected, as expected"); | 82 testPassed("Rejected, as expected"); |
83 | 83 |
84 finishJSTest(); | 84 finishJSTest(); |
85 }); | 85 }); |
86 </script> | 86 </script> |
87 | 87 |
88 </body> | 88 </body> |
89 </html> | 89 </html> |
OLD | NEW |