Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(544)

Side by Side Diff: LayoutTests/crypto/hmac-export-key.html

Issue 338993002: [webcrypto] exportKey() now returns dictionary when format='jwk' (CL 2 of 2). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase and fix rsa-oaep-key-manipulation.html Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/crypto/aes-export-key.html ('k') | LayoutTests/crypto/jwk-export-use-values.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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>
OLDNEW
« no previous file with comments | « LayoutTests/crypto/aes-export-key.html ('k') | LayoutTests/crypto/jwk-export-use-values.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698