Github currently suggest this type of key:

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

Is there a stronger algorithm or byte length mostly usable for most contemporary cloud, PaaS and IaaS services?

(i.e. for common ops and dev-ops services such as EC2, Heroku, OpenShift, TravisCI, DigitalOcean and so forth...)


Right now, a 2048-bit RSA key, or any greater length (such as the 4096-bit key size of the Github suggestion), is unbreakable with today's technology and known factorization algorithms. Even with very optimistic assumptions on the future improvements of computational power available for a given price (namely, that Moore's law holds at its peak rate for the next three decades -- and Gordon Moore himself stated that he does not find such an assumption plausible), a 2048-bit RSA key won't become breakable within the next 30 years by Mankind as a whole, let alone by an Earth-based organization.

There is no meaningful notion of "strength" that goes beyond the "cannot be broken" stage. As such, one cannot claim that RSA-4096, or any other algorithm, would be "stronger". An additional point is that SSH keys are used only for authentication: breaking your key would allow impersonating you when connecting to the server, but would not help in decrypting past recorded sessions. Thus, for the connections that you do today, you do not need to worry about attacks that might be doable tomorrow. All you have to do is to change your key whenever it seems that such a key would become close to being breakable, which won't happen within the next few decades.

Of course, there always remains the possibility of some unforeseen mathematical breakthrough that makes breaking RSA keys a lot easier. Unforeseen breakthroughs are, by definition, unpredictable, so any debate on that subject is by nature highly speculative. One can remark that RSA is a problem which has been around for some time (RSA itself was defined in 1978, but the underlying numerical problem -- integer factorization -- has been studied for more than 2500 years) and for which the latest significant improvements are aging (General Number Field Sieve was invented in the 1980s). Thus, one can claim that if there is a fast RSA-breaking algorithm, then it is certainly not obvious.

You can find a lot of information on estimating key strength on this site.

To sum up, the RSA-4096 that Github suggests is already a huge overkill, and is not the weakest point of your security, by far. Probability that your home computer goes under hostile control by some malware is far greater than probability that someone succeeds at breaking your RSA key. And even if RSA was becoming flaky, you would just have to change your algorithm and/or key size at that moment.

| improve this answer | |
  • 1
    Well said. To reinforce one point: passwords and keys are just one aspect of security -- a 4096 bit key whose private part is sent to your coworker via text or chat is far less secure than a 2048 bit key you have kept safe. – Tom Harrison Jr Feb 21 '16 at 17:53
  • 1
    Is there any advantage to using a 2048-bit key over a larger one, outside security concerns? – still_dreaming_1 Feb 24 '17 at 18:38
  • 8
    @still_dreaming_1 I hear bigger keys may help in picking up girls. (I also heard that it does not actually work, so your mileage may vary.) – Thomas Pornin Feb 24 '17 at 19:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.