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

Side by Side Diff: LayoutTests/crypto/sign-verify.html

Issue 204013006: [webcrypto] Add length parameter to HmacKeyAlgorithm. (blink) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 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 | « no previous file | LayoutTests/crypto/sign-verify-expected.txt » ('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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // (1) Import the key 87 // (1) Import the key
88 return crypto.subtle.importKey('raw', keyData, importAlgorithm, extractable, usages).then(function(result) { 88 return crypto.subtle.importKey('raw', keyData, importAlgorithm, extractable, usages).then(function(result) {
89 key = result; 89 key = result;
90 90
91 // shouldBe() can only resolve variables in global context. 91 // shouldBe() can only resolve variables in global context.
92 tmpKey = key; 92 tmpKey = key;
93 shouldBe("tmpKey.type", "'secret'") 93 shouldBe("tmpKey.type", "'secret'")
94 shouldBe("tmpKey.extractable", "false") 94 shouldBe("tmpKey.extractable", "false")
95 shouldBe("tmpKey.algorithm.name", "'HMAC'") 95 shouldBe("tmpKey.algorithm.name", "'HMAC'")
96 shouldBe("tmpKey.algorithm.hash.name", "'" + testCase.algorithm + "'") 96 shouldBe("tmpKey.algorithm.hash.name", "'" + testCase.algorithm + "'")
97 shouldEvaluateTo("tmpKey.algorithm.length", keyData.length * 8);
97 shouldBe("tmpKey.usages.join(',')", "'sign,verify'") 98 shouldBe("tmpKey.usages.join(',')", "'sign,verify'")
98 99
99 // (2) Sign. 100 // (2) Sign.
100 return crypto.subtle.sign(algorithm, key, hexStringToUint8Array(testCase .message)); 101 return crypto.subtle.sign(algorithm, key, hexStringToUint8Array(testCase .message));
101 }).then(function(result) { 102 }).then(function(result) {
102 bytesShouldMatchHexString("Mac", testCase.mac, result); 103 bytesShouldMatchHexString("Mac", testCase.mac, result);
103 104
104 // (3) Verify 105 // (3) Verify
105 return crypto.subtle.verify(algorithm, key, hexStringToUint8Array(testCa se.mac), hexStringToUint8Array(testCase.message)); 106 return crypto.subtle.verify(algorithm, key, hexStringToUint8Array(testCa se.mac), hexStringToUint8Array(testCase.message));
106 }).then(function(result) { 107 }).then(function(result) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 143
143 // ------------------------------------------------- 144 // -------------------------------------------------
144 // Wait until all the tests have been run. 145 // Wait until all the tests have been run.
145 // ------------------------------------------------- 146 // -------------------------------------------------
146 147
147 Promise.all(allTests).then(finishJSTest, failAndFinishJSTest); 148 Promise.all(allTests).then(finishJSTest, failAndFinishJSTest);
148 149
149 </script> 150 </script>
150 151
151 </body> 152 </body>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/crypto/sign-verify-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698