No private key?
As document
The JWT is signed using a RS256 key. To verify the JWT we can use the public key provided by ORY Oathkeeper's JWKS API:
http://127.0.0.1:4456/.well-known/jwks.json
When verify JWT in header
Steps to reproduce the behavior:
- Use jwt way run this project
- Got jwt string
eyJhbGciOiJSUzI1N..... - Use jwks-rsa package,got public key from jwks.json
- Put jwt string and above public key in to jwt.io,got below
Only public key and no private key.Why not use private key as a pair to generate JWT,is this as expect by design?RSA should be appear always with public and private key.
Any misunderstanding?
I think you’re confusing something. The set up is correct. The private key is not exposed, it would be a security issue. The public key is properly being used for verification.
@aeneasr thanks,for more I want know, 1.the public key in jwks.json expose for all,every one can get jwt,and verify,the private key has nothing effect? 2.as RSA,should encrypt with private key and decrypt with private key too,but it seems no private key's work,why? 2.where is the private key,if a thirdpart app use this jwt,should use private key for decrypt?
The private key is used to generate the signature, the public key is used to verify it. The private key is private (as the name says) and is not exposed. The private key is owned by ORY Oathkeeper in this example. We used a pre-generated key which you can find here.
NEVER EXPOSE THE PRIVATE KEY TO ANYONE. JUST KEEP IT PRIVATE.
Learn more about JWT and asymmetric cryptography here:
- https://blog.miguelgrinberg.com/post/json-web-tokens-with-public-key-signatures
- https://jwt.io/introduction/
@aeneasr thanks for your kindness,just start a project,plan to use ory for passport etc.