用过ssh的朋友都知道,ssh key的类型有不少种,好比dsa、rsa、 ecdsa、ed25519等,那这么多种类型,咱们要如何选择呢?算法
今天看到一篇相关文章,写的挺好的,在这里分享下。安全
在具体看这篇文章以前,咱们先说结论:微信
再总结一下:less
若是能够的话,优先选择ed25519,不然选择rsa。ssh
$ ssh-keygen -t ed25519
如下是原文:ide
OpenSSH supports several signing algorithms (for authentication keys) which can be divided in two groups depending on the mathematical properties they exploit: DSA and RSA, which rely on the practical difficulty of factoring the product of two large prime numbers, ECDSA and Ed25519, which rely on the elliptic curve discrete logarithm problem. (example) Elliptic curve cryptography (ECC) algorithms are a more recent addition to public key cryptosystems. One of their main advantages is their ability to provide the same level of security with smaller keys, which makes for less computationally intensive operations (i.e. faster key creation, encryption and decryption) and reduced storage and transmission requirements. OpenSSH 7.0 deprecated and disabled support for DSA keys due to discovered vulnerabilities, therefore the choice of cryptosystem lies within RSA or one of the two types of ECC. #RSA keys will give you the greatest portability, while #Ed25519 will give you the best security but requires recent versions of client & server[2]. #ECDSA is likely more compatible than Ed25519 (though still less than RSA), but suspicions exist about its security (see below).
更多原创文章,请关注我微信公众号:工具