用過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).
更多原創文章,請關注我微信公衆號:工具