I've been refactoring our JWT signing and verifying structure to something more secure. I've used this article as a starting place (and taking the suggestion of using the RS256 algorithm as opposed to the HS256 algorithm): https://medium.com/@siddharthac6/json-web-token-jwt-the-right-way-of-implementing-with-node-js-65b8915d550e and it recommends using 512 bit keys saying
"Its almost impossible to make a brute force search on a 256-bit key"
But, when I look for an openssl script to generate this token, I reach this page which defaults to a 4096 bit key: https://gist.github.com/ygotthilf/baa58da5c3dd1f69fae9 with one user quoting RSA which says:
RSA claims that [...] 2048-bit keys are sufficient until 2030.
It feels like there is conflicting information. In essence, my question is what jwt algorithm and key size should I use for an enterprise application and is RS256 + 512 bit keys enough (what I switched to)? I somewhat understand the trade-off of security and speed, but I'm confused why 512 bit keys are suggested in the medium article, but not even mentioned in that github script and RSA says even 2048 bit keys may be outdated by 2030.
Thank you.