我正在尝试ed25519-sk
在 Ubuntu 20.04.03 LTS 中生成 SSH 密钥。但是,我255
尝试时收到错误代码。我使用的是 OpenSSH 版本:OpenSSH_8.2p1 Ubuntu-4ubuntu0.3, OpenSSL 1.1.1f 31 Mar 2020
。我的硬件密钥是 Google Titan 密钥。请参阅下文了解我使用的命令及其输出:
$ ssh-keygen -vvv -t ed25519-sk
Generating public/private ed25519-sk key pair.
You may need to touch your authenticator to authorize key generation.
debug3: start_helper: started pid=12407
debug3: ssh_msg_send: type 5
debug3: ssh_msg_recv entering
debug1: start_helper: starting /usr/lib/openssh/ssh-sk-helper
debug1: sshsk_enroll: provider "internal", device "(null)", application "ssh:", userid "(null)", flags 0x01, challenge len 0
debug1: sshsk_enroll: using random challenge
debug1: ssh_sk_enroll: using device /dev/hidraw9
debug1: ssh_sk_enroll: fido_dev_make_cred: FIDO_ERR_INVALID_ARGUMENT
debug1: sshsk_enroll: provider "internal" returned failure -1
debug1: ssh-sk-helper: Enrollment failed: invalid format
debug1: ssh-sk-helper: reply len 8
debug3: ssh_msg_send: type 5
debug1: client_converse: helper returned error -4
debug3: reap_helper: pid=12407
Key enrollment failed: invalid format
但是,生成ecdsa-sk
SSH 密钥没有任何问题:
$ ssh-keygen -vvv -t ecdsa-sk
Generating public/private ecdsa-sk key pair.
You may need to touch your authenticator to authorize key generation.
debug3: start_helper: started pid=12509
debug3: ssh_msg_send: type 5
debug3: ssh_msg_recv entering
debug1: start_helper: starting /usr/lib/openssh/ssh-sk-helper
debug1: sshsk_enroll: provider "internal", device "(null)", application "ssh:", userid "(null)", flags 0x01, challenge len 0
debug1: sshsk_enroll: using random challenge
debug1: ssh_sk_enroll: using device /dev/hidraw9
debug3: ssh_sk_enroll: attestation cert len=349
debug1: ssh-sk-helper: reply len 669
debug3: ssh_msg_send: type 5
debug3: reap_helper: pid=12509
Enter file in which to save the key (/home/username/.ssh/id_ecdsa_sk):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/username/.ssh/id_ecdsa_sk
Your public key has been saved in /home/username/.ssh/id_ecdsa_sk.pub
The key fingerprint is:
SHA256:H9n8rBxJUB9Gdk9QfSKY8hhKX9ufBlD5rX9iZk18rYw username@hostname
The key's randomart image is:
+-[ECDSA-SK 256]--+
| +oo*o=|
| . o =.o+.++|
| . o *.+ o.oo|
| . o o=o . .|
| S o +o +.|
| . o += =|
| . o+o=.|
| .EoB +|
| o+ ..|
+----[SHA256]-----+
我是不是做错了什么,或者这是一个 bug?如果这是一个 bug,有没有什么已知的解决方法?
谢谢!
编辑:添加了我正在使用的硬件密钥的类型。
答案1
如果您使用的是 YubiKey 5,id_ed25519 仅在更高版本的固件(v5.2.3)中可用1而 id_ecdsa 始终可用。