From the article Create SSH Key Using PEM, RSA and ED25519 :
Generate a PEM key pair on Linux
This can be generated based on two algorithms previously covered above which are rsa and ed25519.
To generate a pem format key pair based on rsa algorithm, open your terminal and run the following command:
ssh-keygen -t rsa -b 4096 -m PEM -C [email protected]
To generate pem key pair based on ed25519 algorithm, use the following command
ssh-keygen -t ed25519 -m PEM -C [email protected]
Remember you can change the key size -b 4096 to any size of your choice which should be factors of 1024 like 2048, 4096 and 8192 which matches the computer memory space allocation (*in simpler terms)
Factors to note
- On the prompt for key name, enter an absolute path with a new file name that does not exist in the destination path to create a new key, or with a name that exists to overwrite the existing key in the entered path location.
- Using the default path, will overwrite any keys created prior to the current generation using the default key name.
- On the paraphrase prompt you may enter any paraphrase of your choice but you must save it securely since you wont be able to use the private key without its paraphrase.
- You can actually enter no paraphrase and create an open key pair which means anyone with access to this private key may use it freely.