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