代码之家  ›  专栏  ›  技术社区  ›  arielnmz

ssh keygen忽略-t参数

  •  1
  • arielnmz  · 技术社区  · 6 年前

    我正在尝试使用以下命令生成一个新的密钥对

    ssh-keygen -t rsa -f id_rsa
    

    -t param应指明键的格式:

    ssh-keygen [-q] [-b bits] [-t dsa | ecdsa | ed25519 | rsa] [-N new_passphrase] [-C comment] [-f output_keyfile]
    [...]
    The type of key to be generated is specified with the -t option.  If invoked without any arguments, ssh-keygen will generate
         an RSA key.
    [...]
    -t dsa | ecdsa | ed25519 | rsa
         Specifies the type of key to create.  The possible values are “dsa”, “ecdsa”, “ed25519”, or “rsa”
    

    ed25519 格式:

    $ head id_rsa
    -----BEGIN OPENSSH PRIVATE KEY-----
    [...]
    

    1 回复  |  直到 6 年前
        1
  •  3
  •   dave_thompson_085    6 年前

    梅塔:这不是一个编程问题或问题,可能属于另一个堆栈,但我不确定是哪个堆栈,所以我将留给任何想建议移动的人。

    -t 选择算法的类型(aka算法) 钥匙 它存储在(除长期过时和现在已删除的类型之外) rsa1 与SSH1格式相关)。您可能有7.8,默认情况下,它对所有类型都使用“new”文件格式,而在此之前,它只对ed25519使用默认格式。新的文件格式确实(而且已经)支持所有类型,但在旧版本中,只有在指定了 -o See the release notes 它描述了如何回到“遗留”格式,或者 ssh-keygen 下的手册页 -m .

    ssh-keygen -m PKCS8 如果你对这些密钥文件的安全性感兴趣,我将挖掘一些关于这个主题的现有Qs;我肯定至少见过一打。

    推荐文章