参考网站:
http://www.madboa.com/geek/openssl/
go to the folder in terminal.
1. openssl genrsa -out mykey.pem 1024
2.openssl rsa -in mykey.pem -pubout > mykey.pub extract the public key and print that out.
This is what happen in terminal:
lin-wangs-MacBook-Pro:key
linwang$ openssl genrsa -out private.pem 1024
Generating RSA private key, 1024 bit long modulus
........++++++
............++++++
e is 65537 (0x10001)
lin-wangs-MacBook-Pro:key linwang$ openssl rsa -in private.pem -pubout > public.pub
writing RSA key