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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 debug("\nExporting the key as raw data..."); | 62 debug("\nExporting the key as raw data..."); |
63 return crypto.subtle.exportKey("raw", key); | 63 return crypto.subtle.exportKey("raw", key); |
64 }).then(function(result) { | 64 }).then(function(result) { |
65 exportedData = result; | 65 exportedData = result; |
66 shouldBe("bytesToHexString(new Uint8Array(exportedData))", "'8e73b0f7da0e645
2c810f32b809079e562f8ead2522c6b7b8e73b0f7da0e6452'"); | 66 shouldBe("bytesToHexString(new Uint8Array(exportedData))", "'8e73b0f7da0e645
2c810f32b809079e562f8ead2522c6b7b8e73b0f7da0e6452'"); |
67 | 67 |
68 debug("Exporting the key as JWK..."); | 68 debug("Exporting the key as JWK..."); |
69 return crypto.subtle.exportKey("jwk", key); | 69 return crypto.subtle.exportKey("jwk", key); |
70 }).then(function(result) { | 70 }).then(function(result) { |
71 exportedJWK = JSON.parse(bytesToASCIIString(result)); | 71 exportedJWK = result; |
72 shouldBe("exportedJWK.kty", "'oct'"); | 72 shouldBe("exportedJWK.kty", "'oct'"); |
73 shouldBe("exportedJWK.k", "'jnOw99oOZFLIEPMrgJB55WL46tJSLGt7jnOw99oOZFI'"); | 73 shouldBe("exportedJWK.k", "'jnOw99oOZFLIEPMrgJB55WL46tJSLGt7jnOw99oOZFI'"); |
74 shouldBe("exportedJWK.alg", "'A256CBC'"); | 74 shouldBe("exportedJWK.alg", "'A256CBC'"); |
75 shouldBe("exportedJWK.ext", "true"); | 75 shouldBe("exportedJWK.ext", "true"); |
76 shouldBe("exportedJWK.use", "undefined"); | 76 shouldBe("exportedJWK.use", "undefined"); |
77 shouldBe("exportedJWK.key_ops", "['encrypt', 'decrypt', 'wrapKey', 'unwrapKe
y']"); | 77 shouldBe("exportedJWK.key_ops", "['encrypt', 'decrypt', 'wrapKey', 'unwrapKe
y']"); |
78 | 78 |
79 debug("\nImporting a key that's not extractable..."); | 79 debug("\nImporting a key that's not extractable..."); |
80 return crypto.subtle.importKey("jwk", jwkKey, {name: "AES-CBC"}, nonExtracta
ble, ['encrypt', 'decrypt', 'wrapKey', 'unwrapKey']) | 80 return crypto.subtle.importKey("jwk", jwkKey, {name: "AES-CBC"}, nonExtracta
ble, ['encrypt', 'decrypt', 'wrapKey', 'unwrapKey']) |
81 }).then(function(result) { | 81 }).then(function(result) { |
(...skipping 16 matching lines...) Expand all Loading... |
98 }, function(result) { | 98 }, function(result) { |
99 testPassed("Rejected, as expected"); | 99 testPassed("Rejected, as expected"); |
100 logError(result); | 100 logError(result); |
101 | 101 |
102 finishJSTest(); | 102 finishJSTest(); |
103 }); | 103 }); |
104 </script> | 104 </script> |
105 | 105 |
106 </body> | 106 </body> |
107 </html> | 107 </html> |
OLD | NEW |