For generating a SSH KEY please see this command blog.

If you have generated your ssh key you have to convert it to PEM format for avoiding ‘unable to load key error’.

Dcrypt message:
openssl rsautl -decrypt -in ~/encrypted_by_public_ssh_key.txt -out ~/decrypted_by_private_key.txt -inkey ~/.ssh/id_rsa_app

Encrypt message:
echo "this is a test message" | openssl rsautl -encrypt -pubin -inkey ~/.ssh/id_rsa_app.pem.pub > ~/encrypted_by_public_ssh_key.txt

Convert current public ssh key file to PEM format:
ssh-keygen -f ~/.ssh/id_rsa_app.pub -e -m PKCS8 > id_rsa_app.pem.pub

If you need to convert the your private ssh key file to PEM format:
ssh-keygen -p -m PEM -f ~/.ssh/id_rsa

For creating a new SSH key in PEM format:
ssh-keygen -m PEM -t rsa -b 4096 -C "youremail@address.com"