Bug 1861467 - [wpt-sync] Update web-platform-tests to eedf737ce39c512d0ca3471f988972e...
[gecko.git] / dom / crypto / test / test_WebCrypto_Normalize.html
blobc586d1194e9a913f6bbe2f696667aa399da27cf9
1 <!DOCTYPE html>
2 <html>
4 <head>
5 <title>WebCrypto Test Suite</title>
6 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
7 <link rel="stylesheet" href="./test_WebCrypto.css"/>
8 <script src="/tests/SimpleTest/SimpleTest.js"></script>
10 <!-- Utilities for manipulating ABVs -->
11 <script src="util.js"></script>
13 <!-- A simple wrapper around IndexedDB -->
14 <script src="simpledb.js"></script>
16 <!-- Test vectors drawn from the literature -->
17 <script src="./test-vectors.js"></script>
19 <!-- General testing framework -->
20 <script src="./test-array.js"></script>
22 <script>/* <![CDATA[*/
23 "use strict";
25 TestArray.addTest(
26 "Test that we properly normalize algorithm names",
27 function() {
28 var that = this;
29 var alg = { name: "hmac", hash: {name: "sHa-256"} };
31 function doGenerateAesKey() {
32 return crypto.subtle.generateKey({ name: "AES-gcm", length: 192 }, false, ["encrypt"]);
35 function doGenerateRsaOaepKey() {
36 var algo = {
37 name: "rsa-OAEP",
38 hash: "sha-1",
39 modulusLength: 2048,
40 publicExponent: new Uint8Array([0x01, 0x00, 0x01]),
42 return crypto.subtle.generateKey(algo, false, ["encrypt", "decrypt"]);
45 function doGenerateRsaSsaPkcs1Key() {
46 return crypto.subtle.importKey("pkcs8", tv.pkcs8, { name: "RSASSA-pkcs1-V1_5", hash: "SHA-1" }, true, ["sign"]);
49 crypto.subtle.generateKey(alg, false, ["sign"])
50 .then(doGenerateAesKey)
51 .then(doGenerateRsaOaepKey)
52 .then(doGenerateRsaSsaPkcs1Key)
53 .then(complete(that), error(that));
57 /* ]]>*/</script>
58 </head>
60 <body>
62 <div id="content">
63 <div id="head">
64 <b>Web</b>Crypto<br>
65 </div>
67 <div id="start" onclick="start();">RUN ALL</div>
69 <div id="resultDiv" class="content">
70 Summary:
71 <span class="pass"><span id="passN">0</span> passed, </span>
72 <span class="fail"><span id="failN">0</span> failed, </span>
73 <span class="pending"><span id="pendingN">0</span> pending.</span>
74 <br/>
75 <br/>
77 <table id="results">
78 <tr>
79 <th>Test</th>
80 <th>Result</th>
81 <th>Time</th>
82 </tr>
83 </table>
85 </div>
87 <div id="foot"></div>
88 </div>
90 </body>
91 </html>