Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert OpenSSH ED25519 Private Key Format to PEM format

I have generated a an ED25519 SSH key pair using

ssh-keygen -t ed25519

The output of the id_ed25519 file is in OpenSSH format:

-----BEGIN OPENSSH PRIVATE KEY-----
...
-----END OPENSSH PRIVATE KEY-----

I would like to convert it to a PEM file format. If it were an RSA key pair, there would be no need for that as an RSA id_rsa key is already in a PEM file format but the ED25519 key pair is an OpenSSH format.

How can I convert this to a PEM file format?

like image 731
Ferit Avatar asked Dec 04 '20 08:12

Ferit


People also ask

Can I convert an OpenSSH private key to a pem file?

-----END OPENSSH PRIVATE KEY----- I would like to convert it to a PEM file format. If it were an RSA key pair, there would be no need for that as an RSA id_rsa key is already in a PEM file format but the ED25519 key pair is an OpenSSH format.

Can I convert id_ed25519 to a pem file format?

The output of the id_ed25519 file is in OpenSSH format: -----BEGIN OPENSSH PRIVATE KEY----- ... -----END OPENSSH PRIVATE KEY----- I would like to convert it to a PEM file format. If it were an RSA key pair, there would be no need for that as an RSA id_rsa key is already in a PEM file format but the ED25519 key pair is an OpenSSH format.

What key formats are supported for OpenSSH private keys?

The latter may be used to convert between OpenSSH private key and PEM private key formats. The supported key formats are: “RFC4716” (RFC 4716/SSH2 public or private key), “PKCS8” (PKCS8 public or private key) or “PEM” (PEM public key).

How do I convert an OpenSSL key to PEM?

Convert openssl.key file to.pem For converting.key file to.pem file, Your keys may already be in PEM format, but just named with.crt or.key. If they begin with -----BEGIN and you can read them in a text editor (they use base64, which is readable in ASCII, not binary format), they are in PEM format.


1 Answers

Use

ssh-keygen -p -f path/to/your/key -m pem 

to convert your key file to PEM, but be sure to make a backup of the file first.

Taking from https://github.com/pickware/github-action-ssh-agent

like image 56
Wolfgang Blessen Avatar answered Sep 30 '22 11:09

Wolfgang Blessen