14

I'm trying to obtain the public key from my priv key generated via this command:

openssl genpkey -algorithm Ed25519 -out ed25519key.pem

Following this docs: https://github.com/openssl/openssl/blob/master/doc/man1/genpkey.pod

But I'm lost trying to figure out how to generate the public key from the priv key. Also, is there a way to specify the length of the key?

2
  • 3
    This belongs on superuser IMO. Commented May 2, 2018 at 11:38
  • No, you cannot specify "the length of the key", because Ed25519 is defined with precisely 256 bits of key.
    – foo
    Commented Dec 26, 2018 at 19:25

1 Answer 1

18

I'm trying to obtain the public key from my priv key...

Getting the public key from the private key is generally done using pkey, not only for Ed25519:

$ openssl pkey -in ed25519key.pem -pubout

Also, is there a way to specify the length of the key?

There is no variable key length with Ed25519.

2
  • 1
    You are right, so I will mark as correct your answer, however, something interesting to point out is that the private key generated is concatenated with the public key, so the output of openssl genpkey is a concatenation of priv key (32 Bytes left) and public key (32 Bytes right).
    – Jose Lopez
    Commented May 3, 2018 at 10:31
  • 2
    That's generally true for all asymmetric key types currently in use – the private key directly contains all public parameters in it. Commented May 3, 2018 at 19:00

You must log in to answer this question.