forked from kjur/jsrsasign
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tool_jwt.html
executable file
·584 lines (506 loc) · 23.9 KB
/
tool_jwt.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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>jsjws: Mobile Top</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" rel="stylesheet" type="text/css">
<script src="http://code.jquery.com/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript" src="https://kjur.github.io/jsrsasign/jsrsasign-4.1.4-all-min.js"></script>
<script language="JavaScript" type="text/javascript" src="../ext/json-sans-eval.js"></script>
<script language="JavaScript" type="text/javascript" src="../jws-3.0.min.js"></script>
<script leanguage="JavaScript" type="text/javascript">
function _setAlg() {
switch (document.form1.alg1.selectedIndex) {
case 0: _setKey('', ''); break;
case 1: _setKey('616161', ''); break;
case 2: _setKey('616161', ''); break;
case 3: _setKey(z4PrvP5EPem, z4PrvP5EPass); break;
case 4: _setKey(z4PrvP5EPem, z4PrvP5EPass); break;
case 5: _setKey(z4PrvP5EPem, z4PrvP5EPass); break;
case 6: _setKey(k1PrvP8PPem, ''); break;
case 7: _setKey(k6PrvP8PPem, ''); break;
case 8: _setKey(z4PrvP5EPem, z4PrvP5EPass); break;
case 9: _setKey(z4PrvP5EPem, z4PrvP5EPass); break;
case 10: _setKey(z4PrvP5EPem, z4PrvP5EPass); break;
case 11: _setKey(z4PrvP5PPem, ''); break;
case 12: _setKey(z4PrvP8PPem, ''); break;
case 13: _setKey(z4PrvP8EPem, z4PrvP8EPass); break;
}
}
function _setKey(key, pass) {
document.form1.key1.value = key;
document.form1.pass1.value = pass;
}
function _doSign() {
//alert(123);
$.mobile.loading('show', {
text: 'signing...',
textVisible: true,
theme: 'z',
html: ""
});
var f = document.form1;
var sClaim = JSON.stringify(_getClaim());
//alert(sClaim);
var alg = f.alg1.options[f.alg1.selectedIndex].value;
//alert(alg);
var pHeader = {'alg': alg, 'typ': 'JWT'};
var sHeader = JSON.stringify(pHeader);
var key = f.key1.value;
var pass = f.pass1.value;
var sJWS = '';
if (pass == '') {
sJWS = KJUR.jws.JWS.sign(null, sHeader, sClaim, key);
} else {
sJWS = KJUR.jws.JWS.sign(null, sHeader, sClaim, key, pass);
}
f.jws1.value = sJWS;
document.form2.jws1.value = sJWS;
document.form3.jws1.value = sJWS;
$.mobile.loading('hide');
}
function _getClaim() {
var r = {};
if (document.form1.iss1.value != '')
r.iss = document.form1.iss1.value;
if (document.form1.sub1.value != '')
r.sub = document.form1.sub1.value;
if (document.form1.nbf1.value != '')
r.nbf = KJUR.jws.IntDate.get(document.form1.nbf1.value);
if (document.form1.exp1.value != '')
r.exp = KJUR.jws.IntDate.get(document.form1.exp1.value);
if (document.form1.iat1.value != '')
r.iat = KJUR.jws.IntDate.get(document.form1.iat1.value);
if (document.form1.jti1.value != '')
r.jti = document.form1.jti1.value;
if (document.form1.typ1.value != '')
r.typ = document.form1.typ1.value;
return r;
}
// -- verify ------------------------------------------------------------
function _doVerify() {
_doDecode2();
var sJWS = document.form2.jws1.value;
var key = document.form2.key2.value;
var isValid = false;
try {
isValid = KJUR.jws.JWS.verify(sJWS, key);
} catch (ex) {
alert("Error: " + ex);
isValid = false;
}
if (isValid) {
alert("JWT signature is *Valid*.");
} else {
alert("JWT signature is *Invalid*.");
}
}
function _doDecode2() {
var sJWS = document.form2.jws1.value;
var a = sJWS.split(".");
var uHeader = b64utos(a[0]);
var uClaim = b64utos(a[1]);
var pHeader = KJUR.jws.JWS.readSafeJSONString(uHeader);
var pClaim = KJUR.jws.JWS.readSafeJSONString(uClaim);
var sHeader = JSON.stringify(pHeader, null, " ");
var sClaim = JSON.stringify(pClaim, null, " ");
document.form2.im_head1.value = sHeader;
document.form2.im_payload1.value = sClaim;
}
function _setAlg2() {
switch (document.form2.alg2.selectedIndex) {
case 0: _setKey2(''); break;
case 1: _setKey2('616161'); break;
case 2: _setKey2(z4PubP8Pem); break;
case 3: _setKey2(z4CertPem); break;
case 4: _setKey2(k1PubP8Pem); break;
case 4: _setKey2(k1CertPem); break;
case 5: _setKey2(k6PubP8Pem); break;
case 5: _setKey2(k6CertPem); break;
}
}
function _setKey2(key, pass) {
document.form2.key2.value = key;
}
// -- parse ------------------------------------------------------------
function _doDecode() {
var sJWS = document.form3.jws1.value;
var a = sJWS.split(".");
var uHeader = b64utos(a[0]);
var uClaim = b64utos(a[1]);
var pHeader = KJUR.jws.JWS.readSafeJSONString(uHeader);
var pClaim = KJUR.jws.JWS.readSafeJSONString(uClaim);
var sHeader = JSON.stringify(pHeader, null, " ");
var sClaim = JSON.stringify(pClaim, null, " ");
document.form3.im_head1.value = sHeader;
document.form3.im_payload1.value = sClaim;
}
// -- data ------------------------------------------------------------
var z4PrvP5EPem = "" +
"-----BEGIN RSA PRIVATE KEY-----\n" +
"Proc-Type: 4,ENCRYPTED\n" +
"DEK-Info: DES-EDE3-CBC,2E65118E6C7B5207\n" +
"\n" +
"7cYUTW4ZBdmVZ4ILB08hcTdm5ib0E0zcy+I7pHpNQfJHtI7BJ4omys5S19ufJPBJ\n" +
"IzYjeO7oTVqI37F6EUmjZqG4WVE2UQbQDkosZbZN82O4Ipu1lFAPEbwjqePMKufz\n" +
"snSQHKfnbyyDPEVNlJbs19NXC8v6g+pQay5rH/I6N2iBxgsTmuemZ54EhNQMZyEN\n" +
"R/CiheArWEH9H8/4hd2gc9Tb2s0MwGHILL4kbbNm5tp3xw4ik7OYWNrj3m+nG6Xb\n" +
"vKXh2xEanAZAyMXTqDJTHdn7/CEqusQPJjZGV+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/Gur55H2kTBTwzlQ6WSL\n" +
"Te9Zj+eoMGklIirA+8YdQHXrO+CCw9BTJAF+c3c3xeUOLXafzyW29bASGfUtA7Ax\n" +
"QAsR+Rr3+wKBgAwfZxrh6ZWP+17+WuVArOWIMZFj7SRX2yGdWa/lxwgmNPSSFkXj\n" +
"hkBttujoY8IsSrTivzqpgCrTCjPTpir4iURzWw4W08bpjd7u3C/HX7Y16Uq8ohEJ\n" +
"T5lslveDJ3iNljSK74eMK7kLg7fBM7YDogxccHJ1IHsvInp3e1pmZxOxAoGAO+bS\n" +
"TUQ4N/UuQezgkF3TDrnBraO67leDGwRbfiE/U0ghQvqh5DA0QSPVzlWDZc9KUitv\n" +
"j8vxsR9o1PW9GS0an17GJEYuetLnkShKK3NWOhBBX6d1yP9rVdH6JhgIJEy/g0Su\n" +
"z7TAFiFc8i7JF8u4QJ05C8bZAMhOLotqftQeVOMCgYAid8aaRvaM2Q8a42Jn6ZTT\n" +
"5ms6AvNr98sv0StnfmNQ+EYXN0bEk2huSW+w2hN34TYYBTjViQmHbhudwwu8lVjE\n" +
"ccDmIXsUFbHVK+kTIpWGGchy5cYPs3k9s1nMR2av0Lojtw9WRY76xRXvN8W6R7Eh\n" +
"wA2ax3+gEEYpGhjM/lO2Lg==\n" +
"-----END PRIVATE KEY-----\n";
var k1PrvP8PPem = "" +
"-----BEGIN PRIVATE KEY-----\n" +
"MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgEbVzfPnZPxfAyxqE\n" +
"ZV05laAoJAl+/6Xt2O4mOB611sOhRANCAASgFTKjwJAAU95g++/vzKWHkzAVmNMI\n" +
"tB5vTjZOOIwnEb70MsWZFIyUFD1P9Gwstz4+akHX7vI8BH6hHmBmfeQl\n" +
"-----END PRIVATE KEY-----\n";
var k6PrvP8PPem = "" +
"-----BEGIN PRIVATE KEY-----\n" +
"MIG2AgEAMBAGByqGSM49AgEGBSuBBAAiBIGeMIGbAgEBBDAamStb0Xep3y3sWw2u\n" +
"SSAdUPkgQ9Rvhlnx8XEVOYy2teh69T0on77ja02m03n8t8WhZANiAARUNSar38Rz\n" +
"lKPyZFsNSGUanzpNRth0C+MikVEH8FAlDHMMpAs34dyF4IK0uxgbiEe9bQ+ieLrl\n" +
"6xwFR0yaTivuwoyXC+ScGUnwnpaXmid6UUgw4ypbneHsaKuZ9JLdMAo=\n" +
"-----END PRIVATE KEY-----\n";
// PUBLIC KEY
var z4PubP8Pem = "" +
"-----BEGIN PUBLIC KEY-----\n" +
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA33TqqLR3eeUmDtHS89qF\n" +
"3p4MP7Wfqt2Zjj3lZjLjjCGDvwr9cJNlNDiuKboODgUiT4ZdPWbOiMAfDcDzlOxA\n" +
"04DDnEFGAf+kDQiNSe2ZtqC7bnIc8+KSG/qOGQIVaay4Ucr6ovDkykO5Hxn7OU7s\n" +
"Jp9TP9H0JH8zMQA6YzijYH9LsupTerrY3U6zyihVEDXXOv08vBHk50BMFJbE9iwF\n" +
"wnxCsU5+UZUZYw87Uu0n4LPFS9BT8tUIvAfnRXIEWCha3KbFWmdZQZlyrFw0buUE\n" +
"f0YN3/Q0auBkdbDR/ES2PbgKTJdkjc/rEeM0TxvOUf7HuUNOhrtAVEN1D5uuxE1W\n" +
"SwIDAQAB\n" +
"-----END PUBLIC KEY-----\n";
var z4CertPem = "" +
"-----BEGIN CERTIFICATE-----\n" +
"MIIC/zCCAeegAwIBAgIBATANBgkqhkiG9w0BAQUFADAaMQswCQYDVQQGEwJVUzEL\n" +
"MAkGA1UECgwCWjQwHhcNMTMwODI4MTgyODM0WhcNMjMwODI4MTgyODM0WjAaMQsw\n" +
"CQYDVQQGEwJVUzELMAkGA1UECgwCWjQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw\n" +
"ggEKAoIBAQDfdOqotHd55SYO0dLz2oXengw/tZ+q3ZmOPeVmMuOMIYO/Cv1wk2U0\n" +
"OK4pug4OBSJP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KEY-----\n";
var k1CertPem = "" +
"-----BEGIN CERTIFICATE-----\n" +
"MIIBfDCCASGgAwIBAgIJAKbxELQvSUDNMAoGCCqGSM49BAMCMBoxCzAJBgNVBAYT\n" +
"AlVTMQswCQYDVQQKDAJLMTAeFw0xMzA3MTQwMjE3MTdaFw0yMzA3MTIwMjE3MTda\n" +
"MBoxCzAJBgNVBAYTAlVTMQswCQYDVQQKDAJLMTBZMBMGByqGSM49AgEGCCqGSM49\n" +
"AwEHA0IABKAVMqPAkABT3mD77+/MpYeTMBWY0wi0Hm9ONk44jCcRvvQyxZkUjJQU\n" +
"PU/0bCy3Pj5qQdfu8jwEfqEeYGZ95CWjUDBOMB0GA1UdDgQWBBTIR74yfMz/Y4hw\n" +
"dXSW4r42bESo/DAfBgNVHSMEGDAWgBTIR74yfMz/Y4hwdXSW4r42bESo/DAMBgNV\n" +
"HRMEBTADAQH/MAoGCCqGSM49BAMCA0kAMEYCIQDfAcS/WKBrP6JBgksQVpp4jdq4\n" +
"C53Yu4F5NkaMgthAHgIhANGRdWAP1QdW9l6tiglQwdqJs4T0e8+NYv+RcAb3VYwn\n" +
"-----END CERTIFICATE-----\n";
var k6PubP8Pem = "" +
"-----BEGIN PUBLIC KEY-----\n" +
"MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEVDUmq9/Ec5Sj8mRbDUhlGp86TUbYdAvj\n" +
"IpFRB/BQJQxzDKQLN+HcheCCtLsYG4hHvW0Poni65escBUdMmk4r7sKMlwvknBlJ\n" +
"8J6Wl5onelFIMOMqW53h7GirmfSS3TAK\n" +
"-----END PUBLIC KEY-----\n";
var k6CertPem = "" +
"-----BEGIN CERTIFICATE-----\n" +
"MIIBrjCCATWgAwIBAgIBATAJBgcqhkjOPQQBMBoxCzAJBgNVBAYTAlVTMQswCQYD\n" +
"VQQKDAJLNjAeFw0xMzA4MjgxODI2MDNaFw0yMzA4MjgxODI2MDNaMBoxCzAJBgNV\n" +
"BAYTAlVTMQswCQYDVQQKDAJLNjB2MBAGByqGSM49AgEGBSuBBAAiA2IABFQ1Jqvf\n" +
"xHOUo/JkWw1IZRqfOk1G2HQL4yKRUQfwUCUMcwykCzfh3IXggrS7GBuIR71tD6J4\n" +
"uuXrHAVHTJpOK+7CjJcL5JwZSfCelpeaJ3pRSDDjKlud4exoq5n0kt0wCqNQME4w\n" +
"HQYDVR0OBBYEFDr7X/HKjspl4kCJ9a8zWed/DZHrMB8GA1UdIwQYMBaAFDr7X/HK\n" +
"jspl4kCJ9a8zWed/DZHrMAwGA1UdEwQFMAMBAf8wCQYHKoZIzj0EAQNoADBlAjEA\n" +
"jteX+S/Btn1akjFeWf35iEbFpT9iPRxPZbUrCaEYBycyemCRTQslG5fxys9OGTtC\n" +
"AjB+9NmIQ5QtTgDDiZf6SaeDosq81aU/1S8eOdD/7H9SdclILyo93+i+S9qDio75\n" +
"2F8=\n" +
"-----END CERTIFICATE-----\n";
</script>
</head>
<body>
<!-- page top -->
<div data-role="page" id="top">
<div data-role="header">
<h1>signer/verifier</h1>
<a href="index.html">Back</a>
</div>
<div data-role="content">
This is a <a href="https://kjur.github.io/jsjws/" target="_blank">jsjws</a>
sample program to generate and verify JSON Web Token(JWT).
<h2>demo</h2>
<ul data-role="listview" data-inset="true">
<li><a href="#signer">JWT signer</a></li>
<li><a href="#verifier">JWT verifier</a></li>
<li><a href="#parser">JWT parser</a></li>
</ul>
</div>
<div data-role="footer">
<h4>© 2013 <a href="https://github.com/kjur">@kjur</a></h4>
</div>
</div>
<!-- page signer -->
<div data-role="page" id="signer">
<script>
$(document).bind('mobileinit', function(){
$.mobile.loader.prototype.options.text = "loading";
$.mobile.loader.prototype.options.textVisible = false;
$.mobile.loader.prototype.options.theme = "z";
$.mobile.loader.prototype.options.html = "";
});
</script>
<div data-role="header">
<h1>JWT signer</h1>
<a href="#top">Back</a>
</div>
<div data-role="content">
This is a sample program to generate a signed JSON Web Token(JWT).
<h2>(Step1) set claim</h2>
<form name="form1">
<div data-role="fieldcontain">
<label>Issuer(iss)</label><br/>
<input type="text" name="iss1" value="https://jwt-idp.example.com"/><br/>
<label>Subject(sub)</label><br/>
<input type="text" name="sub1" value="mailto:[email protected]"/><br/>
<label>Not Before Time(nbf)</label><br/>
<input type="text" name="nbf1" value="now"/><br/>
<label>Expiration Time(exp)</label><br/>
<input type="text" name="exp1" value="now + 1hour"/><br/>
<label>Issue At Time(iat)</label><br/>
<input type="text" name="iat1" value="now"/><br/>
<label>JWT ID(jti)</label><br/>
<input type="text" name="jti1" value="id123456"/><br/>
<label>Type(typ)</label><br/>
<input type="text" name="typ1" value="https://example.com/register"/><br/>
</div>
NOTE: As for 'time' representation, please see
<a href="https://kjur.github.io/jsjws/api/symbols/KJUR.jws.IntDate.html#.get" target="_blank">here</a> in detail.
<h2>(Step2) Choose issuer key and JWS signing algorithm.</h2>
<div data-role="fieldcontain">
<b>Private key or shared secret:</b><br/>
Choose JWS signature algorithm and default value: <br/>
<select name="alg1" onChange="_setAlg()">
<option value="none" selected/> none (no signature)
<option value="HS256"/> HS256 (HmacSHA256) with default shared key
<option value="HS512"/> HS512 (HmacSHA512) with default shared key
<option value="RS256"/> RS256 (SHA256withRSA RSA2048bit:z4) with default private key
<option value="RS384"/> RS384 (SHA384withRSA RSA2048bit:z4) with default private key
<option value="RS512"/> RS512 (SHA512withRSA RSA2048bit:z4) with default private key
<option value="ES256"/> ES256 (SHA256withECDSA NIST P-256) with default private key
<option value="ES384"/> ES384 (SHA384withECDSA NIST P-384) with default private key
<option value="PS256"/> PS256 (SHA256withRSAandMGF1 RSA2048bit:z4) with default private key
<option value="PS384"/> PS384 (SHA384withRSAandMGF1 RSA2048bit:z4) with default private key
<option value="PS512"/> PS512 (SHA512withRSAandMGF1 RSA2048bit:z4) with default private key
<option value="RS256"/> SHA256withRSA with PKCS#5 plain private key(z4)
<option value="RS256"/> SHA256withRSA with PKCS#8 plain private key(z4)
<option value="RS256"/> SHA256withRSA with PKCS#8 encrypted private key(z4)
</select>
<br/>
Or specify signature algorithm, private key, private key passcode and/or shared secret:<br/>
<textarea name="key1" cols="65" rows="3"></textarea><br/>
passcode for private key: <br/>
<input name="pass1" type="text" cols="40"/><br/>
<i>NOTE: Off course you can set your own private key and passcode.
Please care of proper signature algorithm
when you set your own key and pass code.</i>
<h2>(Step3) Press "Sign it!"</h2>
To generate signed JWT just pass 'Sign it!'.
<input type="button" value="Sign it!" onClick="_doSign();"/> <br/>
<textarea name="jws1" cols="65" rows="3"></textarea><br/>
</div>
</div>
</form>
</div>
<div data-role="footer">
<h4>© 2013 <a href="https://github.com/kjur">@kjur</a></h4>
</div>
</div>
<!-- page verifier ----------------------------------------------------------------------->
<div data-role="page" id="verifier">
<div data-role="header">
<h1>JWT verifier</h1>
<a href="#top">Back</a>
</div>
<div data-role="content">
This is a sample program to generate and verify JSON Web Token(JWT).
<form name="form2" id="form2">
<h2>(Step1) Fill JWT</h2>
<textarea rows="10" cols="10" id="textarea_parse_jws1" name="jws1">eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2p3dC1pZHAuZXhhbXBsZS5jb20iLCJzdWIiOiJtYWlsdG86bWlrZUBleGFtcGxlLmNvbSIsIm5iZiI6MTM3ODI3NTMwMiwiZXhwIjoxMzc4Mjc4OTAyLCJpYXQiOjEzNzgyNzUzMDIsImp0aSI6ImlkMTIzNDU2IiwidHlwIjoiaHR0cHM6Ly9leGFtcGxlLmNvbS9yZWdpc3RlciJ9.fWNOjt3Xa72gc4uqFILE6tdf6TVqtC0Tws2w5rkllb0</textarea>
<h2>(Step2) Choose proper public key or certificate to verify.</h2>
<select name="alg2" onChange="_setAlg2()">
<option value="none" selected/> none (no signature)
<option value="HS"/> HS* (HmacSHA*) with default shared key
<option value="RSPS-PUB"/> default PKCS#8 public key (RSA z4) for RS* PS* JWT
<option value="RSPS-CER"/> default X.509 certificate (RSA z4) for RS* PS* JWT
<option value="ES256-PUB"/> default public key for ES256 (SHA256withECDSA NIST P-256 k1)
<option value="ES256-CER"/> default X.509 certificate for ES256 (SHA256withECDSA NIST P-256 k1)
<option value="ES384-PUB"/> default public key for ES384 (SHA384withECDSA NIST P-384 k6)
<option value="ES384-PUB"/> default X.509 certificate for ES384 (SHA384withECDSA NIST P-384 k6)
</select>
<br/>
<textarea name="key2" cols="65" rows="3"></textarea><br/>
<br/>
NOTE: When you sign JWT with your own key, please fill your
own public key or X.509 certificate to verify it.
<br/>
<h2>(Step3) Press 'Verify'.</h2>
<input type="button" value="Verify it!" onClick="_doVerify()"/>
<h2>JWT Header</h2>
<textarea rows="10" cols="10" name="im_head1">
</textarea>
<h2>JWT Payload(Claim)</h2>
<textarea rows="30" cols="10" name="im_payload1">
</textarea>
</form>
</div>
<div data-role="footer">
<h4>© 2013 <a href="https://github.com/kjur">@kjur</a></h4>
</div>
</div>
<!-- page parser -->
<div data-role="page" id="parser">
<div data-role="header">
<h1>JWT parser</h1>
<a href="#top">Back</a>
</div>
<div data-role="content">
This is a sample program just to parse JSON Web Token(JWT).
<form name="form3" id="form3">
<textarea rows="10" cols="10" id="textarea_parse_jws1" name="jws1">eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2p3dC1pZHAuZXhhbXBsZS5jb20iLCJzdWIiOiJtYWlsdG86bWlrZUBleGFtcGxlLmNvbSIsIm5iZiI6MTM3ODI3NTMwMiwiZXhwIjoxMzc4Mjc4OTAyLCJpYXQiOjEzNzgyNzUzMDIsImp0aSI6ImlkMTIzNDU2IiwidHlwIjoiaHR0cHM6Ly9leGFtcGxlLmNvbS9yZWdpc3RlciJ9.fWNOjt3Xa72gc4uqFILE6tdf6TVqtC0Tws2w5rkllb0</textarea>
<input type="button" value="Just Decode JWT" onClick="_doDecode()"/>
<h2>JWT Header</h2>
<textarea rows="10" cols="10" name="im_head1">
</textarea>
<h2>JWT Payload(Claim)</h2>
<textarea rows="30" cols="10" name="im_payload1">
</textarea>
</form>
</div>
<div data-role="footer">
<h4>© 2013 <a href="https://github.com/kjur">@kjur</a></h4>
</div>
</div>
</body>
</html>