前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >ssh key类型这么多,要如何选择呢?

ssh key类型这么多,要如何选择呢?

作者头像
KINGYT
发布2019-08-26 10:19:02
8.3K0
发布2019-08-26 10:19:02
举报

用过ssh的朋友都知道,ssh key的类型有很多种,比如dsa、rsa、 ecdsa、ed25519等,那这么多种类型,我们要如何选择呢?

今天看到一篇相关文章,写的挺好的,在这里分享下。

在具体看这篇文章之前,我们先说结论:

1. ssh key的类型有四种,分别是dsa、rsa、 ecdsa、ed25519。

2. 根据数学特性,这四种类型又可以分为两大类,dsa/rsa是一类,ecdsa/ed25519是一类,后者算法更先进。

3. dsa因为安全问题,已不再使用了。

4. ecdsa因为政治原因和技术原因,也不推荐使用。

5. rsa是目前兼容性最好的,应用最广泛的key类型,在用ssh-keygen工具生成key的时候,默认使用的也是这种类型。不过在生成key时,如果指定的key size太小的话,也是有安全问题的,推荐key size是3072或更大。

6. ed25519是目前最安全、加解密速度最快的key类型,由于其数学特性,它的key的长度比rsa小很多,优先推荐使用。它目前唯一的问题就是兼容性,即在旧版本的ssh工具集中可能无法使用。不过据我目前测试,还没有发现此类问题。

再总结一下:

如果可以的话,优先选择ed25519,否则选择rsa。

代码语言:javascript
复制
$ ssh-keygen -t ed25519

以下是原文:

代码语言:javascript
复制
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).

更多相关介绍,请点击阅读原文。

完。

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2019-08-23,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 Linux内核及JVM底层相关技术研究 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
全站加速网络
全站加速网络(Enterprise Content Delivery Network,以下简称 ECDN)为您提供稳定高效的网络加速服务,适用于动静混合、纯动态、跨国、上传等多种加速场景。ECDN 网络资源丰富,同时融合静态缓存、智能路由、协议优化、多路传输、抗抖动等自研技术,加速效果更加显著;接入便捷,功能配置灵活多样,可满足您个性化的业务需求。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档