openssl genrsa -out key.priv 1024
openssl rsa -in key.priv -out key.pub -pubout
The key pair generated above can be used as follows:
- distribute the public key so that messages can be encrypted using the public key
- use the private key to decrypt them
Whenever there is the need for a password, the ssh format for RSA and DSA keys can be used. An ssh key-pair can be generated in the following way.
ssh-keygen -t rsa -b 2048