Last active
February 9, 2017 16:24
-
-
Save toast254/40b7e9e6a68bd5ca32430ee7a30b1ffa to your computer and use it in GitHub Desktop.
python PyJWT test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# | |
# depends : | |
# - cryptography | |
# - PyJWT | |
# | |
import timeit | |
import cryptography | |
import jwt | |
cycle_nbr = 100000 | |
payload = { | |
"sub": "1234567890", | |
"name": "John Doe", | |
"admin": True | |
} | |
# (but with tab converted to space) : >>>> print(''.join([random.choice(string.printable) for _ in range(1024)])) | |
secret = '''B=g2qPo.!VXr/66d~F%,|*<I7VAO | |
-`^z Fle | |
C | |
FZI\]AYFu)(dA?emO): | |
oD1n-jVqb"h%4LUg}4l,Jt6K#(!(kaa"`EY" | |
[!s2-"Ldt8dE: Oe,!^r#9<&"q39/eX5yN]j;0~~7 | |
z[yU+QG)N$De|5&+LB?LN:r\IGrc?kY-f\o<ul!Ly5r;6t;B]7 | |
V1iR6$,oj+*\0*<#u!N-RI]YH2Up-K *[a*5+-bDl2oi$f!|%Ck | |
H | |
;c2}s<:?va\$/q1C:$b/ORN6i",y | |
h k*\F*U;f%{F*aG nI$5>XpJsF | |
<3]M~DWI$T[I | |
_M7D\MAcq1[W-Rb! | |
=tq$1Y:20}Q-0,RiY#/R~A48tv[1i( | |
.XLIUYH | |
8@+ik;1jPku)c/N#I<f3b(we ,zX | |
yc-|XJ}cNz#uRv0/{dKs>z\!ZqJJ/h(+ | |
f5|Fl$+U\Q] | |
ww*oF3&ZN | |
O]co#:| | |
>:['L^J"LG'&DuigRRS"usBOt}\jtO,D._T | |
O\\O:iQ*f*!bl&&8g?b\efn">.%gJ;!F&L.CHF~W)Z1RoBGs>rFUwjJo~0e@ ,xW^~qix7[<z_J"BUv`^nY>> | |
T*'!S'yS%q#JzDrW[^r-MkpE 3Q]8=n_Qvc"~7 9p^\Q"\+bZA"HwED3|{#K!Uod?Ve> | |
DP"A9 | |
u4iM_mu1 | |
OY | |
pKnlii)-a&X,~+s)4$!]\2e,dX\>nWzr6Tx/3_dXI=>4n | |
@2_j^w;V'IJO=5reF8]~-ib>XR3]cO&&;C% 4IQ1t1nhQ_M*wUm0W@Uv_7vK >NShgsF8E2L]sIY\i#TNL?Ac+?WWfeg~"] | |
15 O1@ | |
D*7ycGV08q%'@-g5 i0 ;R:":`bi5z | |
C#qdly`a=2T?UUZ& | |
?(f | |
v''' | |
# openssl ecparam -name secp256k1 -genkey -out ec_key_secp256k1 | |
ec_secret = '''-----BEGIN EC PRIVATE KEY----- | |
MHQCAQEEIEx6rt9UnKI9l2TLcislnZvEFF6uO/LhdPZsw2TpmctDoAcGBSuBBAAK | |
oUQDQgAElxvBJkhrRY4+P9satM2z+YR0ocbG3En1+DkEl3L737CSbXFDGuDsog1z | |
phCTKHdC3l4Y/DCEJyfFmVCgsuYNXA== | |
-----END EC PRIVATE KEY-----''' | |
# openssl genrsa -aes256 -out key 4096 | |
rsa_secret = '''-----BEGIN RSA PRIVATE KEY----- | |
MIIJKgIBAAKCAgEAx3YK6rzBtSNl48i9ACb4P/c3DSHo6NsVmR7uVZB3on33zn+P | |
EJYC/ZV31e33x1gS/NUs+ECM/GNR2Kp0jUF4S2JfTwqw8zmy9eN1+4IkZvLDODw1 | |
vTEVy1Fm/a1BX741de1vVfZg0gssuGQw0Qj3Kmd++DKe6bpIpmLX8C01DKGA20re | |
5BqkwbvVc+934sLTv46+T3o1PWbtj419Lu/3AgMynMlwVBlk+o47kAaWow4HfDbo | |
FXaa1+4PTPUwbPuL96ePKPSPorIhxobftMayJifrUyvsYL15J+pVZy6vfaOGQbij | |
GVf7sin37Znan8L4ju3wH79Y6+Yhn5HpTth0GN/VJZqG7q2UPeNu7xafiPhKjWHf | |
UFddk23yOoP/imKxyTF9GgnUthMqhfnnUKEvrV94rVAjbLs4ek88CdYmAQiBaocX | |
dJQCuJjqoC73dTYnh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BxUqXBMFOSWmV7BBFDn1SpDRtDsJ9qaTZg//TOu8Ji8H5PHb81dSj+V | |
3n4Eu/mZHK9hWUzi8Sdl/tcPk9Ju6csg2aY5Wa3ZuWQamE7upK6EyaTNqYTRlbMH | |
gq70+WdEdt2/X9OtI6h048ny0PmAjA18t5mpZD5zVI4RIob3CP95uN6nc2vJTG0W | |
EAWaKOsKxrFJssawi0QwrP4r/M1DxGkAUh7pR788vDJDowN+QjNZawm7sIKz7H04 | |
BtOlqqOqY6oy/Zq21VEMSAj+N+V2+PBNNQKCAQEAiBRZm8poFWt7C2CKknz5/8F/ | |
OSbRL7GTKN9QZJKCAGjOlEgKQnISEggsairuHvqjtDyAserz0LB4qvTNydulSreq | |
ofunQM94oi/C75LlxvwavgT0rySmfWH1METa7Ws6loa/sRVne/x1/9kVXfZwIvRc | |
LfWkYefOZNP0NPQTpQu5RsDyUYQZMycHSSef7gSMIPjr66soGWYv0+SnJtOfGP2n | |
cG7j438F0OHyNguA37//+cP/Jior6LbszHXyQy0IUJElBLxiAMC0Ul3MwtW+8pmB | |
izQN9ThDoRFOo8/m+yXuNqy6zNI9CnHANcpmmIf0Lm9RLHQt6jnXlepIa2p7QQ== | |
-----END RSA PRIVATE KEY-----''' | |
HS256_token = jwt.encode(payload, secret, 'HS256') | |
HS512_token = jwt.encode(payload, secret, 'HS512') | |
ES256_token = jwt.encode(payload, ec_secret, 'ES256') | |
ES512_token = jwt.encode(payload, ec_secret, 'ES512') | |
RS256_token = jwt.encode(payload, rsa_secret, 'RS256') | |
RS512_token = jwt.encode(payload, rsa_secret, 'RS512') | |
PS256_token = jwt.encode(payload, rsa_secret, 'PS256') | |
PS512_token = jwt.encode(payload, rsa_secret, 'PS512') | |
print('cycle number :', cycle_nbr) | |
print('payload :', payload) | |
print('For HS :', len(secret), 'char length secret') | |
print('HS256 token length :', len(HS256_token)) | |
print('HS512 token length :', len(HS512_token)) | |
print('For ES : openssl ecparam -name secp256k1 -genkey -out ec_key_secp256k1') | |
print('ES256 token length :', len(ES256_token)) | |
print('ES512 token length :', len(ES512_token)) | |
print('For RS and PS : openssl genrsa -aes256 -out key 4096') | |
print('RS256 token length :', len(RS256_token)) | |
print('RS512 token length :', len(RS512_token)) | |
print('PS256 token length :', len(PS256_token)) | |
print('PS512 token length :', len(PS512_token)) | |
def test_encoding_HS256(): | |
payload = { | |
"sub": "1234567890", | |
"name": "John Doe", | |
"admin": True | |
} | |
secret = '''B=g2qPo.!VXr/66d~F%,|*<I7VAO | |
-`^z Fle | |
C | |
FZI\]AYFu)(dA?emO): | |
oD1n-jVqb"h%4LUg}4l,Jt6K#(!(kaa"`EY" | |
[!s2-"Ldt8dE: Oe,!^r#9<&"q39/eX5yN]j;0~~7 | |
z[yU+QG)N$De|5&+LB?LN:r\IGrc?kY-f\o<ul!Ly5r;6t;B]7 | |
V1iR6$,oj+*\0*<#u!N-RI]YH2Up-K *[a*5+-bDl2oi$f!|%Ck | |
H | |
;c2}s<:?va\$/q1C:$b/ORN6i",y | |
h k*\F*U;f%{F*aG nI$5>XpJsF | |
<3]M~DWI$T[I | |
_M7D\MAcq1[W-Rb! | |
=tq$1Y:20}Q-0,RiY#/R~A48tv[1i( | |
.XLIUYH | |
8@+ik;1jPku)c/N#I<f3b(we ,zX | |
yc-|XJ}cNz#uRv0/{dKs>z\!ZqJJ/h(+ | |
f5|Fl$+U\Q] | |
ww*oF3&ZN | |
O]co#:| | |
>:['L^J"LG'&DuigRRS"usBOt}\jtO,D._T | |
O\\O:iQ*f*!bl&&8g?b\efn">.%gJ;!F&L.CHF~W)Z1RoBGs>rFUwjJo~0e@ ,xW^~qix7[<z_J"BUv`^nY>> | |
T*'!S'yS%q#JzDrW[^r-MkpE 3Q]8=n_Qvc"~7 9p^\Q"\+bZA"HwED3|{#K!Uod?Ve> | |
DP"A9 | |
u4iM_mu1 | |
OY | |
pKnlii)-a&X,~+s)4$!]\2e,dX\>nWzr6Tx/3_dXI=>4n | |
@2_j^w;V'IJO=5reF8]~-ib>XR3]cO&&;C% 4IQ1t1nhQ_M*wUm0W@Uv_7vK >NShgsF8E2L]sIY\i#TNL?Ac+?WWfeg~"] | |
15 O1@ | |
D*7ycGV08q%'@-g5 i0 ;R:":`bi5z | |
C#qdly`a=2T?UUZ& | |
?(f | |
v''' | |
jwt.encode(payload, secret, 'HS256') | |
def test_encoding_HS512(): | |
payload = { | |
"sub": "1234567890", | |
"name": "John Doe", | |
"admin": True | |
} | |
secret = '''B=g2qPo.!VXr/66d~F%,|*<I7VAO | |
-`^z Fle | |
C | |
FZI\]AYFu)(dA?emO): | |
oD1n-jVqb"h%4LUg}4l,Jt6K#(!(kaa"`EY" | |
[!s2-"Ldt8dE: Oe,!^r#9<&"q39/eX5yN]j;0~~7 | |
z[yU+QG)N$De|5&+LB?LN:r\IGrc?kY-f\o<ul!Ly5r;6t;B]7 | |
V1iR6$,oj+*\0*<#u!N-RI]YH2Up-K *[a*5+-bDl2oi$f!|%Ck | |
H | |
;c2}s<:?va\$/q1C:$b/ORN6i",y | |
h k*\F*U;f%{F*aG nI$5>XpJsF | |
<3]M~DWI$T[I | |
_M7D\MAcq1[W-Rb! | |
=tq$1Y:20}Q-0,RiY#/R~A48tv[1i( | |
.XLIUYH | |
8@+ik;1jPku)c/N#I<f3b(we ,zX | |
yc-|XJ}cNz#uRv0/{dKs>z\!ZqJJ/h(+ | |
f5|Fl$+U\Q] | |
ww*oF3&ZN | |
O]co#:| | |
>:['L^J"LG'&DuigRRS"usBOt}\jtO,D._T | |
O\\O:iQ*f*!bl&&8g?b\efn">.%gJ;!F&L.CHF~W)Z1RoBGs>rFUwjJo~0e@ ,xW^~qix7[<z_J"BUv`^nY>> | |
T*'!S'yS%q#JzDrW[^r-MkpE 3Q]8=n_Qvc"~7 9p^\Q"\+bZA"HwED3|{#K!Uod?Ve> | |
DP"A9 | |
u4iM_mu1 | |
OY | |
pKnlii)-a&X,~+s)4$!]\2e,dX\>nWzr6Tx/3_dXI=>4n | |
@2_j^w;V'IJO=5reF8]~-ib>XR3]cO&&;C% 4IQ1t1nhQ_M*wUm0W@Uv_7vK >NShgsF8E2L]sIY\i#TNL?Ac+?WWfeg~"] | |
15 O1@ | |
D*7ycGV08q%'@-g5 i0 ;R:":`bi5z | |
C#qdly`a=2T?UUZ& | |
?(f | |
v''' | |
jwt.encode(payload, secret, 'HS512') | |
def test_encoding_ES256(): | |
payload = { | |
"sub": "1234567890", | |
"name": "John Doe", | |
"admin": True | |
} | |
ec_secret = '''-----BEGIN EC PRIVATE KEY----- | |
MHQCAQEEIEx6rt9UnKI9l2TLcislnZvEFF6uO/LhdPZsw2TpmctDoAcGBSuBBAAK | |
oUQDQgAElxvBJkhrRY4+P9satM2z+YR0ocbG3En1+DkEl3L737CSbXFDGuDsog1z | |
phCTKHdC3l4Y/DCEJyfFmVCgsuYNXA== | |
-----END EC PRIVATE KEY-----''' | |
jwt.encode(payload, ec_secret, 'ES256') | |
def test_encoding_ES512(): | |
payload = { | |
"sub": "1234567890", | |
"name": "John Doe", | |
"admin": True | |
} | |
ec_secret = '''-----BEGIN EC PRIVATE KEY----- | |
MHQCAQEEIEx6rt9UnKI9l2TLcislnZvEFF6uO/LhdPZsw2TpmctDoAcGBSuBBAAK | |
oUQDQgAElxvBJkhrRY4+P9satM2z+YR0ocbG3En1+DkEl3L737CSbXFDGuDsog1z | |
phCTKHdC3l4Y/DCEJyfFmVCgsuYNXA== | |
-----END EC PRIVATE KEY-----''' | |
jwt.encode(payload, ec_secret, 'ES512') | |
def test_encoding_RS256(): | |
payload = { | |
"sub": "1234567890", | |
"name": "John Doe", | |
"admin": True | |
} | |
rsa_secret = '''-----BEGIN RSA PRIVATE KEY----- | |
MIIJKgIBAAKCAgEAx3YK6rzBtSNl48i9ACb4P/c3DSHo6NsVmR7uVZB3on33zn+P | |
EJYC/ZV31e33x1gS/NUs+ECM/GNR2Kp0jUF4S2JfTwqw8zmy9eN1+4IkZvLDODw1 | |
vTEVy1Fm/a1BX741de1vVfZg0gssuGQw0Qj3Km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HPMHU7 | |
ju5Zx5Ch2Bqf5X3xNwbsn3B+Eqn795z7H6bk7+QWUwN99rosaPKSVhcRXCKMUo1O | |
RM4dMTgWQfK2beNnI+RcJNSGf2ucPpRUPiPYsZFQZOJ8HZ4yRCOxKV0BlWz9MvQT | |
6PSu03TT0qbwop8LrO9xPgPbc7zTgSKwbQS5s0JQIPsO+KutvAmm55TZWAV6LeaZ | |
sSOWFQKCAQEAzwMRoJ9Hsx16AZjO3faA8ufUNmjL5GXkOxGePJihUDQWhd7U3Stj | |
/l7m0SJyLBxUqXBMFOSWmV7BBFDn1SpDRtDsJ9qaTZg//TOu8Ji8H5PHb81dSj+V | |
3n4Eu/mZHK9hWUzi8Sdl/tcPk9Ju6csg2aY5Wa3ZuWQamE7upK6EyaTNqYTRlbMH | |
gq70+WdEdt2/X9OtI6h048ny0PmAjA18t5mpZD5zVI4RIob3CP95uN6nc2vJTG0W | |
EAWaKOsKxrFJssawi0QwrP4r/M1DxGkAUh7pR788vDJDowN+QjNZawm7sIKz7H04 | |
BtOlqqOqY6oy/Zq21VEMSAj+N+V2+PBNNQKCAQEAiBRZm8poFWt7C2CKknz5/8F/ | |
OSbRL7GTKN9QZJKCAGjOlEgKQnISEggsairuHvqjtDyAserz0LB4qvTNydulSreq | |
ofunQM94oi/C75LlxvwavgT0rySmfWH1METa7Ws6loa/sRVne/x1/9kVXfZwIvRc | |
LfWkYefOZNP0NPQTpQu5RsDyUYQZMycHSSef7gSMIPjr66soGWYv0+SnJtOfGP2n | |
cG7j438F0OHyNguA37//+cP/Jior6LbszHXyQy0IUJElBLxiAMC0Ul3MwtW+8pmB | |
izQN9ThDoRFOo8/m+yXuNqy6zNI9CnHANcpmmIf0Lm9RLHQt6jnXlepIa2p7QQ== | |
-----END RSA PRIVATE KEY-----''' | |
jwt.encode(payload, rsa_secret, 'RS256') | |
def test_encoding_RS512(): | |
payload = { | |
"sub": "1234567890", | |
"name": "John Doe", | |
"admin": True | |
} | |
rsa_secret = '''-----BEGI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QN9ThDoRFOo8/m+yXuNqy6zNI9CnHANcpmmIf0Lm9RLHQt6jnXlepIa2p7QQ== | |
-----END RSA PRIVATE KEY-----''' | |
jwt.encode(payload, rsa_secret, 'RS512') | |
def test_encoding_PS256(): | |
payload = { | |
"sub": "1234567890", | |
"name": "John Doe", | |
"admin": True | |
} | |
rsa_secret = '''-----BEGIN RSA PRIVATE KEY----- | |
MIIJKgIBAAKCAgEAx3YK6rzBtSNl48i9ACb4P/c3DSHo6NsVmR7uVZB3on33zn+P | |
EJYC/ZV31e33x1gS/NUs+ECM/GNR2Kp0jUF4S2JfTwqw8zmy9eN1+4IkZvLDODw1 | |
vTEVy1Fm/a1BX741de1vVfZg0gssuGQw0Qj3Kmd++DKe6bpIpmLX8C01DKGA20re | |
5BqkwbvVc+934sLTv46+T3o1PWbtj419Lu/3AgMynMlwVBlk+o47kAaWow4HfDbo | |
FXaa1+4PTPUwbPuL96ePKPSPorIhxobftMayJifrUyvsYL15J+pVZy6vfaOGQbij | |
GVf7sin37Znan8L4ju3wH79Y6+Yhn5HpTth0GN/VJZqG7q2UPeNu7xafiPhKjWHf | |
UFddk23yOoP/imKxyTF9GgnUthMqhfnnUKEvrV94rVAjbLs4ek88CdYmAQiBaocX | |
dJQCuJjqoC73dTYnh1mrGwPc8O0oLfnp9aAs87xJ8EKRnp611QHXctedVoDQz5Bw | |
0/u5Rj34AaTOt14lvAjkZ+rXu8MehcX7eR/q6l1QtioTZN8w7fw8xHldgf6HxBak | |
V9DdepEn0J4QybGRhzy6OAzfZ3n5yUgYK9CtgMUWwhCOetRGGQPCW9IeiUTnK/KV | |
rQKP5Gr6tIqzMy7JC6+TAiPotAgdijumn1dyvLmusqNFHFdO8djVKjtcGU0CAwEA | |
AQKCAgEAwqx3YzvvY7e0zmkx7mAak3PZizu5cuvBXL1PqLtjyHhh0G23WFzRdmbX | |
mzizSSCxB4uYZIO8FulpDKrxLpzjp8/PbfnlUr7R6COlF2Ch3si5uL0rRggOWW6N | |
srHSy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q | |
ofunQM94oi/C75LlxvwavgT0rySmfWH1METa7Ws6loa/sRVne/x1/9kVXfZwIvRc | |
LfWkYefOZNP0NPQTpQu5RsDyUYQZMycHSSef7gSMIPjr66soGWYv0+SnJtOfGP2n | |
cG7j438F0OHyNguA37//+cP/Jior6LbszHXyQy0IUJElBLxiAMC0Ul3MwtW+8pmB | |
izQN9ThDoRFOo8/m+yXuNqy6zNI9CnHANcpmmIf0Lm9RLHQt6jnXlepIa2p7QQ== | |
-----END RSA PRIVATE KEY-----''' | |
jwt.encode(payload, rsa_secret, 'PS256') | |
def test_encoding_PS512(): | |
payload = { | |
"sub": "1234567890", | |
"name": "John Doe", | |
"admin": True | |
} | |
rsa_secret = '''-----BEGIN RSA PRIVATE KEY----- | |
MIIJKgIBAAKCAgEAx3YK6rzBtSNl48i9ACb4P/c3DSHo6NsVmR7uVZB3on33zn+P | |
EJYC/ZV31e33x1gS/NUs+ECM/GNR2Kp0jUF4S2JfTwqw8zmy9eN1+4IkZvLDODw1 | |
vTEVy1Fm/a1BX741de1vVfZg0gssuGQw0Qj3Kmd++DKe6bpIpmLX8C01DKGA20re | |
5BqkwbvVc+934sLTv46+T3o1PWbtj419Lu/3AgMynMlwVBlk+o47kAaWow4HfDbo | |
FXaa1+4PTPUwbPuL96ePKPSPorIhxobftMayJifrUyvsYL15J+pVZy6vfaOGQbij | |
GVf7sin37Znan8L4ju3wH79Y6+Yhn5HpTth0GN/VJZqG7q2UPeNu7xafiPhKjWHf | |
UFddk23yOoP/imKxyTF9GgnUthMqhfnnUKEvrV94rVAjbLs4ek88CdYmAQiBaocX | |
dJQCuJjqoC73dTYnh1mrGwPc8O0oLfnp9aAs87xJ8EKRnp611QHXctedVoDQz5Bw | |
0/u5Rj34AaTOt14lvAjkZ+rXu8MehcX7eR/q6l1QtioTZN8w7fw8xHldgf6HxBak | |
V9DdepEn0J4QybGRhzy6OAzfZ3n5yUgYK9CtgMUWwhCOetRGGQPCW9IeiUTnK/KV | |
rQKP5Gr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0W | |
EAWaKOsKxrFJssawi0QwrP4r/M1DxGkAUh7pR788vDJDowN+QjNZawm7sIKz7H04 | |
BtOlqqOqY6oy/Zq21VEMSAj+N+V2+PBNNQKCAQEAiBRZm8poFWt7C2CKknz5/8F/ | |
OSbRL7GTKN9QZJKCAGjOlEgKQnISEggsairuHvqjtDyAserz0LB4qvTNydulSreq | |
ofunQM94oi/C75LlxvwavgT0rySmfWH1METa7Ws6loa/sRVne/x1/9kVXfZwIvRc | |
LfWkYefOZNP0NPQTpQu5RsDyUYQZMycHSSef7gSMIPjr66soGWYv0+SnJtOfGP2n | |
cG7j438F0OHyNguA37//+cP/Jior6LbszHXyQy0IUJElBLxiAMC0Ul3MwtW+8pmB | |
izQN9ThDoRFOo8/m+yXuNqy6zNI9CnHANcpmmIf0Lm9RLHQt6jnXlepIa2p7QQ== | |
-----END RSA PRIVATE KEY-----''' | |
jwt.encode(payload, rsa_secret, 'PS512') | |
def test_HS256(): | |
token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwiYWRtaW4iOnRydWUsIm5hbWUiOiJKb2huIERvZSJ9.A0BTRq6pEWPrLXDRWznVQ1mXi6qDSWv3cvvGrmIDZII' | |
secret = '''B=g2qPo.!VXr/66d~F%,|*<I7VAO | |
-`^z Fle | |
C | |
FZI\]AYFu)(dA?emO): | |
oD1n-jVqb"h%4LUg}4l,Jt6K#(!(kaa"`EY" | |
[!s2-"Ldt8dE: Oe,!^r#9<&"q39/eX5yN]j;0~~7 | |
z[yU+QG)N$De|5&+LB?LN:r\IGrc?kY-f\o<ul!Ly5r;6t;B]7 | |
V1iR6$,oj+*\0*<#u!N-RI]YH2Up-K *[a*5+-bDl2oi$f!|%Ck | |
H | |
;c2}s<:?va\$/q1C:$b/ORN6i",y | |
h k*\F*U;f%{F*aG nI$5>XpJsF | |
<3]M~DWI$T[I | |
_M7D\MAcq1[W-Rb! | |
=tq$1Y:20}Q-0,RiY#/R~A48tv[1i( | |
.XLIUYH | |
8@+ik;1jPku)c/N#I<f3b(we ,zX | |
yc-|XJ}cNz#uRv0/{dKs>z\!ZqJJ/h(+ | |
f5|Fl$+U\Q] | |
ww*oF3&ZN | |
O]co#:| | |
>:['L^J"LG'&DuigRRS"usBOt}\jtO,D._T | |
O\\O:iQ*f*!bl&&8g?b\efn">.%gJ;!F&L.CHF~W)Z1RoBGs>rFUwjJo~0e@ ,xW^~qix7[<z_J"BUv`^nY>> | |
T*'!S'yS%q#JzDrW[^r-MkpE 3Q]8=n_Qvc"~7 9p^\Q"\+bZA"HwED3|{#K!Uod?Ve> | |
DP"A9 | |
u4iM_mu1 | |
OY | |
pKnlii)-a&X,~+s)4$!]\2e,dX\>nWzr6Tx/3_dXI=>4n | |
@2_j^w;V'IJO=5reF8]~-ib>XR3]cO&&;C% 4IQ1t1nhQ_M*wUm0W@Uv_7vK >NShgsF8E2L]sIY\i#TNL?Ac+?WWfeg~"] | |
15 O1@ | |
D*7ycGV08q%'@-g5 i0 ;R:":`bi5z | |
C#qdly`a=2T?UUZ& | |
?(f | |
v''' | |
jwt.decode(token, secret, ['HS256']) | |
def test_HS512(): | |
token = 'eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwiYWRtaW4iOnRydWUsIm5hbWUiOiJKb2huIERvZSJ9.s6xMjJjp1g-JQEukPKnEDKYIinFC5CNTqZpe-geSF9Z4Lq-j7zstQW81WXkApzpM1NQblH2DZuTWa-IXarEFnQ' | |
secret = '''B=g2qPo.!VXr/66d~F%,|*<I7VAO | |
-`^z Fle | |
C | |
FZI\]AYFu)(dA?emO): | |
oD1n-jVqb"h%4LUg}4l,Jt6K#(!(kaa"`EY" | |
[!s2-"Ldt8dE: Oe,!^r#9<&"q39/eX5yN]j;0~~7 | |
z[yU+QG)N$De|5&+LB?LN:r\IGrc?kY-f\o<ul!Ly5r;6t;B]7 | |
V1iR6$,oj+*\0*<#u!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RqSAYB4GrPk9gv3NdAuOz8' | |
secret = '''-----BEGIN PUBLIC KEY----- | |
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAx3YK6rzBtSNl48i9ACb4 | |
P/c3DSHo6NsVmR7uVZB3on33zn+PEJYC/ZV31e33x1gS/NUs+ECM/GNR2Kp0jUF4 | |
S2JfTwqw8zmy9eN1+4IkZvLDODw1vTEVy1Fm/a1BX741de1vVfZg0gssuGQw0Qj3 | |
Kmd++DKe6bpIpmLX8C01DKGA20re5BqkwbvVc+934sLTv46+T3o1PWbtj419Lu/3 | |
AgMynMlwVBlk+o47kAaWow4HfDboFXaa1+4PTPUwbPuL96ePKPSPorIhxobftMay | |
JifrUyvsYL15J+pVZy6vfaOGQbijGVf7sin37Znan8L4ju3wH79Y6+Yhn5HpTth0 | |
GN/VJZqG7q2UPeNu7xafiPhKjWHfUFddk23yOoP/imKxyTF9GgnUthMqhfnnUKEv | |
rV94rVAjbLs4ek88CdYmAQiBaocXdJQCuJjqoC73dTYnh1mrGwPc8O0oLfnp9aAs | |
87xJ8EKRnp611QHXctedVoDQz5Bw0/u5Rj34AaTOt14lvAjkZ+rXu8MehcX7eR/q | |
6l1QtioTZN8w7fw8xHldgf6HxBakV9DdepEn0J4QybGRhzy6OAzfZ3n5yUgYK9Ct | |
gMUWwhCOetRGGQPCW9IeiUTnK/KVrQKP5Gr6tIqzMy7JC6+TAiPotAgdijumn1dy | |
vLmusqNFHFdO8djVKjtcGU0CAwEAAQ== | |
-----END PUBLIC KEY-----''' | |
jwt.decode(token, secret, ['RS512']) | |
def test_ES256(): | |
token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiJ9.eyJhZG1pbiI6dHJ1ZSwic3ViIjoiMTIzNDU2Nzg5MCIsIm5hbWUiOiJKb2huIERvZSJ9.GqbPYxG10kHPEoQ3mec6i3PS2IsNFv3jvVcLpLSyKTX8mDgDpZbhqdaMyMlp-KiNEUn-DfmFOmcVTD_2_ihjjw' | |
secret = '''-----BEGIN PUBLIC KEY----- | |
MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAElxvBJkhrRY4+P9satM2z+YR0ocbG3En1 | |
+DkEl3L737CSbXFDGuDsog1zphCTKHdC3l4Y/DCEJyfFmVCgsuYNXA== | |
-----END PUBLIC KEY-----''' | |
jwt.decode(token, secret, ['ES256']) | |
def test_ES512(): | |
token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzUxMiJ9.eyJhZG1pbiI6dHJ1ZSwic3ViIjoiMTIzNDU2Nzg5MCIsIm5hbWUiOiJKb2huIERvZSJ9.PSP-ZkDOrvG_ZP3T_FYSsHYyzcVTX114Ol78oNZAHOHYcoaa3uz0rCTGiQryw-SnoFgOplXJTgHIFWaXn65Omg' | |
secret = '''-----BEGIN PUBLIC KEY----- | |
MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAElxvBJkhrRY4+P9satM2z+YR0ocbG3En1 | |
+DkEl3L737CSbXFDGuDsog1zphCTKHdC3l4Y/DCEJyfFmVCgsuYNXA== | |
-----END PUBLIC KEY-----''' | |
jwt.decode(token, secret, ['ES512']) | |
def test_PS256(): | |
token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJQUzI1NiJ9.eyJhZG1pbiI6dHJ1ZSwibmFtZSI6IkpvaG4gRG9lIiwic3ViIjoiMTIzNDU2Nzg5MCJ9.FiQjaSTQm4B1oCQ3_UNqfOptRoVEaZWAvbA2m4yrQZHpL24kZd-yIdEOj1Px2jgKDbf8uvCJTThRspgjxknIDu8dlUru6Y9pchxoHjtWTa9RtO4khPlKQByNmPoOUTZw-pieD00jT914GgZHJA1M90c69f3twVi9UjAGZ6_NWvIEa1cMyralUvhoR5Dj2wwgNEU0k37JaZywlgc08AFNW4KC39UnCvYj0503oz2pX5j3rv2wFIe4mpYAeb6i5vt9ATKEPfHZfGyqymA1Bb41cN7MSO4Ln7hCwx2rmmBNa0tEx-hw33oauQ-2bqwDV4WLCmSPybgfZ0h7X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KP5Gr6tIqzMy7JC6+TAiPotAgdijumn1dy | |
vLmusqNFHFdO8djVKjtcGU0CAwEAAQ== | |
-----END PUBLIC KEY-----''' | |
jwt.decode(token, secret, ['PS256']) | |
def test_PS512(): | |
token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJQUzUxMiJ9.eyJuYW1lIjoiSm9obiBEb2UiLCJhZG1pbiI6dHJ1ZSwic3ViIjoiMTIzNDU2Nzg5MCJ9.XqumlS7pnQSjqIc9TAA40kpK3Okiv12ackXt5p7_QKNWMxgTgK6048rbLUCq5SsI1x4WXj9g05q7smx_rWtFnvDEWRoDzSAX_87ZSSMhIz0B7rE1J9M99G7IXi1D2v6FbF3ZfQyjvoQAv8qEFZOICp--XNAp8jLjE4_eoCY2AqdCAypn1WoabrOA8Ds8r7QbwdgAf3tYP5x5f8HwvDtmqsi3_J3rB_e39ZNjmdQl04AMMcEvO5Z8NpxC706lJyqGVUUfAKfAaQOQ3mA_D5Cf6eL2HrY_0QjP0fLjfN9mZtadF8kYhu_99D-A3gbhxghO1YMDRUd_LiJ4Ymwkj5pIX9wBq0dsOZXm6PERWq6LQc1ibJ2c3IcirOiQ4PnUiFsMcszGQC_lI2LF3SaQDyEHYtEuCO_d-nqiZAqI8iy0fAdssUXu6Wc0Eb0fNwWunb_7y9AMHbZ9C41f76UqzV-qZFrRVIZ7pELp0kKfU6iMhQe29ffjy8o32wn4GXXkvu0ddtmMZneP4eaa6pwllPdALJy9t5TeH65ZdLeVYjL7vVSD7rDNI4Vk38WqVINZFgDfZ8JTmKu7Us_j_QnClEo7yI707QP8f16kU7o6pMofnErf4p3ANqlPMEC-HVZwdRJ9bvUmO1EQ5UULioqR0rD65xyge_XTHF6OfmAs5Kq7jZ8' | |
secret = '''-----BEGIN PUBLIC KEY----- | |
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAx3YK6rzBtSNl48i9ACb4 | |
P/c3DSHo6NsVmR7uVZB3on33zn+PEJYC/ZV31e33x1gS/NUs+ECM/GNR2Kp0jUF4 | |
S2JfTwqw8zmy9eN1+4IkZvLDODw1vTEVy1Fm/a1BX741de1vVfZg0gssuGQw0Qj3 | |
Kmd++DKe6bpIpmLX8C01DKGA20re5BqkwbvVc+934sLTv46+T3o1PWbtj419Lu/3 | |
AgMynMlwVBlk+o47kAaWow4HfDboFXaa1+4PTPUwbPuL96ePKPSPorIhxobftMay | |
JifrUyvsYL15J+pVZy6vfaOGQbijGVf7sin37Znan8L4ju3wH79Y6+Yhn5HpTth0 | |
GN/VJZqG7q2UPeNu7xafiPhKjWHfUFddk23yOoP/imKxyTF9GgnUthMqhfnnUKEv | |
rV94rVAjbLs4ek88CdYmAQiBaocXdJQCuJjqoC73dTYnh1mrGwPc8O0oLfnp9aAs | |
87xJ8EKRnp611QHXctedVoDQz5Bw0/u5Rj34AaTOt14lvAjkZ+rXu8MehcX7eR/q | |
6l1QtioTZN8w7fw8xHldgf6HxBakV9DdepEn0J4QybGRhzy6OAzfZ3n5yUgYK9Ct | |
gMUWwhCOetRGGQPCW9IeiUTnK/KVrQKP5Gr6tIqzMy7JC6+TAiPotAgdijumn1dy | |
vLmusqNFHFdO8djVKjtcGU0CAwEAAQ== | |
-----END PUBLIC KEY-----''' | |
jwt.decode(token, secret, ['PS512']) | |
result = timeit.timeit('test_HS256()', setup='from __main__ import test_HS256', number=cycle_nbr) | |
print('decode / verify time HS256 :', result/cycle_nbr) | |
result = timeit.timeit('test_HS512()', setup='from __main__ import test_HS512', number=cycle_nbr) | |
print('decode / verify time HS512 :', result/cycle_nbr) | |
result = timeit.timeit('test_ES256()', setup='from __main__ import test_ES256', number=cycle_nbr) | |
print('decode / verify time ES256 :', result/cycle_nbr) | |
result = timeit.timeit('test_ES512()', setup='from __main__ import test_ES512', number=cycle_nbr) | |
print('decode / verify time ES512 :', result/cycle_nbr) | |
result = timeit.timeit('test_RS256()', setup='from __main__ import test_RS256', number=cycle_nbr) | |
print('decode / verify time RS256 :', result/cycle_nbr) | |
result = timeit.timeit('test_RS512()', setup='from __main__ import test_RS512', number=cycle_nbr) | |
print('decode / verify time RS512 :', result/cycle_nbr) | |
result = timeit.timeit('test_PS256()', setup='from __main__ import test_PS256', number=cycle_nbr) | |
print('decode / verify time PS256 :', result/cycle_nbr) | |
result = timeit.timeit('test_PS512()', setup='from __main__ import test_PS512', number=cycle_nbr) | |
print('decode / verify time PS512 :', result/cycle_nbr) | |
result = timeit.timeit('test_encoding_HS256()', setup='from __main__ import test_encoding_HS256', number=cycle_nbr) | |
print('encode time HS256 :', result/cycle_nbr) | |
result = timeit.timeit('test_encoding_HS512()', setup='from __main__ import test_encoding_HS512', number=cycle_nbr) | |
print('encode time HS512 :', result/cycle_nbr) | |
result = timeit.timeit('test_encoding_ES256()', setup='from __main__ import test_encoding_ES256', number=cycle_nbr) | |
print('encode time ES256 :', result/cycle_nbr) | |
result = timeit.timeit('test_encoding_ES512()', setup='from __main__ import test_encoding_ES512', number=cycle_nbr) | |
print('encode time ES512 :', result/cycle_nbr) | |
result = timeit.timeit('test_encoding_RS256()', setup='from __main__ import test_encoding_RS256', number=cycle_nbr) | |
print('encode time RS256 :', result/cycle_nbr) | |
result = timeit.timeit('test_encoding_RS512()', setup='from __main__ import test_encoding_RS512', number=cycle_nbr) | |
print('encode time RS512 :', result/cycle_nbr) | |
result = timeit.timeit('test_encoding_PS256()', setup='from __main__ import test_encoding_PS256', number=cycle_nbr) | |
print('encode time PS256 :', result/cycle_nbr) | |
result = timeit.timeit('test_encoding_PS512()', setup='from __main__ import test_encoding_PS512', number=cycle_nbr) | |
print('encode time PS512 :', result/cycle_nbr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment