-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathjwt_test.go
526 lines (414 loc) · 67 KB
/
jwt_test.go
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
package j8a
import (
"crypto/x509"
"encoding/pem"
"errors"
"fmt"
"github.com/lestrrat-go/jwx/jwa"
"github.com/lestrrat-go/jwx/jwt"
"testing"
"time"
)
func TestLoadRemoteJwksConcurrency(t *testing.T) {
jwt := NewJwt("Testy", "RS256", "", "https://j8a.au.auth0.com/.well-known/jwks.json", "120", "")
before := time.Now()
for i := 0; i < 2; i++ {
jwt.LoadJwks()
}
after := time.Now()
if after.Sub(before) < time.Duration(time.Second*10) {
t.Errorf("Jwks refresh exited too fast, should wait at least 10s")
}
}
func TestLoadRemoteJwksWithBadSkew(t *testing.T) {
cfg := NewJwt("MyJwks", "ES256", "", "https://j8a.au.auth0.com/.well-known/jwks.json", "notnumeric", "")
err := cfg.Validate()
if err == nil {
t.Error("should refuse to load non numeric skew seconds but failed to provide error")
} else {
t.Logf("normal. skew not numeric, msg: %v", err)
}
}
func TestFailJwksKeySetAlg(t *testing.T) {
cfg := NewJwt("MyJwks", "HS256", "", "https://j8a.au.auth0.com/.well-known/jwks.json", "", "")
err := cfg.LoadJwks()
if err == nil {
t.Errorf("expected remote RS256 key to fail HS256 JWKS config but received nil err")
} else {
t.Logf("normal. validation failed with msg %v", err)
}
}
func TestFailJwksBadUrl(t *testing.T) {
cfg := NewJwt("MyJwks", "HS256", "", "https://asldkjflkaj394028094832sjlflalsdkfjsd.com.blah/.well-known/jwks.json", "", "")
err := cfg.LoadJwks()
if err == nil {
t.Errorf("expected remote bad Jwks URL to fail but received nil err")
} else {
t.Logf("normal. validation failed with msg %v", err)
}
}
func TestFindJwtInKeySet(t *testing.T) {
cfg := NewJwt("MyJwks", "RS256", "", "https://j8a.au.auth0.com/.well-known/jwks.json", "", "")
cfg.LoadJwks()
if cfg.RSAPublic == nil {
t.Errorf("RSA key not loaded")
}
key := cfg.RSAPublic.Find("mFtH_0S8dpkKl-rr1T6VS")
if key == nil {
t.Errorf("RSA key not loaded for key id mFtH_0S8dpkKl-rr1T6VS")
}
key2 := cfg.RSAPublic.Find("ZJKp915ThUboHOq79JJsG")
if key2 == nil {
t.Errorf("RSA key 2 not loaded for key id ZJKp915ThUboHOq79JJsG")
}
}
func jwtValErr(t *testing.T, jwt Jwt, want error) {
got := jwt.Validate()
if want != nil {
if got == nil || got.Error() != want.Error() {
t.Errorf("%s key validation error, want [%v], got [%v]", jwt.Alg, want, got)
}
} else {
if got != want {
t.Errorf("%s key validation error, want [%v], got [%v]", jwt.Alg, want, got)
}
}
}
func jwtPass(t *testing.T, alg string, key string) {
jwtValErr(t, *NewJwt("namer", alg, key, "", "120", ""), nil)
}
func jwtBadAlg(t *testing.T, alg string, key string) {
jwt := *NewJwt("namer", alg, key, "", "120", "")
var want = errors.New(fmt.Sprintf(unknownAlg, jwt.Name, alg, validAlg))
jwtValErr(t, jwt, want)
}
func jwtBadKeyPreamble(t *testing.T, alg string, key string) {
jwt := *NewJwt("namer", alg, key, "", "120", "")
var want = errors.New(fmt.Sprintf(pemOverflow, jwt.Name))
jwtValErr(t, jwt, want)
}
func jwtBadKeyAsn1(t *testing.T, alg string, key string) {
jwt := *NewJwt("namer", alg, key, "", "120", "")
var want = errors.New(fmt.Sprintf(pemAsn1Bad, jwt.Name))
jwtValErr(t, jwt, want)
}
func jwtBadKeySize(t *testing.T, alg string, key string, badKeySize int) {
jwt := *NewJwt("namer", alg, key, "", "120", "")
var want = errors.New(fmt.Sprintf(ecdsaKeySizeBad, jwt.Name, jwt.Alg, badKeySize))
jwtValErr(t, jwt, want)
}
func TestJwtNonePass(t *testing.T) {
jwtPass(t, "none", "")
}
func TestJwtNoneFailWithKeyProvided(t *testing.T) {
jwt := *NewJwt("noner", "none", "keydata", "", "120", "")
jwtValErr(t, jwt, errors.New("jwt [noner] none type signature does not allow key data, check your configuration"))
}
func TestJwtFailWithoutNameProvided(t *testing.T) {
jwt := *NewJwt("", "HS256", "keydata", "", "120", "")
jwtValErr(t, jwt, errors.New("invalid jwt name not specified"))
}
func TestJwtRS256Pass(t *testing.T) {
jwtPass(t, "RS256", "-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtXhyIjACJ9I/1RLe6ewu\nBIzZ1275BUssbeUdE87qSNpkJHsn6lNKPUQVix/Hk8MDME6Et1zmyK7a2XoTovME\nLgaHFSpH3i+Eqdl1jG9c0/vkHlwC6Ba+MLxvSCn6HVrcSMMGpOdVHUU4cuqDRpVO\n4owby8e1ZSS1hdhaqs5t464BID7e907oe7hE8deqD9MXmGEimcXXEJTF84wH2xcB\nqUO35dcc5SBJfPAibZ6U2AaNIEZJouUYMJOqwVttTBvKYwhuEwcxsPrYfkufbmGb\n9dnTfKMJamujAwFf+YUwifYfpY763cQ4Ex7eHWVp4LlBB9zYYBBGp2ueLuhJSMWh\nk0yP4KBk8ZDcIgLZKsTzYDdnvbecii7qAxRYMaSEkdjSj2JTmV/GtDBLmkejVNqo\n9s/BvgEIDiPipTWesPKsaNigyhs6p6POJvOHkAAc3+88cfShLuDpobWmNEO6eOAG\nGvACbWs+EOepMrvWuL53QWgJzJaKsxgGejQ1jVCIRZeaVsWiPrJFSUk87lWwxGpR\ncSdvOATlGgjz28jL/CqtuAySGTb4S0LsBFgdpykrGChjbajxeMMjnV3khI4c/KXl\nSmOsxHfJ5vzfbicw1Inn/4RoVxw72p4t1NN3va1W6jZt/FZ5R8xgV5T5zgeAEkSm\nHJa/PXCQoBYwK7cuMJhjRaMCAwEAAQ==\n-----END PUBLIC KEY-----\n")
}
func TestJwtRS256PassFromX509(t *testing.T) {
jwtPass(t, "RS256", "-----BEGIN CERTIFICATE-----\nMIIEajCCAlICAhAFMA0GCSqGSIb3DQEBCwUAMHYxCzAJBgNVBAYTAkFVMQwwCgYD\nVQQIDANOU1cxDTALBgNVBAoMBG15Y2ExGjAYBgNVBAsMEW15Y2EgaW50ZX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IICCgKCAgEAtXhyIjACJ9I/1RLe6ewu\nBIzZ1275BUssbeUdE87qSNpkJHsn6lNKPUQVix/Hk8MDME6Et1zmyK7a2XoTovME\nLgaHFSpH3i+Eqdl1jG9c0/vkHlwC6Ba+MLxvSCn6HVrcSMMGpOdVHUU4cuqDRpVO\n4owby8e1ZSS1hdhaqs5t464BID7e907oe7hE8deqD9MXmGEimcXXEJTF84wH2xcB\nqUO35dcc5SBJfPAibZ6U2AaNIEZJouUYMJOqwVttTBvKYwhuEwcxsPrYfkufbmGb\n9dnTfKMJamujAwFf+YUwifYfpY763cQ4Ex7eHWVp4LlBB9zYYBBGp2ueLuhJSMWh\nk0yP4KBk8ZDcIgLZKsTzYDdnvbecii7qAxRYMaSEkdjSj2JTmV/GtDBLmkejVNqo\n9s/BvgEIDiPipTWesPKsaNigyhs6p6POJvOHkAAc3+88cfShLuDpobWmNEO6eOAG\nGvACbWs+EOepMrvWuL53QWgJzJaKsxgGejQ1jVCIRZeaVsWiPrJFSUk87lWwxGpR\ncSdvOATlGgjz28jL/CqtuAySGTb4S0LsBFgdpykrGChjbajxeMMjnV3khI4c/KXl\nSmOsxHfJ5vzfbicw1Inn/4RoVxw72p4t1NN3va1W6jZt/FZ5R8xgV5T5zgeAEkSm\nHJa/PXCQoBYwK7cuMJhjRaMCAwEAAQ==\n-----END PUBLIC KEY-----\n")
}
func TestJwtRS256BadKeyPreamble(t *testing.T) {
jwtBadKeyPreamble(t, "RS256", "-----NOT PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtXhyIjACJ9I/1RLe6ewu\nBIzZ1275BUssbeUdE87qSNpkJHsn6lNKPUQVix/Hk8MDME6Et1zmyK7a2XoTovME\nLgaHFSpH3i+Eqdl1jG9c0/vkHlwC6Ba+MLxvSCn6HVrcSMMGpOdVHUU4cuqDRpVO\n4owby8e1ZSS1hdhaqs5t464BID7e907oe7hE8deqD9MXmGEimcXXEJTF84wH2xcB\nqUO35dcc5SBJfPAibZ6U2AaNIEZJouUYMJOqwVttTBvKYwhuEwcxsPrYfkufbmGb\n9dnTfKMJamujAwFf+YUwifYfpY763cQ4Ex7eHWVp4LlBB9zYYBBGp2ueLuhJSMWh\nk0yP4KBk8ZDcIgLZKsTzYDdnvbecii7qAxRYMaSEkdjSj2JTmV/GtDBLmkejVNqo\n9s/BvgEIDiPipTWesPKsaNigyhs6p6POJvOHkAAc3+88cfShLuDpobWmNEO6eOAG\nGvACbWs+EOepMrvWuL53QWgJzJaKsxgGejQ1jVCIRZeaVsWiPrJFSUk87lWwxGpR\ncSdvOATlGgjz28jL/CqtuAySGTb4S0LsBFgdpykrGChjbajxeMMjnV3khI4c/KXl\nSmOsxHfJ5vzfbicw1Inn/4RoVxw72p4t1NN3va1W6jZt/FZ5R8xgV5T5zgeAEkSm\nHJa/PXCQoBYwK7cuMJhjRaMCAwEAAQ==\n-----END PUBLIC KEY-----\n")
}
func TestJwtRS256BadAsn1(t *testing.T) {
jwtBadKeyAsn1(t, "RS256", "-----BEGIN PUBLIC KEY-----\nCCCCCCQEFAAOCAg81111111111111111111AMIICCgKCAgEAtXhyIjACJ9I/1RLe6ewu\nBIzZ1275BUssbeUdE87qSNpkJHsn6lNKPUQVix/Hk8MDME6Et1zmyK7a2XoTovME\nLgaHFSpH3i+Eqdl1jG9c0/vkHlwC6Ba+MLxvSCn6HVrcSMMGpOdVHUU4cuqDRpVO\n4owby8e1ZSS1hdhaqs5t464BID7e907oe7hE8deqD9MXmGEimcXXEJTF84wH2xcB\nqUO35dcc5SBJfPAibZ6U2AaNIEZJouUYMJOqwVttTBvKYwhuEwcxsPrYfkufbmGb\n9dnTfKMJamujAwFf+YUwifYfpY763cQ4Ex7eHWVp4LlBB9zYYBBGp2ueLuhJSMWh\nk0yP4KBk8ZDcIgLZKsTzYDdnvbecii7qAxRYMaSEkdjSj2JTmV/GtDBLmkejVNqo\n9s/BvgEIDiPipTWesPKsaNigyhs6p6POJvOHkAAc3+88cfShLu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==\n-----END PUBLIC KEY-----\n")
}
func TestJwtRS384BadAlg(t *testing.T) {
jwtBadAlg(t, "RS385", "-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtXhyIjACJ9I/1RLe6ewu\nBIzZ1275BUssbeUdE87qSNpkJHsn6lNKPUQVix/Hk8MDME6Et1zmyK7a2XoTovME\nLgaHFSpH3i+Eqdl1jG9c0/vkHlwC6Ba+MLxvSCn6HVrcSMMGpOdVHUU4cuqDRpVO\n4owby8e1ZSS1hdhaqs5t464BID7e907oe7hE8deqD9MXmGEimcXXEJTF84wH2xcB\nqUO35dcc5SBJfPAibZ6U2AaNIEZJouUYMJOqwVttTBvKYwhuEwcxsPrYfkufbmGb\n9dnTfKMJamujAwFf+YUwifYfpY763cQ4Ex7eHWVp4LlBB9zYYBBGp2ueLuhJSMWh\nk0yP4KBk8ZDcIgLZKsTzYDdnvbecii7qAxRYMaSEkdjSj2JTmV/GtDBLmkejVNqo\n9s/BvgEIDiPipTWesPKsaNigyhs6p6POJvOHkAAc3+88cfShLuDpobWmNEO6eOAG\nGvACbWs+EOepMrvWuL53QWgJzJaKsxgGejQ1jVCIRZeaVsWiPrJFSUk87lWwxGpR\ncSdvOATlGgjz28jL/CqtuAySGTb4S0LsBFgdpykrGChjbajxeMMjnV3khI4c/KXl\nSmOsxHfJ5vzfbicw1Inn/4RoVxw72p4t1NN3va1W6jZt/FZ5R8xgV5T5zgeAEkSm\nHJa/PXCQoBYwK7cuMJhjRaMCAwEAAQ==\n-----END PUBLIC KEY-----\n")
}
func TestJwtRS384BadKeyPreamble(t *testing.T) {
jwtBadKeyPreamble(t, "RS384", "-----NOT PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtXhyIjACJ9I/1RLe6ewu\nBIzZ1275BUssbeUdE87qSNpkJHsn6lNKPUQVix/Hk8MDME6Et1zmyK7a2XoTovME\nLgaHFSpH3i+Eqdl1jG9c0/vkHlwC6Ba+MLxvSCn6HVrcSMMGpOdVHUU4cuqDRpVO\n4owby8e1ZSS1hdhaqs5t464BID7e907oe7hE8deqD9MXmGEimcXXEJTF84wH2xcB\nqUO35dcc5SBJfPAibZ6U2AaNIEZJouUYMJOqwVttTBvKYwhuEwcxsPrYfkufbmGb\n9dnTfKMJamujAwFf+YUwifYfpY763cQ4Ex7eHWVp4LlBB9zYYBBGp2ueLuhJSMWh\nk0yP4KBk8ZDcIgLZKsTzYDdnvbecii7qAxRYMaSEkdjSj2JTmV/GtDBLmkejVNqo\n9s/BvgEIDiPipTWesPKsaNigyhs6p6POJvOHkAAc3+88cfShLuDpobWmNEO6eOAG\nGvACbWs+EOepMrvWuL53QWgJzJaKsxgGejQ1jVCIRZeaVsWiPrJFSUk87lWwxGpR\ncSdvOATlGgjz28jL/CqtuAySGTb4S0LsBFgdpykrGChjbajxeMMjnV3khI4c/KXl\nSmOsxHfJ5vzfbicw1Inn/4RoVxw72p4t1NN3va1W6jZt/FZ5R8xgV5T5zgeAEkSm\nHJa/PXCQoBYwK7cuMJhjRaMCAwEAAQ==\n-----END PUBLIC KEY-----\n")
}
func TestJwtRS384BadAsn1(t *testing.T) {
jwtBadKeyAsn1(t, "RS384", "-----BEGIN PUBLIC KEY-----\nCCCCCCQEFAAOCAg81111111111111111111AMIICCgKCAgEAtXhyIjACJ9I/1RLe6ewu\nBIzZ1275BUssbeUdE87qSNpkJHsn6lNKPUQVix/Hk8MDME6Et1zmyK7a2XoTovME\nLgaHFSpH3i+Eqdl1jG9c0/vkHlwC6Ba+MLxvSCn6HVrcSMMGpOdVHUU4cuqDRpVO\n4owby8e1ZSS1hdhaqs5t464BID7e907oe7hE8deqD9MXmGEimcXXEJTF84wH2xcB\nqUO35dcc5SBJfPAibZ6U2AaNIEZJouUYMJOqwVttTBvKYwhuEwcxsPrYfkufbmGb\n9dnTfKMJamujAwFf+YUwifYfpY763cQ4Ex7eHWVp4LlBB9zYYBBGp2ueLuhJSMWh\nk0yP4KBk8ZDcIgLZKsTzYDdnvbecii7qAxRYMaSEkdjSj2JTmV/GtDBLmkejVNqo\n9s/BvgEIDiPipTWesPKsaNigyhs6p6POJvOHkAAc3+88cfShLuDpobWmNEO6eOAG\nGvACbWs+EOepMrvWuL53QWgJzJaKsxgGejQ1jVCIRZeaVsWiPrJFSUk87lWwxGpR\ncSdvOATlGgjz28jL/CqtuAySGTb4S0LsBFgdpykrGChjbajxeMMjnV3khI4c/KXl\nSmOsxHfJ5vzfbicw1Inn/4RoVxw72p4t1NN3va1W6jZt/FZ5R8xgV5T5zgeAEkSm\nHJa/PXCQoBYwK7cuMJhjRaMCAwEAAQ==\n-----END PUBLIC KEY-----\n")
}
func TestJwtRS512Pass(t *testing.T) {
jwtPass(t, "RS512", "-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtXhyIjACJ9I/1RLe6ewu\nBIzZ1275BUssbeUdE87qSNpkJHsn6lNKPUQVix/Hk8MDME6Et1zmyK7a2XoTovME\nLgaHFSpH3i+Eqdl1jG9c0/vkHlwC6Ba+MLxvSCn6HVrcSMMGpOdVHUU4cuqDRpVO\n4owby8e1ZSS1hdhaqs5t464BID7e907oe7hE8deqD9MXmGEimcXXEJTF84wH2xcB\nqUO35dcc5SBJfPAibZ6U2AaNIEZJouUYMJOqwVttTBvKYwhuEwcxsPrYfkufbmGb\n9dnTfKMJamujAwFf+YUwifYfpY763cQ4Ex7eHWVp4LlBB9zYYBBGp2ueLuhJSMWh\nk0yP4KBk8ZDcIgLZKsTzYDdnvbecii7qAxRYMaSEkdjSj2JTmV/GtDBLmkejVNqo\n9s/BvgEIDiPipTWesPKsaNigyhs6p6POJvOHkAAc3+88cfShLuDpobWmNEO6eOAG\nGvACbWs+EOepMrvWuL53QWgJzJaKsxgGejQ1jVCIRZeaVsWiPrJFSUk87lWwxGpR\ncSdvOATlGgjz28jL/CqtuAySGTb4S0LsBFgdpykrGChjbajxeMMjnV3khI4c/KXl\nSmOsxHfJ5vzfbicw1Inn/4RoVxw72p4t1NN3va1W6jZt/FZ5R8xgV5T5zgeAEkSm\nHJa/PXCQoBYwK7cuMJhjRaMCAwEAAQ==\n-----END PUBLIC KEY-----\n")
}
func TestJwtRS512BadAlg(t *testing.T) {
jwtBadAlg(t, "RS513", "-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtXhyIjACJ9I/1RLe6ewu\nBIzZ1275BUssbeUdE87qSNpkJHsn6lNKPUQVix/Hk8MDME6Et1zmyK7a2XoTovME\nLgaHFSpH3i+Eqdl1jG9c0/vkHlwC6Ba+MLxvSCn6HVrcSMMGpOdVHUU4cuqDRpVO\n4owby8e1ZSS1hdhaqs5t464BID7e907oe7hE8deqD9MXmGEimcXXEJTF84wH2xcB\nqUO35dcc5SBJfPAibZ6U2AaNIEZJouUYMJOqwVttTBvKYwhuEwcxsPrYfkufbmGb\n9dnTfKMJamujAwFf+YUwifYfpY763cQ4Ex7eHWVp4LlBB9zYYBBGp2ueLuhJSMWh\nk0yP4KBk8ZDcIgLZKsTzYDdnvbecii7qAxRYMaSEkdjSj2JTmV/GtDBLmkejVNqo\n9s/BvgEIDiPipTWesPKsaNigyhs6p6POJvOHkAAc3+88cfShLuDpobWmNEO6eOAG\nGvACbWs+EOepMrvWuL53QWgJzJaKsxgGejQ1jVCIRZeaVsWiPrJFSUk87lWwxGpR\ncSdvOATlGgjz28jL/CqtuAySGTb4S0LsBFgdpykrGChjbajxeMMjnV3khI4c/KXl\nSmOsxHfJ5vzfbicw1Inn/4RoVxw72p4t1NN3va1W6jZt/FZ5R8xgV5T5zgeAEkSm\nHJa/PXCQoBYwK7cuMJhjRaMCAwEAAQ==\n-----END PUBLIC KEY-----\n")
}
func TestJwtRS512BadKeyPreamble(t *testing.T) {
jwtBadKeyPreamble(t, "RS512", "-----NOT PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtXhyIjACJ9I/1RLe6ewu\nBIzZ1275BUssbeUdE87qSNpkJHsn6lNKPUQVix/Hk8MDME6Et1zmyK7a2XoTovME\nLgaHFSpH3i+Eqdl1jG9c0/vkHlwC6Ba+MLxvSCn6HVrcSMMGpOdVHUU4cuqDRpVO\n4owby8e1ZSS1hdhaqs5t464BID7e907oe7hE8deqD9MXmGEimcXXEJTF84wH2xcB\nqUO35dcc5SBJfPAibZ6U2AaNIEZJouUYMJOqwVttTBvKYwhuEwcxsPrYfkufbmGb\n9dnTfKMJamujAwFf+YUwifYfpY763cQ4Ex7eHWVp4LlBB9zYYBBGp2ueLuhJSMWh\nk0yP4KBk8ZDcIgLZKsTzYDdnvbecii7qAxRYMaSEkdjSj2JTmV/GtDBLmkejVNqo\n9s/BvgEIDiPipTWesPKsaNigyhs6p6POJvOHkAAc3+88cfShLuDpobWmNEO6eOAG\nGvACbWs+EOepMrvWuL53QWgJzJaKsxgGejQ1jVCIRZeaVsWiPrJFSUk87lWwxGpR\ncSdvOATlGgjz28jL/CqtuAySGTb4S0LsBFgdpykrGChjbajxeMMjnV3khI4c/KXl\nSmOsxHfJ5vzfbicw1Inn/4RoVxw72p4t1NN3va1W6jZt/FZ5R8xgV5T5zgeAEkSm\nHJa/PXCQoBYwK7cuMJhjRaMCAwEAAQ==\n-----END PUBLIC KEY-----\n")
}
func TestJwtRS512BadAsn1(t *testing.T) {
jwtBadKeyAsn1(t, "RS512", "-----BEGIN PUBLIC KEY-----\nCCCCCCQEFAAOCAg81111111111111111111AMIICCgKCAgEAtXhyIjACJ9I/1RLe6ewu\nBIzZ1275BUssbeUdE87qSNpkJHsn6lNKPUQVix/Hk8MDME6Et1zmyK7a2XoTovME\nLgaHFSpH3i+Eqdl1jG9c0/vkHlwC6Ba+MLxvSCn6HVrcSMMGpOdVHUU4cuqDRpVO\n4owby8e1ZSS1hdhaqs5t464BID7e907oe7hE8deqD9MXmGEimcXXEJTF84wH2xcB\nqUO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AQ==\n-----END PUBLIC KEY-----\n")
}
func TestJwtPS256BadKeyPreamble(t *testing.T) {
jwtBadKeyPreamble(t, "PS256", "-----NOT PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtXhyIjACJ9I/1RLe6ewu\nBIzZ1275BUssbeUdE87qSNpkJHsn6lNKPUQVix/Hk8MDME6Et1zmyK7a2XoTovME\nLgaHFSpH3i+Eqdl1jG9c0/vkHlwC6Ba+MLxvSCn6HVrcSMMGpOdVHUU4cuqDRpVO\n4owby8e1ZSS1hdhaqs5t464BID7e907oe7hE8deqD9MXmGEimcXXEJTF84wH2xcB\nqUO35dcc5SBJfPAibZ6U2AaNIEZJouUYMJOqwVttTBvKYwhuEwcxsPrYfkufbmGb\n9dnTfKMJamujAwFf+YUwifYfpY763cQ4Ex7eHWVp4LlBB9zYYBBGp2ueLuhJSMWh\nk0yP4KBk8ZDcIgLZKsTzYDdnvbecii7qAxRYMaSEkdjSj2JTmV/GtDBLmkejVNqo\n9s/BvgEIDiPipTWesPKsaNigyhs6p6POJvOHkAAc3+88cfShLuDpobWmNEO6eOAG\nGvACbWs+EOepMrvWuL53QWgJzJaKsxgGejQ1jVCIRZeaVsWiPrJFSUk87lWwxGpR\ncSdvOATlGgjz28jL/CqtuAySGTb4S0LsBFgdpykrGChjbajxeMMjnV3khI4c/KXl\nSmOsxHfJ5vzfbicw1Inn/4RoVxw72p4t1NN3va1W6jZt/FZ5R8xgV5T5zgeAEkSm\nHJa/PXCQoBYwK7cuMJhjRaMCAwEAAQ==\n-----END PUBLIC KEY-----\n")
}
func TestJwtPS256BadAsn1(t *testing.T) {
jwtBadKeyAsn1(t, "PS256", "-----BEGIN PUBLIC KEY-----\nCCCCCCQEFAAOCAg81111111111111111111AMIICCgKCAgEAtXhyIjACJ9I/1RLe6ewu\nBIzZ1275BUssbeUdE87qSNpkJHsn6lNKPUQVix/Hk8MDME6Et1zmyK7a2XoTovME\nLgaHFSpH3i+E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ChjbajxeMMjnV3khI4c/KXl\nSmOsxHfJ5vzfbicw1Inn/4RoVxw72p4t1NN3va1W6jZt/FZ5R8xgV5T5zgeAEkSm\nHJa/PXCQoBYwK7cuMJhjRaMCAwEAAQ==\n-----END PUBLIC KEY-----\n")
}
func TestJwtPS384BadKeyPreamble(t *testing.T) {
jwtBadKeyPreamble(t, "PS384", "-----NOT PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtXhyIjACJ9I/1RLe6ewu\nBIzZ1275BUssbeUdE87qSNpkJHsn6lNKPUQVix/Hk8MDME6Et1zmyK7a2XoTovME\nLgaHFSpH3i+Eqdl1jG9c0/vkHlwC6Ba+MLxvSCn6HVrcSMMGpOdVHUU4cuqDRpVO\n4owby8e1ZSS1hdhaqs5t464BID7e907oe7hE8deqD9MXmGEimcXXEJTF84wH2xcB\nqUO35dcc5SBJfPAibZ6U2AaNIEZJouUYMJOqwVttTBvKYwhuEwcxsPrYfkufbmGb\n9dnTfKMJamujAwFf+YUwifYfpY763cQ4Ex7eHWVp4LlBB9zYYBBGp2ueLuhJSMWh\nk0yP4KBk8ZDcIgLZKsTzYDdnvbecii7qAxRYMaSEkdjSj2JTmV/GtDBLmkejVNqo\n9s/BvgEIDiPipTWesPKsaNigyhs6p6POJvOHkAAc3+88cfShLuDpobWmNEO6eOAG\nGvACbWs+EOepMrvWuL53QWgJzJaKsxgGejQ1jVCIRZeaVsWiPrJFSUk87lWwxGpR\ncSdvOATlGgjz28jL/CqtuAySGTb4S0LsBFgdpykrGChjbajxeMMjnV3khI4c/KXl\nSmOsxHfJ5vzfbicw1Inn/4RoVxw72p4t1NN3va1W6jZt/FZ5R8xgV5T5zgeAEkSm\nHJa/PXCQoBYwK7cuMJhjRaMCAwEAAQ==\n-----END PUBLIC KEY-----\n")
}
func TestJwtPS384BadAsn1(t *testing.T) {
jwtBadKeyAsn1(t, "PS384", "-----BEGIN PUBLIC KEY-----\nCCCCCCQEFAAOCAg81111111111111111111AMIICCgKCAgEAtXhyIjACJ9I/1RLe6ewu\nBIzZ1275BUssbeUdE87qSNpkJHsn6lNKPUQVix/Hk8MDME6Et1zmyK7a2XoTovME\nLgaHFSpH3i+Eqdl1jG9c0/vkHlwC6Ba+MLxvSCn6HVrcSMMGpOdVHUU4cuqDRpVO\n4owby8e1ZSS1hdhaqs5t464BID7e907oe7hE8deqD9MXmGEimcXXEJTF84wH2xcB\nqUO35dcc5SBJfPAibZ6U2AaNIEZJouUYMJOqwVttTBvKYwhuEwcxsPrYfkufbmGb\n9dnTfKMJamujAwFf+YUwifYfpY763cQ4Ex7eHWVp4LlBB9zYYBBGp2ueLuhJSMWh\nk0yP4KBk8ZDcIgLZKsTzYDdnvbecii7qAxRYMaSEkdjSj2JTmV/GtDBLmkejVNqo\n9s/BvgEIDiPipTWesPKsaNigyhs6p6POJvOHkAAc3+88cfShLuDpobWmNEO6eOAG\nGvACbWs+EOepMrvWuL53QWgJzJaKsxgGejQ1jVCIRZeaVsWiPrJFSUk87lWwxGpR\ncSdvOATlGgjz28jL/CqtuAySGTb4S0LsBFgdpykrGChjbajxeMMjnV3khI4c/KXl\nSmOsxHfJ5vzfbicw1Inn/4RoVxw72p4t1NN3va1W6jZt/FZ5R8xgV5T5zgeAEkSm\nHJa/PXCQoBYwK7cuMJhjRaMCAwEAAQ==\n-----END PUBLIC KEY-----\n")
}
func TestJwtPS512Pass(t *testing.T) {
jwtPass(t, "PS512", "-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtXhyIjACJ9I/1RLe6ewu\nBIzZ1275BUssbeUdE87qSNpkJHsn6lNKPUQVix/Hk8MDME6Et1zmyK7a2XoTovME\nLgaHFSpH3i+Eqdl1jG9c0/vkHlwC6Ba+MLxvSCn6HVrcSMMGpOdVHUU4cuqDRpVO\n4owby8e1ZSS1hdhaqs5t464BID7e907oe7hE8deqD9MXmGEimcXXEJTF84wH2xcB\nqUO35d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uDpobWmNEO6eOAG\nGvACbWs+EOepMrvWuL53QWgJzJaKsxgGejQ1jVCIRZeaVsWiPrJFSUk87lWwxGpR\ncSdvOATlGgjz28jL/CqtuAySGTb4S0LsBFgdpykrGChjbajxeMMjnV3khI4c/KXl\nSmOsxHfJ5vzfbicw1Inn/4RoVxw72p4t1NN3va1W6jZt/FZ5R8xgV5T5zgeAEkSm\nHJa/PXCQoBYwK7cuMJhjRaMCAwEAAQ==\n-----END PUBLIC KEY-----\n")
}
func TestJwtPS512BadKeyPreamble(t *testing.T) {
jwtBadKeyPreamble(t, "PS512", "-----NOT PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtXhyIjACJ9I/1RLe6ewu\nBIzZ1275BUssbeUdE87qSNpkJHsn6lNKPUQVix/Hk8MDME6Et1zmyK7a2XoTovME\nLgaHFSpH3i+Eqdl1jG9c0/vkHlwC6Ba+MLxvSCn6HVrcSMMGpOdVHUU4cuqDRpVO\n4owby8e1ZSS1hdhaqs5t464BID7e907oe7hE8deqD9MXmGEimcXXEJTF84wH2xcB\nqUO35dcc5SBJfPAibZ6U2AaNIEZJouUYMJOqwVttTBvKYwhuEwcxsPrYfkufbmGb\n9dnTfKMJamujAwFf+YUwifYfpY763cQ4Ex7eHWVp4LlBB9zYYBBGp2ueLuhJSMWh\nk0yP4KBk8ZDcIgLZKsTzYDdnvbecii7qAxRYMaSEkdjSj2JTmV/GtDBLmkejVNqo\n9s/BvgEIDiPipTWesPKsaNigyhs6p6POJvOHkAAc3+88cfShLuDpobWmNEO6eOAG\nGvACbWs+EOepMrvWuL53QWgJzJaKsxgGejQ1jVCIRZeaVsWiPrJFSUk87lWwxGpR\ncSdvOATlGgjz28jL/CqtuAySGTb4S0LsBFgdpykrGChjbajxeMMjnV3khI4c/KXl\nSmOsxHfJ5vzfbicw1Inn/4RoVxw72p4t1NN3va1W6jZt/FZ5R8xgV5T5zgeAEkSm\nHJa/PXCQoBYwK7cuMJhjRaMCAwEAAQ==\n-----END PUBLIC KEY-----\n")
}
func TestJwtPS512BadAsn1(t *testing.T) {
jwtBadKeyAsn1(t, "PS512", "-----BEGIN PUBLIC KEY-----\nCCCCCCQEFAAOCAg81111111111111111111AMIICCgKCAgEAtXhyIjACJ9I/1RLe6ewu\nBIzZ1275BUssbeUdE87qSNpkJHsn6lNKPUQVix/Hk8MDME6Et1zmyK7a2XoTovME\nLgaHFSpH3i+Eqdl1jG9c0/vkHlwC6Ba+MLxvSCn6HVrcSMMGpOdVHUU4cuqDRpVO\n4owby8e1ZSS1hdhaqs5t464BID7e907oe7hE8deqD9MXmGEimcXXEJTF84wH2xcB\nqUO35dcc5SBJfPAibZ6U2AaNIEZJouUYMJOqwVttTBvKYwhuEwcxsPrYfkufbmGb\n9dnTfKMJamujAwFf+YUwifYfpY763cQ4Ex7eHWVp4LlBB9zYYBBGp2ueLuhJSMWh\nk0yP4KBk8ZDcIgLZKsTzYDdnvbecii7qAxRYMaSEkdjSj2JTmV/GtDBLmkejVNqo\n9s/BvgEIDiPipTWesPKsaNigyhs6p6POJvOHkAAc3+88cfShLuDpobWmNEO6eOAG\nGvACbWs+EOepMrvWuL53QWgJzJaKsxgGejQ1jVCIRZeaVsWiPrJFSUk87lWwxGpR\ncSdvOATlGgjz28jL/CqtuAySGTb4S0LsBFgdpykrGChjbajxeMMjnV3khI4c/KXl\nSmOsxHfJ5vzfbicw1Inn/4RoVxw72p4t1NN3va1W6jZt/FZ5R8xgV5T5zgeAEkSm\nHJa/PXCQoBYwK7cuMJhjRaMCAwEAAQ==\n-----END PUBLIC KEY-----\n")
}
func TestJwtES256Pass(t *testing.T) {
jwtPass(t, "ES256", "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEQQwrEUWQle75mz/T+wt4fXoAn39M\ngmCdZ3ZY3fXIkqQDOOq2JJ3x6Rayy1GTp7nlN88JqxX8UC71LdmbIyKi6g==\n-----END PUBLIC KEY-----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yx2jo53UwMs85+fgZA/lUdcoCZ/j7iaDHkl\nGhE8OhPeHjzye98VZrs5IcTaZ3aBpE3atvvgzzb5xj+CwEdd07aRFdJ8Jez4u57x\nXH36omDUE8zHn2Lfr44e9AsszAprhqLdyRw3y1q7KMysxxLBmLibe7Km4rfYE0wN\nLCnSjaiXdZovOQNjNV+yPKhykWNw5mlWo9XcPcWx7hrl3ik380yK1cD6edrTev9R\nGGmbVgYfVXunvFC4w+xEgQzLA9Dc/hus/9GO+trwbVjRSoWEi4HUE2rF0eYpLk0m\nzvlvL0+JjVXDuWC3FBgAJwBLbEdrtD4dQeU8N88MZ9WWTBR6TwOvFvO7dVwJCDk0\nThlD/f2RD14vsjHstAU87OL+NTHBefIBXT6J1Ev+HIhpKjyt7zhkHcfxTVzxP2cJ\nk4n8HSUsx52ggLafcK5V+zkGa2uKLNWru5w/pVqrjWV4goWe6k6ZPahzp5riNIlP\nnhD2IZz+y8r7ognXs6+EjYqEJknm/4cMbWudBFz87w36w6gNwiHvW1Q8bkVJ65We\nAWKuTQnosA==\n-----END CERTIFICATE-----\n")
}
func TestJwtES256BadAlg(t *testing.T) {
jwtBadAlg(t, "ES257", "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEQQwrEUWQle75mz/T+wt4fXoAn39M\ngmCdZ3ZY3fXIkqQDOOq2JJ3x6Rayy1GTp7nlN88JqxX8UC71LdmbIyKi6g==\n-----END PUBLIC KEY-----\n")
}
func TestJwtES256BadKeyPreamble(t *testing.T) {
jwtBadKeyPreamble(t, "ES256", "-----BEGIN NOT SO PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEQQwrEUWQle75mz/T+wt4fXoAn39M\ngmCdZ3ZY3fXIkqQDOOq2JJ3x6Rayy1GTp7nlN88JqxX8UC71LdmbIyKi6g==\n-----END PUBLIC KEY-----\n")
}
func TestJwtES256BadAsn1(t *testing.T) {
jwtBadKeyAsn1(t, "ES256", "-----BEGIN PUBLIC KEY-----\nCCCCCCQEFAAOCAg81111111111111111111AMIICCgKCAgEAtXhyIjACJ9I/1RLe6ewu\nBIzZ1275BUssbeUdE87qSNpkJHsn6lNKPUQVix/Hk8MDME6Et1zmyK7a2XoTovME\nLgaHFSpH3i+Eqdl1jG9c0/vkHlwC6Ba+MLxvSCn6HVrcSMMGpOdVHUU4cuqDRpVO\n4owby8e1ZSS1hdhaqs5t464BID7e907oe7hE8deqD9MXmGEimcXXEJTF84wH2xcB\nqUO35dcc5SBJfPAibZ6U2AaNIEZJouUYMJOqwVttTBvKYwhuEwcxsPrYfkufbmGb\n9dnTfKMJamujAwFf+YUwifYfpY763cQ4Ex7eHWVp4LlBB9zYYBBGp2ueLuhJSMWh\nk0yP4KBk8ZDcIgLZKsTzYDdnvbecii7qAxRYMaSEkdjSj2JTmV/GtDBLmkejVNqo\n9s/BvgEIDiPipTWesPKsaNigyhs6p6POJvOHkAAc3+88cfShLuDpobWmNEO6eOAG\nGvACbWs+EOepMrvWuL53QWgJzJaKsxgGejQ1jVCIRZeaVsWiPrJFSUk87lWwxGpR\ncSdvOATlGgjz28jL/CqtuAySGTb4S0LsBFgdpykrGChjbajxeMMjnV3khI4c/KXl\nSmOsxHfJ5vzfbicw1Inn/4RoVxw72p4t1NN3va1W6jZt/FZ5R8xgV5T5zgeAEkSm\nHJa/PXCQoBYwK7cuMJhjRaMCAwEAAQ==\n-----END PUBLIC KEY-----\n")
}
func TestJwtES256BadKeySize(t *testing.T) {
jwtBadKeySize(t, "ES256", "-----BEGIN PUBLIC KEY-----\nMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEbzpBvrm4YDC8/AWuFNylOeApmVi0NpiR\nI4tQOE0y5bm7zjwjr/nvwKreCF0mT0NivYOzQfu6D5Wy1Jpgm0ebMDljSKEGkZwC\nP2/jogu9YzmaAnV/Re16ffln/n+tsATG\n-----END PUBLIC KEY-----\n", 384)
}
func TestJwtES384Pass(t *testing.T) {
jwtPass(t, "ES384", "-----BEGIN PUBLIC KEY-----\nMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEbzpBvrm4YDC8/AWuFNylOeApmVi0NpiR\nI4tQOE0y5bm7zjwjr/nvwKreCF0mT0NivYOzQfu6D5Wy1Jpgm0ebMDljSKEGkZwC\nP2/jogu9YzmaAnV/Re16ffln/n+tsATG\n-----END PUBLIC KEY-----")
}
func TestJwtES384BadAlg(t *testing.T) {
jwtBadAlg(t, "ES385", "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEQQwrEUWQle75mz/T+wt4fXoAn39M\ngmCdZ3ZY3fXIkqQDOOq2JJ3x6Rayy1GTp7nlN88JqxX8UC71LdmbIyKi6g==\n-----END PUBLIC KEY-----\n")
}
func TestJwtES384BadKeyPreamble(t *testing.T) {
jwtBadKeyPreamble(t, "ES384", "-----BEGIN NOT SO PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEQQwrEUWQle75mz/T+wt4fXoAn39M\ngmCdZ3ZY3fXIkqQDOOq2JJ3x6Rayy1GTp7nlN88JqxX8UC71LdmbIyKi6g==\n-----END PUBLIC KEY-----\n")
}
func TestJwtES384BadAsn1(t *testing.T) {
jwtBadKeyAsn1(t, "ES384", "-----BEGIN PUBLIC KEY-----\nCCCCCCQEFAAOCAg81111111111111111111AMIICCgKCAgEAtXhyIjACJ9I/1RLe6ewu\nBIzZ1275BUssbeUdE87qSNpkJHsn6lNKPUQVix/Hk8MDME6Et1zmyK7a2XoTovME\nLgaHFSpH3i+Eqdl1jG9c0/vkHlwC6Ba+MLxvSCn6HVrcSMMGpOdVHUU4cuqDRpVO\n4owby8e1ZSS1hdhaqs5t464BID7e907oe7hE8deqD9MXmGEimcXXEJTF84wH2xcB\nqUO35dcc5SBJfPAibZ6U2AaNIEZJouUYMJOqwVttTBvKYwhuEwcxsPrYfkufbmGb\n9dnTfKMJamujAwFf+YUwifYfpY763cQ4Ex7eHWVp4LlBB9zYYBBGp2ueLuhJSMWh\nk0yP4KBk8ZDcIgLZKsTzYDdnvbecii7qAxRYMaSEkdjSj2JTmV/GtDBLmkejVNqo\n9s/BvgEIDiPipTWesPKsaNigyhs6p6POJvOHkAAc3+88cfShLuDpobWmNEO6eOAG\nGvACbWs+EOepMrvWuL53QWgJzJaKsxgGejQ1jVCIRZeaVsWiPrJFSUk87lWwxGpR\ncSdvOATlGgjz28jL/CqtuAySGTb4S0LsBFgdpykrGChjbajxeMMjnV3khI4c/KXl\nSmOsxHfJ5vzfbicw1Inn/4RoVxw72p4t1NN3va1W6jZt/FZ5R8xgV5T5zgeAEkSm\nHJa/PXCQoBYwK7cuMJhjRaMCAwEAAQ==\n-----END PUBLIC KEY-----\n")
}
func TestJwtES384BadKeySize(t *testing.T) {
jwtBadKeySize(t, "ES384", "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEQQwrEUWQle75mz/T+wt4fXoAn39M\ngmCdZ3ZY3fXIkqQDOOq2JJ3x6Rayy1GTp7nlN88JqxX8UC71LdmbIyKi6g==\n-----END PUBLIC KEY-----\n", 256)
}
func TestJwtES512Pass(t *testing.T) {
jwtPass(t, "ES512", "-----BEGIN PUBLIC KEY-----\nMIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQAuObw6RyorEJfB+UUgkJcmfdIlLuK\nwO6KFjHF8u5+OPpHNZuq203djMAp07caPZsuEg2M0WIjdm10LefJhnepq/8B1AZT\nI/Kr/XahLw9Wn9/TDWXgLwaPnPk6jnzlkVFpts4mcvS2/ec/yBoPViHZ98sMwOoS\njTrSpJkw0BIo5qQSuGk=\n-----END PUBLIC KEY-----\n")
}
func TestJwtES512BadAlg(t *testing.T) {
jwtBadAlg(t, "ES513", "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEQQwrEUWQle75mz/T+wt4fXoAn39M\ngmCdZ3ZY3fXIkqQDOOq2JJ3x6Rayy1GTp7nlN88JqxX8UC71LdmbIyKi6g==\n-----END PUBLIC KEY-----\n")
}
func TestJwtES512BadKeyPreamble(t *testing.T) {
jwtBadKeyPreamble(t, "ES512", "-----BEGIN NOT SO PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEQQwrEUWQle75mz/T+wt4fXoAn39M\ngmCdZ3ZY3fXIkqQDOOq2JJ3x6Rayy1GTp7nlN88JqxX8UC71LdmbIyKi6g==\n-----END PUBLIC KEY-----\n")
}
func TestJwtES512BadAsn1(t *testing.T) {
jwtBadKeyAsn1(t, "ES512", "-----BEGIN PUBLIC KEY-----\nCCCCCCQEFAAOCAg81111111111111111111AMIICCgKCAgEAtXhyIjACJ9I/1RLe6ewu\nBIzZ1275BUssbeUdE87qSNpkJHsn6lNKPUQVix/Hk8MDME6Et1zmyK7a2XoTovME\nLgaHFSpH3i+Eqdl1jG9c0/vkHlwC6Ba+MLxvSCn6HVrcSMMGpOdVHUU4cuqDRpVO\n4owby8e1ZSS1hdhaqs5t464BID7e907oe7hE8deqD9MXmGEimcXXEJTF84wH2xcB\nqUO35dcc5SBJfPAibZ6U2AaNIEZJouUYMJOqwVttTBvKYwhuEwcxsPrYfkufbmGb\n9dnTfKMJamujAwFf+YUwifYfpY763cQ4Ex7eHWVp4LlBB9zYYBBGp2ueLuhJSMWh\nk0yP4KBk8ZDcIgLZKsTzYDdnvbecii7qAxRYMaSEkdjSj2JTmV/GtDBLmkejVNqo\n9s/BvgEIDiPipTWesPKsaNigyhs6p6POJvOHkAAc3+88cfShLuDpobWmNEO6eOAG\nGvACbWs+EOepMrvWuL53QWgJzJaKsxgGejQ1jVCIRZeaVsWiPrJFSUk87lWwxGpR\ncSdvOATlGgjz28jL/CqtuAySGTb4S0LsBFgdpykrGChjbajxeMMjnV3khI4c/KXl\nSmOsxHfJ5vzfbicw1Inn/4RoVxw72p4t1NN3va1W6jZt/FZ5R8xgV5T5zgeAEkSm\nHJa/PXCQoBYwK7cuMJhjRaMCAwEAAQ==\n-----END PUBLIC KEY-----\n")
}
func TestJwtES512BadKeySize(t *testing.T) {
jwtBadKeySize(t, "ES512", "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEQQwrEUWQle75mz/T+wt4fXoAn39M\ngmCdZ3ZY3fXIkqQDOOq2JJ3x6Rayy1GTp7nlN88JqxX8UC71LdmbIyKi6g==\n-----END PUBLIC KEY-----\n", 256)
}
func TestJwtHS256Pass(t *testing.T) {
jwtPass(t, "HS256", "key")
}
func BenchmarkJwtHS256_256(b *testing.B) {
DoBenchForAlgBearerAndSecret(b, jwa.HS256, "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.OzPJr1hU0ffvHP6OH646IHbLw277gkswa2U-3McxAOM",
"0123456789abcdef0123456789abcdef")
}
func BenchmarkJwtHS256_512(b *testing.B) {
DoBenchForAlgBearerAndSecret(b, jwa.HS256, "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.wC3uGUE3p1WdS9Yw_NfjZn8F0B-NmB5DT4h8duOE5Gg",
"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef")
}
func BenchmarkJwtHS256_1024(b *testing.B) {
DoBenchForAlgBearerAndSecret(b, jwa.HS256, "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.o2XgUCY5i9BshAWQ4PNjaqYuGMbdvoJ6YD3Vt4fA0ZQ",
"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef")
}
func BenchmarkJwtHS256_2048(b *testing.B) {
DoBenchForAlgBearerAndSecret(b, jwa.HS256, "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.7t8Bbbo520dN4LdsUvL3gEtHrWLSPYPVzS8cAll8S7E",
"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef")
}
func TestJwtHS256BadAlg(t *testing.T) {
jwtBadAlg(t, "HS257", "key")
}
func TestJwtHS256NoKey(t *testing.T) {
jwt := *NewJwt("namer", "HS256", "", "", "120", "")
jwtValErr(t, jwt, errors.New(fmt.Sprintf(missingKeyOrJwks, "namer", "HS256")))
}
func TestJwtHS384Pass(t *testing.T) {
jwtPass(t, "HS384", "key")
}
func TestJwtHS384BadAlg(t *testing.T) {
jwtBadAlg(t, "HS385", "key")
}
func TestJwtHS384NoKey(t *testing.T) {
jwt := *NewJwt("namer", "HS384", "", "", "120", "")
jwtValErr(t, jwt, errors.New(fmt.Sprintf(missingKeyOrJwks, "namer", "HS384")))
}
func TestJwtHS512Pass(t *testing.T) {
jwtPass(t, "HS512", "key")
}
func TestJwtHS512BadAlg(t *testing.T) {
jwtBadAlg(t, "HS513", "key")
}
func TestJwtHS512NoKey(t *testing.T) {
jwt := *NewJwt("namer", "HS512", "", "", "120", "")
jwtValErr(t, jwt, errors.New(fmt.Sprintf(missingKeyOrJwks, "namer", "HS512")))
}
func BenchmarkJwtRS256(b *testing.B) {
bearer := "eyJhbGciOiJSUzI1NiIsInR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35dcc5SBJfPAibZ6U2AaNIEZJouUYMJOqwVttTBvKYwhuEwcxsPrYfkufbmGb\n9dnTfKMJamujAwFf+YUwifYfpY763cQ4Ex7eHWVp4LlBB9zYYBBGp2ueLuhJSMWh\nk0yP4KBk8ZDcIgLZKsTzYDdnvbecii7qAxRYMaSEkdjSj2JTmV/GtDBLmkejVNqo\n9s/BvgEIDiPipTWesPKsaNigyhs6p6POJvOHkAAc3+88cfShLuDpobWmNEO6eOAG\nGvACbWs+EOepMrvWuL53QWgJzJaKsxgGejQ1jVCIRZeaVsWiPrJFSUk87lWwxGpR\ncSdvOATlGgjz28jL/CqtuAySGTb4S0LsBFgdpykrGChjbajxeMMjnV3khI4c/KXl\nSmOsxHfJ5vzfbicw1Inn/4RoVxw72p4t1NN3va1W6jZt/FZ5R8xgV5T5zgeAEkSm\nHJa/PXCQoBYwK7cuMJhjRaMCAwEAAQ==\n-----END PUBLIC KEY-----\n"
alg := jwa.RS256
DoBenchForAlgBearerAndKey(b, alg, bearer, pemb)
}
func BenchmarkJwtRS256_2048(b *testing.B) {
bearer := "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.qZEo64DvgJLg5Pdg92C6uFM-D2MFBLV9wqkS8SMA9Tb3Bh-I1yrUEdTbfZtorkbL3e5ACMjMlgFAQtTmn0PWCpwOvelZ-INharlJCR_Qa3Fru5nEoEzmci63br-2Z7aU2AmiFs9bwDDpekvPJsFOHt2S-6qpIUfckaIUBcyufW09HrSUUpocY_m75VpI4SLc8rLcQC5_Gmkr3rcHbAhfECinDZvuWs_Dph_DV8nO_DYrcEOxnLgeaLPnONYKcao9th97bzpT9_firnSZochqRbzlJ6ORLt1rJWoCI7hEzi6ZUT1lUMedATmxjd4y7L8tJd-kGILpBl5GqTx6yiGPvQ\n"
pemb := "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuFrwC7xqek3lA7TkRMBr\n7koamTCE5DF0UxVPd0FbmloGTkkLLXW3R6fOxubi8O2PXk/tN+TfJZiOYswUE/+n\ngR7gEXLebosLtVdmbGraTGwtoGmpSe3FRr9ZmQu74pZsAzwqZVMqz6CINc7uvxTI\nDjd98ORUrnuxqgHE9Yz/uo2qvnaOgWIXKhkDkMqA8O0Fk/kaCfeeZQMN70OnCwIS\n+LPFE8uYGIdbaEIkjZfMxm/iNRENOV849vwOiOuWruCyp+YMqTVtcW49Q1mcZfyG\nT7B5GHWe7MtxqQNhf1m2Nvo1m/LvaLap/EM3684xOa6RexB1XdB8oegpMRygPx7o\nrwIDAQAB\n-----END PUBLIC KEY-----\n"
alg := jwa.RS256
DoBenchForAlgBearerAndKey(b, alg, bearer, pemb)
}
func BenchmarkJwtRS256_3072(b *testing.B) {
bearer := "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.UnmfhmjLnpZpZQGcdYsmjqB9iV-tMJHimaMDo49JG-CJvYYWoD2i_bixGqK6ZePXW2WuPWHjo60Sah76NQIEP3EWZNTgeR4D3mW_x5slqyq7pC86iwye7gDlHQ82MOz0lz2GgBTs5SIiEwCCuvMTCgweXUyJijxd3CsDSpBec7lbGo3Mho8h-qNwlRaiMa9Ja6K2udJJgquNHYPWM3dDWFjiBwZrwThg8N4CuGvNtnirBKKecs8ZaHK8B1iWo-wDBen9g85JQ7A53KtsBlXJe7DXVGbwsKhbphDMnOTmL0WEalMf7edKR3bOz6AesOVelHDGJ1ueYunbeZiCcEvK-8mMAYWB21g0_xaLs-j0Q0fC-gBx2Dkyhz0T8JekESFju-rA49D1CdbLjRuxO3uuXHFWA-4vHLL8zrDYQgH0GXiw_WG5IUegRZQ2cvNp5nPfqKOFYJbuY7A4HLdXWSjw6OQmq0E0RcuAC-6qYtTy6UWLnJ5rt3q_wpaAJhfHQVTE\n"
pemb := "-----BEGIN PUBLIC KEY-----\nMIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAqKrX9U4Vc79ejAz3TWVL\nSixaZzBLNQv5diPkUAsHd0XuZ3bKmaUfNnJ64nZJ/P5VZXZ6JWi+owbPX6qVAP49\nVskehq4SU1cdPUyjv0/Uf/Pi8YnNZQWS2K3aXRS00iDNuKCMpr/p3YE48mg2/I13\nx5RIZr/UzNVzSE6tLlGEGAJgx47C8RlfAN+EB5xoaozqHUqsABMOMpLmsda1Bt9Y\nhnvcfimp7YOnwDUTVChBr8uy7luCUfMbqz3TZCWgcVaSBk8Sxmv4SkpUr1cReq8o\nzw2cprewF3oCaw1oU+K84hOxiYj9pzLV3izkLO0pDNmKiav9H+OPeZNP0SvCdrsG\nZdfoWDC9oOtI3qRHC3XtDWm8U/b4v9K8LfXAIxVxZQSXvMtIXR0tsBg48yKvtk2A\nOzMv2lIBXGPAeKDnCPkq2jQVBBdrfdIO9bnSreOB98O+gDk7vKPx6ccqwN2NiYid\ngQ7I8gsowa5mV4PDfvZoBOfilUIUZ5owazxl7siQAmehAgMBAAE=\n-----END PUBLIC KEY-----\n"
alg := jwa.RS256
DoBenchForAlgBearerAndKey(b, alg, bearer, pemb)
}
func BenchmarkJwtRS256_4096(b *testing.B) {
bearer := "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.UmArmjxT8q1zFMBAXRRezXWE2okJOI8UtpaNvrou2VZsjuVX6KanZAmw5mXVF0wcCeXIysv5v-PlxSYgYJc2fRnOjU62MAEmQQQSQ_qa8Ueah5P9WBN7hYr6gJcLBgjNrq4iaWoKNqy7B1TOz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nt2MiaqtIv0XkbQl+pV0dSsGx\nasP4ueCzKfhmhimoY8rMh1mTzIbO0j88md/HecPksf1LVtWQ4YMGsVARHnhtKDKE\ntYKrljf51rAgH9RP68QAoOC21BnTxHhyKGkDSf9bbzIzReEvw8MG+QOuf4iMgkKA\nd0De94zddYgowoWMjXksgw+t+++4nBoSM3b0AZ/jT4iUhOFCmqvPyQ70tQGEiR2/\nOgLWvJGT8k86d0x9Eirsu4UCAwEAAQ==\n-----END PUBLIC KEY-----\n"
alg := jwa.RS256
DoBenchForAlgBearerAndKey(b, alg, bearer, pemb)
}
func BenchmarkJwtRS256_8192(b *testing.B) {
bearer := "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.ZyfPZ_KXCilUdLZHWU3X7gTI0pbYl3j5V8Rx1vFVGPbs-LQCDWBFNz_0owauLs57ezC_kg5NKWkAXSqxRUTJGJYDUt6o0vo6pItpIS-zEkzaJmszvOosvf1Eq_8yGyN-fzNYbx0Zj8yY4uNEALITZlFx7o6zzHJQNpTiTlmZjogUKStXzPeQuI3Ro1x_IZo4Emo5BoseEWj60As8XYNu975XTO31YT3EEFkuepB0rWtHZa7xa0fAQ6lMACOkCNRkfT-ffQfGqqCsEDAexHBoLdd2BGW0O7YTo0oI66T_-IdAmo5IyPM99sHh55wA2IJkKDuXw1XWbRSq70zqceMoxXDrLGw1AJ4zeMkW9C7Ej_ZfWEJMegiqvfcvuVdZEL23b_wXHD0yHsZ-p4zo-T6N13qAuEVEHmxTEYJug0k5SkAeChlq1BNixeUYp4k0mpXAyirMWKy0KINsfKCma4JcFUmYvxG_Lb0-CQrYVNpCEi91ayJlHXg96rhjrH_Z3iYtK8uIMk9dFW7v_HnzxbZa6wkzHST2F5oMlXNLcfiyDuozYMxkDavWgZw152LAxN2nfh1Zv4GplcpjMpxL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Ebr59/KFeJFlxPvpyC7Hp\nqlZcx0DvzMLAsxWgmvruL+SGtlwknJugqIPBHBhksjSv0l7yeU9SfOTNLfA1Ajfe\nJwIDAQAB\n-----END PUBLIC KEY-----\n"
alg := jwa.RS256
DoBenchForAlgBearerAndKey(b, alg, bearer, pemb)
}
func BenchmarkJwtRS256_16384(b *testing.B) {
bearer := "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.ttAo2joM4bBeyAVLbIO12GqCme2hD8iJIoDEucoP-EbckYHmDVnCftUeXtiFiqrnb97RSh16PPY-w71_tUM6wetGPe_DcPVxcJmQOJyLJSwT48Cm4vnDiOPj8RMbyBeubFodDpaNHPNXFYrsrZ5J3RbBssn0zAsthePOQ75qkbF9Ep1aa-UJqWvSOwgC886JxtE-6AM4OYAJ9zQF7HgPAFGqiBytLggxm1a9c9W1wIt2UAGd9krQegynRQIVrX4dvGBHJvEIE3LbZ6rzmpJooFOD0LBaAcMxrsr8I8kgvWsxfQjoLPvd6jq7T2nfi6qJODDJEhWgvcjE3lTfUH4Dc1peh0d_CQJbuLqfx8l6lZmk0bEqMnE8si532Q2BTxhWWd8pGmyrAZ-h7z1dJeYmh005KkcNvShNcBTorNrXeUiVUPEz28H0PeVq6GY4S00YGeBjGK7jEAoq-lEedr9mKyjeRTSuEqqGcqoVI5owQdZlS2wrMqQ3xi3bE8skVSxHBqG6QvZqotLkjHf6NR-f4p7JPLkKlSgtxyppX0NYFhPhQf8jdovFvbcfqTeoc7Tt2HzN9YZ3xYXkss1GJZSpI_7DvHyNR615zpq5CXdecPp5_juj4Wt00_fZKBEtLFGwB_UfwtsubliLLXwXcz0PxId73g5JhbY8g3BfrL2zUbsgIo94AT6ckb8gR3b2IwAHziukheOcFTFMGy4MB8yJDQ3vtwSotBQPAMODKettU3DBYc2B_8eC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khI4c/KXl\nSmOsxHfJ5vzfbicw1Inn/4RoVxw72p4t1NN3va1W6jZt/FZ5R8xgV5T5zgeAEkSm\nHJa/PXCQoBYwK7cuMJhjRaMCAwEAAQ==\n-----END PUBLIC KEY-----\n"
alg := jwa.RS384
DoBenchForAlgBearerAndKey(b, alg, bearer, pemb)
}
func BenchmarkJwtRS512(b *testing.B) {
bearer := "eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.ZBWwH08G8XgKZSirRCn_y66VCubpWmvPd9LmyPu126Cp0VH-ujqgNsih8jRqdE_iK_XpzPIiKteFfzfpZgemtQvM1w7yGGg_yDlgYrAeyosIgTXL_6aj5xsiS0ybE1Da5PhEp8jxIP9vjgQmEoJPYR_8B4enGjLap5spkag4ixQfvOosighATAmtTegEzv5Rqjk7DrswfGyu2AwiXkAXBSSeNckvTwXslNkyAxE82uOfB8iASqfarEdc_d61tKIMhiDYsWZhjdJXeczCKw6-0aG-lqnPe9lWAYj_R5pHC7rxXL582exyUEQoHeriwNog1P2LBUmnSQEia1sKv1XK9F33QbIijCCCSkwv01V0HKfTQA4mQ8wD2WZwjUj6seUH0ezdSC8Z7fJeQ7GbVM-VoKLMSdrSjf988ICwbNy2XBuBUHjpDluTV0BphJnWLvL-X4CBi0UV0HJMqBE3zLr6VEuPsc3N7NjGW-FTbh-bzlfCNUCb7fln_xMGSILWRKOpqj_xjIQrKbi3Kus41vFP2ChX-GHAJiJvuZVfOjIytpE19npnUC_CZzAhD9w5s-ToIR95FpA3wE1HUgle4p7_cbYMwDvvzi1Y7hf0h0bouUS3FSmycBTx7dUgKJeNwKtetNFHloM9CUZfdK9QGY8bSXh4r5h4gOsOeM47ic-W8Uk\n"
pemb := "-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtXhyIjACJ9I/1RLe6ewu\nBIzZ1275BUssbeUdE87qSNpkJHsn6lNKPUQVix/Hk8MDME6Et1zmyK7a2XoTovME\nLgaHFSpH3i+Eqdl1jG9c0/vkHlwC6Ba+MLxvSCn6HVrcSMMGpOdVHUU4cuqDRpVO\n4owby8e1ZSS1hdhaqs5t464BID7e907oe7hE8deqD9MXmGEimcXXEJTF84wH2xcB\nqUO35dcc5SBJfPAibZ6U2AaNIEZJouUYMJOqwVttTBvKYwhuEwcxsPrYfkufbmGb\n9dnTfKMJamujAwFf+YUwifYfpY763cQ4Ex7eHWVp4LlBB9zYYBBGp2ueLuhJSMWh\nk0yP4KBk8ZDcIgLZKsTzYDdnvbecii7qAxRYMaSEkdjSj2JTmV/GtDBLmkejVNqo\n9s/BvgEIDiPipTWesPKsaNigyhs6p6POJvOHkAAc3+88cfShLuDpobWmNEO6eOAG\nGvACbWs+EOepMrvWuL53QWgJzJaKsxgGejQ1jVCIRZeaVsWiPrJFSUk87lWwxGpR\ncSdvOATlGgjz28jL/CqtuAySGTb4S0LsBFgdpykrGChjbajxeMMjnV3khI4c/KXl\nSmOsxHfJ5vzfbicw1Inn/4RoVxw72p4t1NN3va1W6jZt/FZ5R8xgV5T5zgeAEkSm\nHJa/PXCQoBYwK7cuMJhjRaMCAwEAAQ==\n-----END PUBLIC KEY-----\n"
alg := jwa.RS512
DoBenchForAlgBearerAndKey(b, alg, bearer, pemb)
}
func BenchmarkJwtPS256(b *testing.B) {
bearer := "eyJhbGciOiJQUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.TbloDjGto2e90mE6yKFs-Ox9n2NCdtpm490c-NHVXCvWZrtbICO02q74tiHxIvwKMSpULlfR5YhjcO2GN4tvcimWJAbaBamG5ydfEry3sGCCmuNkPhuCTQprGFkP7ZCLJLsXwbrWCY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vOHkAAc3+88cfShLuDpobWmNEO6eOAG\nGvACbWs+EOepMrvWuL53QWgJzJaKsxgGejQ1jVCIRZeaVsWiPrJFSUk87lWwxGpR\ncSdvOATlGgjz28jL/CqtuAySGTb4S0LsBFgdpykrGChjbajxeMMjnV3khI4c/KXl\nSmOsxHfJ5vzfbicw1Inn/4RoVxw72p4t1NN3va1W6jZt/FZ5R8xgV5T5zgeAEkSm\nHJa/PXCQoBYwK7cuMJhjRaMCAwEAAQ==\n-----END PUBLIC KEY-----\n"
alg := jwa.PS256
DoBenchForAlgBearerAndKey(b, alg, bearer, pemb)
}
func BenchmarkJwtPS384(b *testing.B) {
bearer := "eyJhbGciOiJQUzM4NCIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.sSwCUL4suyCEGFiRt-OY87eYXvFtJOnQwZAoHcSfI1wH8EW09Evbnrduwx4-DpMlOGbw5VQsdArcjPeojJ3IeqnI-SP9TNjPOciWQlB0MbAD32ANuyq3dQt7Z5xsKy-jObESB-c0iDb1CdwdCamLzBoFajo06hxxLDgvFsV0c8er77u85Wrvlh5tr_e6Wqmg14xKADzaZU7QDBBsh9L6XcPrhCif7NzKuxJXVWI5MwNBNgU6bgeuTJiz6OZJmNqMNOe1KeR9k--xLpsCmAf4vW2o7lPysY84Q4dXGLCOX_Ox_Mmtqyu6qJZXI7KlLMDYbyFIEJqkw8tEAhrwbeIlG2k5yXg7TA3t2E-YmKC2hapz4qvs9eFkWtNoQIcBHPXh7BqIE905tbLEdosddTmZkHDTd504puDZQOMm9_oIRWLhE890BT-7rL_jte93uJShJeRsHP4UrahdBL0Dh2KF0aIH5GkgBadkpdgbC88v5PMQi_Iw79wixBmIw2qGMG3HWpUksp597eyg8G0jGBxnY1hzd08FSkxCx82CUQUkNkLf7zVJsWhup2b0YkSFBpUnSziDE1gbS6zTI3rOPqlGaZYAgh1kYiOkC2rhP769fyTI_T62vP8uM6BVr4ehAkZ9aDbD-ojINym-a7vCgcLfyk1Oo6xO_gzy31CPuzoij9I"
pemb := "-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtXhyIjACJ9I/1RLe6ewu\nBIzZ1275BUssbeUdE87qSNpkJHsn6lNKPUQVix/Hk8MDME6Et1zmyK7a2XoTovME\nLgaHFSpH3i+Eqdl1jG9c0/vkHlwC6Ba+MLxvSCn6HVrcSMMGpOdVHUU4cuqDRpVO\n4owby8e1ZSS1hdhaqs5t464BID7e907oe7hE8deqD9MXmGEimcXXEJTF84wH2xcB\nqUO35dcc5SBJfPAibZ6U2AaNIEZJouUYMJOqwVttTBvKYwhuEwcxsPrYfkufbmGb\n9dnTfKMJamujAwFf+YUwifYfpY763cQ4Ex7eHWVp4LlBB9zYYBBGp2ueLuhJSMWh\nk0yP4KBk8ZDcIgLZKsTzYDdnvbecii7qAxRYMaSEkdjSj2JTmV/GtDBLmkejVNqo\n9s/BvgEIDiPipTWesPKsaNigyhs6p6POJvOHkAAc3+88cfShLuDpobWmNEO6eOAG\nGvACbWs+EOepMrvWuL53QWgJzJaKsxgGejQ1jVCIRZeaVsWiPrJFSUk87lWwxGpR\ncSdvOATlGgjz28jL/CqtuAySGTb4S0LsBFgdpykrGChjbajxeMMjnV3khI4c/KXl\nSmOsxHfJ5vzfbicw1Inn/4RoVxw72p4t1NN3va1W6jZt/FZ5R8xgV5T5zgeAEkSm\nHJa/PXCQoBYwK7cuMJhjRaMCAwEAAQ==\n-----END PUBLIC KEY-----\n"
alg := jwa.PS384
DoBenchForAlgBearerAndKey(b, alg, bearer, pemb)
}
func BenchmarkJwtPS512(b *testing.B) {
bearer := "eyJhbGciOiJQUzUxMiIsInR5cCI6IkpXVCJ9.eyJhdWQiOlsiR29sYW5nIFVzZXJzIl0sImlhdCI6MjMzNDMxMjAwLCJzdWIiOiJodHRwczovL2dpdGh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ZJouUYMJOqwVttTBvKYwhuEwcxsPrYfkufbmGb\n9dnTfKMJamujAwFf+YUwifYfpY763cQ4Ex7eHWVp4LlBB9zYYBBGp2ueLuhJSMWh\nk0yP4KBk8ZDcIgLZKsTzYDdnvbecii7qAxRYMaSEkdjSj2JTmV/GtDBLmkejVNqo\n9s/BvgEIDiPipTWesPKsaNigyhs6p6POJvOHkAAc3+88cfShLuDpobWmNEO6eOAG\nGvACbWs+EOepMrvWuL53QWgJzJaKsxgGejQ1jVCIRZeaVsWiPrJFSUk87lWwxGpR\ncSdvOATlGgjz28jL/CqtuAySGTb4S0LsBFgdpykrGChjbajxeMMjnV3khI4c/KXl\nSmOsxHfJ5vzfbicw1Inn/4RoVxw72p4t1NN3va1W6jZt/FZ5R8xgV5T5zgeAEkSm\nHJa/PXCQoBYwK7cuMJhjRaMCAwEAAQ==\n-----END PUBLIC KEY-----\n"
alg := jwa.PS512
DoBenchForAlgBearerAndKey(b, alg, bearer, pemb)
}
func BenchmarkJwtHS256(b *testing.B) {
DoBenchForAlgBearerAndSecret(b, jwa.HS256, "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.sHm-91nvgMEqZelFK6sQhWBGtshLy-A1FYFkZQ62sE4", "your-real-secret")
}
func BenchmarkJwtHS384(b *testing.B) {
DoBenchForAlgBearerAndSecret(b, jwa.HS384, "eyJhbGciOiJIUzM4NCIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.YZ3u3q6lqhr2aZJb0sHIiv86Sc-osMy4_IxMVMh8VOJtWPxr37nw9x4mL7RMn1FE\n", "your-real-secret")
}
func BenchmarkJwtHS512(b *testing.B) {
DoBenchForAlgBearerAndSecret(b, jwa.HS512, "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.S14tgmkZES1f6l8G3qXOPnn9DEA60o45tZyw6l3QHCdwvc5PnSx3iOnJWZb3pXqyS3WOJK55BgPm43KVreqhAg\n", "your-real-secret")
}
func BenchmarkJwtES256(b *testing.B) {
bearer := "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.PVhXCdrAglq2TuRBuF6QFjTV2Lo33F44NQS0kwFLr0d9IjlGIknEiRSZ0UCQxktVX_bUcEA3f5vhWxAUmAAZcg\n"
pemb := "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEQQwrEUWQle75mz/T+wt4fXoAn39M\ngmCdZ3ZY3fXIkqQDOOq2JJ3x6Rayy1GTp7nlN88JqxX8UC71LdmbIyKi6g==\n-----END PUBLIC KEY-----\n"
alg := jwa.ES256
DoBenchForAlgBearerAndKey(b, alg, bearer, pemb)
}
func BenchmarkJwtES384(b *testing.B) {
bearer := "eyJhbGciOiJFUzM4NCIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.TTt9MBH2XKNL-1IxoiLmFQyR3O-t-kPkUQbCFxqFQfDDnZDWDeG06Ea-s1_syBrlsmd0gJq3g1PvVS6KVswOtqpF28R2s5LVwAYKbmsziMRGc5jHAPjABzT3Aigwh3j9\n"
pemb := "-----BEGIN PUBLIC KEY-----\nMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEbzpBvrm4YDC8/AWuFNylOeApmVi0NpiR\nI4tQOE0y5bm7zjwjr/nvwKreCF0mT0NivYOzQfu6D5Wy1Jpgm0ebMDljSKEGkZwC\nP2/jogu9YzmaAnV/Re16ffln/n+tsATG\n-----END PUBLIC KEY-----\n"
alg := jwa.ES384
DoBenchForAlgBearerAndKey(b, alg, bearer, pemb)
}
func BenchmarkJwtES512(b *testing.B) {
bearer := "eyJhbGciOiJFUzUxMiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.AYEE2U3R1D40NxA7NcRApQ6jHExwLijMOxW527gN1usYLIu_Qg-X9vqm5XrDXFEyn4VpeQ83nE_az8QqRBZPkq5gAEIeJoyO3Mfj1G9uFyAyQmy2W8YYyqUUyjZ5lFu03gMmR_vdTQfWfFyAw6NbD0k78KF4h2qfXeybN-Ljjc7e7K7y\n"
pemb := "-----BEGIN PUBLIC KEY-----\nMIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQAuObw6RyorEJfB+UUgkJcmfdIlLuK\nwO6KFjHF8u5+OPpHNZuq203djMAp07caPZsuEg2M0WIjdm10LefJhnepq/8B1AZT\nI/Kr/XahLw9Wn9/TDWXgLwaPnPk6jnzlkVFpts4mcvS2/ec/yBoPViHZ98sMwOoS\njTrSpJkw0BIo5qQSuGk=\n-----END PUBLIC KEY-----\n"
alg := jwa.ES512
DoBenchForAlgBearerAndKey(b, alg, bearer, pemb)
}
//12μs
func BenchmarkSimpleParse(b *testing.B) {
bearer := "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6Ims0MiJ9.eyJpc3MiOiJqb2UiLCJodHRwOi8vZXhhbXBsZS5jb20vaXNfcm9vdCI6dHJ1ZSwianRpIjoiOGUzMzM4NzAtMGVmNC00NTNlLWFkYzktNjk4NTc5ODNmMDM0IiwiaWF0IjoxNjA3NTEzNjU4fQ.MPDlM3h1A9a_Yy0ENRAh-E2rTJdVnb0AVQx7eTksm0kdq1CtIW7OAQQghNWwYhc-X1f1t36EG4j6fEViAvCvB-0M89ZJAPrNqLeyVrtU-O9nmaEgSCf5eQFJcEea41L42wbL4T4-HtwUGhuEnaH0UrR5hc9BSXKQwiXVIi0mtWcJKK6tCT4CNlCYH73igPmBXIxJeRl3ZLCqxDEZ5hdC1HEgOls_HGRSUfNKlXtc3-U4kz32HlsmDwwPO2-7xuj3vfeWCv6UgIwkSaiCkcBWJ-MsWzOX_VDflrgQwWe7yV2pnvHmJxido_NwuSd6JJ55da6xY6yBAAbbVo6pRIK6og"
DoBenchForBearerTokenParse(b, bearer)
}
//10μs
func BenchmarkJwtEs512Parse(b *testing.B) {
bearer := "eyJhbGciOiJFUzUxMiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6MTUxNjIzOTAyMn0.AYEE2U3R1D40NxA7NcRApQ6jHExwLijMOxW527gN1usYLIu_Qg-X9vqm5XrDXFEyn4VpeQ83nE_az8QqRBZPkq5gAEIeJoyO3Mfj1G9uFyAyQmy2W8YYyqUUyjZ5lFu03gMmR_vdTQfWfFyAw6NbD0k78KF4h2qfXeybN-Ljjc7e7K7y\n"
DoBenchForBearerTokenParse(b, bearer)
}
func DoBenchForBearerTokenParse(b *testing.B, token string) {
for i := 0; i < b.N; i++ {
_, err := jwt.Parse([]byte(token))
if err != nil {
b.Errorf("token parsing failed, cause: %v", err)
}
}
}
func DoBenchForAlgBearerAndKey(b *testing.B, alg jwa.SignatureAlgorithm, bearer string, pemb string) {
pem, _ := pem.Decode([]byte(pemb))
pub, _ := x509.ParsePKIXPublicKey(pem.Bytes)
for i := 0; i < b.N; i++ {
_, err := jwt.Parse([]byte(bearer), jwt.WithVerify(alg, pub))
if err != nil {
b.Errorf("key verification failed, cause: %v", err)
}
}
}
func DoBenchForAlgBearerAndSecret(b *testing.B, alg jwa.SignatureAlgorithm, bearer string, secret string) {
for i := 0; i < b.N; i++ {
_, err := jwt.Parse([]byte(bearer), jwt.WithVerify(alg, []byte(secret)))
if err != nil {
b.Errorf("key verification failed, cause: %v", err)
}
}
}