go-utils/utils/jwt/README.md

24 lines
742 B
Markdown
Raw Normal View History

2018-01-24 08:37:57 +00:00
`jwt` command-line tool
=======================
2018-01-24 08:39:44 +00:00
This is a simple tool to sign, verify and show JSON Web Tokens from the command line.
2018-01-24 08:37:57 +00:00
```shell
# 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
```shell
# generate key
$ ssh-keygen -t rsa -b 2048 -f jwtRS256.key
$ openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
```