go-utils/utils/jwt
2018-07-31 17:06:12 +08:00
..
key add jwt tools 2018-01-24 16:37:57 +08:00
demo.json 站点更新:2018-07-31 17:06:12 2018-07-31 17:06:12 +08:00
main.go Optimize code 2018-01-25 09:45:24 +08:00
README.md add jwt tools 2018-01-24 16:39:44 +08:00

jwt command-line tool

This is a simple tool to sign, verify and show JSON Web Tokens from the command line.

# The following will create and sign a token
$ echo {\"foo\":\"bar\"} | ./jwt -key key/jwtRS256.key -alg RS256 -sign -

# then verify it and output the original claims:
$ echo {\"foo\":\"bar\"} | ./jwt -key key/jwtRS256.key -alg RS256 -sign - | ./jwt -key key/jwtRS256.key.pub -alg RS256 -verify -

# To simply display a token, use:
$ echo {\"foo\":\"bar\"} | ./jwt -key key/jwtRS256.key -alg RS256 -sign - | ./jwt -show -

generate rsa256 key

# generate key
$ ssh-keygen -t rsa -b 2048 -f jwtRS256.key

$ openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub