I generated a private and a public key using OpenSSL with the following commands:
openssl genrsa -out private_key.pem 512 openssl rsa -in private_key.pem -pu
You can generate private key by ssh-keygen:
ssh-keygen -t rsa
and generate public key like this:
ssh-keygen -e -m pem -f xxx > pubkey.pem
http://blog.oddbit.com/2011/05/08/converting-openssh-public-keys/