Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generating public ed25519 key with OpenSSL

I'm using this command to generate private ed25519 key:

openssl genpkey -algorithm ed25519 -out private.pem

and this is the example result:

-----BEGIN PRIVATE KEY-----
MC4CAQAwBQYDK2VwBCIEIAYIsKL0xkTkAXDhUN6eDheqODEOGyFZ04jsgFNCFxZf
-----END PRIVATE KEY-----

So then I want to generate a public key based on this private key and I do it like this:

openssl pkey -in private.pem -out public.pem

but with this command I still get a private key that looks like this:

-----BEGIN PRIVATE KEY-----
MC4CAQAwBQYDK2VwBCIEIAYIsKL0xkTkAXDhUN6eDheqODEOGyFZ04jsgFNCFxZf
-----END PRIVATE KEY-----

Additionally, this private and "public" key is not 32-bytes, but 64. What's wrong with my command?

like image 353
Szyszka947 Avatar asked Sep 12 '25 06:09

Szyszka947


1 Answers

This will return the public key as a file.

openssl pkey -in private.pem -pubout -out public.pem
like image 143
Danny G Avatar answered Sep 14 '25 05:09

Danny G