I understand JWT is secured. But just wanted to know some concepts which I couldn't understand.
Assume authentication server "A" sends the signed token to application server. If I am not wrong The signing is done by Private key on Server "A". Now the App server can decrypt the token and validate information using Public key. I also read JWT is self contained, it holds both data and signature.
Some of the examples I seen doesn't use any secured key while validating. If I am not wrong RS256 doesn't require any specific keys, I assume it will use public certificates to decrypt.
The query I have is, If JWT is self contained, why cant the data changed in between.
For example assume server "A" sends following information
header.user1email.signature
If The hacker replaces data to
header.user2email.signature
using his own private key, how come that could be a valid data? How can be sure that it has come from server "A"?
I understand am missing some basics here, please help?