Bug 3195 - ssh-keygen unable to convert ED25519 public keys
Summary: ssh-keygen unable to convert ED25519 public keys
Status: NEW
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh-keygen (show other bugs)
Version: 8.2p1
Hardware: amd64 Linux
: P5 enhancement
Assignee: Assigned to nobody
URL:
Keywords:
: 3298 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-07-19 03:54 AEST by Marcos Alano
Modified: 2023-01-18 03:24 AEDT (History)
5 users (show)

See Also:


Attachments
support reading PKCS8 Ed25519 keys (2.77 KB, patch)
2020-07-24 15:51 AEST, Damien Miller
no flags Details | Diff
hello moto (12 bytes, text/plain)
2021-06-01 15:02 AEST, guanlong
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marcos Alano 2020-07-19 03:54:21 AEST
I generate a ED25519 key using OpenSSL:
openssl genpkey -algorithm ED25519 -out key_ed25519.pem
After that I extracted the public key:
openssl pkey -in key_ed25519.pem -pubout -out public_ed25519.pem
And then I try to get the SSH public key to put on authorized_keys:
ssh-keygen -i -m PKCS8 -f public_ed25519.pem
The error was:
do_convert_from_pkcs8: unsupported pubkey type 1087
So I think ssh-keygen can't convert a ED25519 public key. The expected result was something like:
ssh-ed25519 AAAA...
I found a tool called sshpk (https://www.npmjs.com/package/sshpk) which converts correctly:
sshpk-conv public_ed25519.pem -t ssh
The output is what I should expect.
Comment 1 Damien Miller 2020-07-24 15:51:20 AEST
Created attachment 3433 [details]
support reading PKCS8 Ed25519 keys

OpenSSH doesn't currently support reading or writing Ed25519 keys in any format other than the OpenSSH native key format.

Not all libcrypto implementations support Ed25519 keys, in particular LibreSSL does not.

This patch adds support for reading PKCS8 Ed25519 keys on recent OpenSSL, but it can't be upstreamed until LibreSSL supports these keys too.
Comment 2 Damien Miller 2021-04-30 14:04:50 AEST
*** Bug 3298 has been marked as a duplicate of this bug. ***
Comment 3 ricky.tigg 2021-04-30 20:23:52 AEST
Patch providing basic support of Ed25519 keys via PKCS#11 tokens: https://github.com/openssh/openssh-portable/pull/230
Comment 4 guanlong 2021-06-01 15:02:49 AEST
Created attachment 3525 [details]
hello moto
Comment 5 Evan Carroll 2023-01-18 03:24:46 AEDT
(In reply to Damien Miller from comment #1)
> it can't be upstreamed until LibreSSL supports these
> keys too.

Should this be re-evaluated now that LibreSSL supports ed25519 with 3.7.0 released Dec 12, 2022?

https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.7.0-relnotes.txt