Skip to content

Instantly share code, notes, and snippets.

@hummus
Last active February 8, 2018 06:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hummus/29bd7b93b76f3d5fdd660d2bb11aa1d9 to your computer and use it in GitHub Desktop.
Save hummus/29bd7b93b76f3d5fdd660d2bb11aa1d9 to your computer and use it in GitHub Desktop.
jwt RS512 encode
echo '{"foo": true}' | python -c "from jwt.api_jws import PyJWS;from cryptography.hazmat.backends import default_backend;from cryptography.hazmat.primitives.serialization import load_pem_private_key; jws=PyJWS(); pk = load_pem_private_key(open('key.pem').read(), password=None, backend=default_backend()); import sys; msg = jws.encode(sys.stdin.read(), pk, algorithm='RS512'); print msg"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment