forked from kjur/jsrsasign
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtool_tsres.html
executable file
·255 lines (234 loc) · 9.8 KB
/
tool_tsres.html
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<meta http-equiv="X-UA-Compatible" content="chrome=1" />
<meta name="description" content="jsrsasign : The 'jsrsasign' (RSA-Sign JavaScript Library) is a open source free pure JavaScript implementation of PKCS#1 v2.1 RSASSA-PKCS1-v1_5 RSA signing and validation algorithm." />
<link rel="stylesheet" type="text/css" media="screen" href="stylesheets/stylesheet.css">
<title>Time Stamp Generator</title>
<!-- for pkcs5pkey -->
<script language="JavaScript" type="text/javascript" src="jsrsasign-latest-all-min.js"></script>
<script language="JavaScript" type="text/javascript">
function doIt() {
var f1 = document.form1;
var aReq = null;
try {
// get request hex
var req1hex = b64nltohex(f1.req1.value);
// parse request
aReq = KJUR.asn1.tsp.TSPUtil.parseTimeStampReq(req1hex);
} catch (ex) {
alert("request parse error: " + ex);
return;
}
try {
// aTSTInfo parameters
var aTSTInfo = {};
aTSTInfo.policy = aReq.policy;
aTSTInfo.messageImprint = aReq.mi;
aTSTInfo.serialNumber = {hex: f1.serial1.value};
aTSTInfo.genTime = {};
if (f1.gentimemilli1.checked)
aTSTInfo.genTime = {millis: true};
if (f1.accu_second1.value != "" ||
f1.accu_milli1.value != "" ||
f1.accu_micro1.value != "") {
aTSTInfo.accuracy = {};
if (f1.accu_second1.value != "")
aTSTInfo.accuracy.seconds = parseInt(f1.accu_second1.value, 10);
if (f1.accu_milli1.value != "")
aTSTInfo.accuracy.millis = parseInt(f1.accu_milli1.value, 10);
if (f1.accu_micro1.value != "")
aTSTInfo.accuracy.micross = parseInt(f1.accu_micro1.value, 10);
}
if (f1.ordering1.checked) aTSTInfo.ordering = true;
if (f1.nonce1.checked &&
typeof aReq.nonce == "string") {
aTSTInfo.nonce = {hex: aReq.nonce};
}
if (f1.tsa1.checked) {
aTSTInfo.tsa = {certsubject: f1.cert1.value};
}
var aTST = {
tstInfo: aTSTInfo,
signerCert: f1.cert1.value,
hashAlg: 'sha256',
signerPrvKey: f1.prvkey1.value,
sigAlg: 'SHA256withRSA'
};
if (aReq.certreq === true) aTST.certs = [f1.cert1.value];
aTST.hashAlg = f1.mdalg1.value;
aTST.sigAlg = f1.sigalg1.value;
var dTST = KJUR.asn1.tsp.TSPUtil.newTimeStampToken(aTST);
var tstHex = dTST.getContentInfoEncodedHex();
f1.newtst1.value = hextob64nl(tstHex);
var dRes = new KJUR.asn1.tsp.TimeStampResp({tst: dTST,
status: {status: {name: 'granted'}}});
f1.newres1.value = hextob64nl(dRes.getEncodedHex());
} catch (ex) {
alert("error: " + ex);
}
}
</script>
</head>
<body>
<!-- HEADER -->
<div id="header_wrap" class="outer">
<header class="inner">
<h1 id="project_title">TimeStamp Generator</h1>
<h2 id="project_tagline">RFC 3161 Time Stamp Token/Response Generator</h2>
<a href="http://kjur.github.io/jsrsasign/">TOP</a> |
<a href="https://github.com/kjur/jsrsasign/tags/" target="_blank">DOWNLOADS</a> |
<a href="https://github.com/kjur/jsrsasign/wiki#programming-tutorial">TUTORIALS</a> |
<a href="http://kjur.github.io/jsrsasign/api/" target="_blank">API REFERENCE</a> |
<a href="http://kjur.github.io/jsrsasign/index.html#demo" target="_blank">DEMOS</a> |
</header>
</div>
<!-- MAIN CONTENT -->
<div id="main_content_wrap" class="outer">
<section id="main_content" class="inner">
<!-- now editing -->
<form name="form1">
<h4>(Step1) Fill Fields</h4>
<table>
<tr><td colspan="2">Time Stamp Requst (Base64):<br/>
<textarea name="req1" cols="65" rows="2">MEwCAQEwMTANBglghkgBZQMEAgEFAAQgmDSHbc+wXLFnpcJJU+uljErImxrfV/KP
L50JrxB+6PAGBCoDBAUCCxobHB4fKissLS4vAQH/</textarea>
<br/>
NOTE: You can generate request <a href="tool_tsreq.html">here</a>.
</td></tr>
<tr><td colspan="2">TSA Private Key (PEM):<br/>
<textarea name="prvkey1" cols="65" rows="3">-----BEGIN PRIVATE KEY-----
MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDfdOqotHd55SYO
0dLz2oXengw/tZ+q3ZmOPeVmMuOMIYO/Cv1wk2U0OK4pug4OBSJPhl09Zs6IwB8N
wPOU7EDTgMOcQUYB/6QNCI1J7Zm2oLtuchzz4pIb+o4ZAhVprLhRyvqi8OTKQ7kf
Gfs5Tuwmn1M/0fQkfzMxADpjOKNgf0uy6lN6utjdTrPKKFUQNdc6/Ty8EeTnQEwU
lsT2LAXCfEKxTn5RlRljDztS7Sfgs8VL0FPy1Qi8B+dFcgRYKFrcpsVaZ1lBmXKs
XDRu5QR/Rg3f9DRq4GR1sNH8RLY9uApMl2SNz+sR4zRPG85R/se5Q06Gu0BUQ3UP
m67ETVZLAgMBAAECggEADjU54mYvHpICXHjc5+JiFqiH8NkUgOG8LL4kwt3DeBp9
bP0+5hSJH8vmzwJkeGG9L79EWG4b/bfxgYdeNX7cFFagmWPRFrlxbd64VRYFawZH
RJt+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XUAjuvDLqtTtU7zBU6dIl
h12Pwyf+x6AsYSciA9zWC6OE590K8Jr2z4u85biM7viWvPeZPNHSNM1fe+8wKbP8
64JtLj/VrglcsXALaUalyh2Hs7gPQzjyus1fyhEWPO3T6KMcBMXjb6anxL5q9YO5
qx1hJTY3L1hahBcMTALQyTEiFv1S
-----END CERTIFICATE-----</textarea>
</td></tr>
<tr><td>serial(hex):</td><td><input type="text" name="serial1" value="01020304" size="80"/></td></tr>
<tr><td>genTime:</td>
<td>
include milli seconds
<input type="checkbox" name="gentimemilli1" value="1" checked/></td>
</tr>
<tr><td>accuracy:</td><td>
second:
<input type="text" name="accu_second1" value="" size="8"/>
milli:
<input type="text" name="accu_milli1" value="500" size="8"/>
micro:
<input type="text" name="accu_micro1" value="" size="8"/>
</td></tr>
<tr><td>ordering:</td><td>
ordering true: <input type="checkbox" name="ordering1" value="1" checked/>
</td></tr>
<tr><td>nonce:</td><td>
include nonce: <input type="checkbox" name="nonce1" value="1" checked/>
</td></tr>
<tr><td>tsa:</td><td>
include TSA Name: <input type="checkbox" name="tsa1" value="1" checked/>
</td></tr>
<tr><td>
hashAlg:</td><td>
<select name="mdalg1">
<option value="sha256">SHA-256
<option value="sha512">SHA-512
<option value="sha384">SHA-384
<option value="sha224">SHA-224
<option value="sha1">SHA-1
<option value="md5">MD5
<option value="ripemd160">RIPEMD160
</select>
NOTE: for hash algorithm of MessageDigest attribute.
</td></tr>
<tr><td>
sigAlg:</td><td>
<select name="sigalg1">
<option value="SHA256withRSA">SHA256withRSA
<option value="SHA512withRSA">SHA512withRSA
<option value="SHA384withRSA">SHA384withRSA
<option value="SHA224withRSA">SHA224withRSA
<option value="SHA1withRSA">SHA1withRSA
<option value="MD5withRSA">MD5withRSA
<option value="RIPEMD160withRSA">RIPEMD160withRSA
<option value="SHA256withECDSA">SHA256withECDSA
<option value="SHA512withECDSA">SHA512withECDSA
<option value="SHA384withECDSA">SHA384withECDSA
<option value="SHA224withECDSA">SHA224withECDSA
<option value="SHA1withECDSA">SHA1withECDSA
<option value="SHA256withSA">SHA256withDSA
<option value="SHA512withSA">SHA512withDSA
<option value="SHA384withSA">SHA384withDSA
<option value="SHA224withSA">SHA224withDSA
<option value="SHA1withDSA">SHA1withDSA
</select>
NOTE: for SignerInfo Signature algorithm.
</td></tr>
</table>
<h4>(Step2) Press "Generate" button</h4>
<input type="button" value="Generate Token/Reponse" onClick="doIt();"/>
<input type="reset" name="reset" value="Reset"/>
<h2>Generated TimeStampToken/Response</h2>
Generated TimeStampToken(Base64):<br/>
<textarea name="newtst1" cols="65" rows="3"></textarea><br/>
Generated TimeStampResponse(Base64):<br/>
<textarea name="newres1" cols="65" rows="3"></textarea><br/>
</form>
<!-- now editing -->
</section>
</div>
<!-- FOOTER -->
<div id="footer_wrap" class="outer">
<footer class="inner">
<p class="copyright">jsrsasign maintained by <a href="https://github.com/kjur">kjur</a></p>
<p>Published with <a href="http://pages.github.com">GitHub Pages</a></p>
<div align="center" style="color: white">
Copyright © 2010-2014 Kenji Urushima. All rights reserved.
</div>
</footer>
</div>
</body>
</html>