| If you are going to use JWT besides its failings, you should use it safely. But not all advice in this piece is equally strong. 1. RS256 vs ES256 - you shouldn't use either. RS256 not just an old standard on the way out. With safe keys sizes tokens are often going to be too large and signing too slow for you. ES256 on the other hand, suffers from many theoretical flaws and at least one practical flaw that (complete breakdown if nonce is reused) that helped jailbreak the PS3. The only reasonable asymmetric signature algorithms implemented for JWT are Ed25519 and Ed448, but they are still not supported by most libraries. 2. Key IDs - always include them, even if you're just using 1 key for now. Otherwise you cannot rotate keys securely without having to reject all existing tokens. 3. Have relatively short lifetimes for JWTs if you're not using a blacklist. A token that lasts for 180 days with no possible way to revoke it is a dangerous little thing. 4. Always verify that you only accept JWTs signed by the algorithm you're expecting. Otherwise you might be fooled by a JWT signed with HMAC-SHA256 by your RSA public key (which is known to the attacker:
https://auth0.com/blog/critical-vulnerabilities-in-json-web-... 5. Under no circumstances accept tokens signed with "none". The standard is just bonkers. 6. Rotate keys every month if you can, not every 2 years. This is keeping your joints well-oiled. 7. Damage control is still possible when using JSON Web Signature (JWS). JSON Web Encryption (JWE), on the other hand, is just a train wreck that is very hard t ouse properly. Avoid it all costs. PASETO provides a viable alternative for most cases it makes sense to use an encrypted token. 8. If you can avoid JWT, just avoid it. It's just too hard to implement securely. In the past there weren't any widespread alternatives, but PASETO is supported in most common platforms now and is clearly a better option. https://paragonie.com/blog/2017/03/jwt-json-web-tokens-is-ba... |
I agree that JWT has all sorts of flexibility that make it hard to use well but NIST curves work just fine.
If you think they are backdoored then sure, Ed25519 is a better option but real world constraints may require you to use a NIST curve for now.