How to verify that a JWT is legit?

Thanks for the answers, i recently learned about asymmetric, i was more used to hashcash, i try to verify the token in apex salesforce, do you have any ressources on this? because in apex there isn’t much documentation and no libraries or sdk.

there is a function like this:

Crypto.verify('RSA-SHA256', payload, signature, publickey)

But it doesn’t work, how would you do?