# generate private key
openssl genrsa -out myprivate.key
# extract the public key from the private key
openssl rsa -in myprivate.key -pubout -out mypublic.key
# generate the CSR from the private key, CSR only contains the pulic key
openssl req -new -key myprivate.key -out mypublic.csr
root@myubuntu:~/1026# openssl req -new -key myprivate.key -out mypublic.csr
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:
State or Province Name (full name) [Some-State]:
Locality Name (eg, city) []:
Organization Name (eg, company) [Internet Widgits Pty Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:www.123.com
Email Address []:
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
root@myubuntu:~/1026#
root@myubuntu:~/1026# cat mypublic.csr
-----BEGIN CERTIFICATE REQUEST-----
MIICoDCCAYgCAQAwWzELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUx
ITAfBgNVBAoMGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEUMBIGA1UEAwwLd3d3
LjEyMy5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCxsSjpalCQ
opuQmxgD2noFbI7vUAjEaAVrd/2NAdLgmM206qHl1NJE7GZdvWNQuooNeSbExlNd
uzW5127M819Ir8Bfyf1/mOo2JPrZWV8okWjWZx+H2F7jpFj62j0dy+V55UxjSzDa
t0zCLD74EqtJxgU1mkIm4yWh/o0EgtYnwNxkhs0d3O4nwq0nhC//eGDyjODWD9sd
++5oki+ZyM0zJMd306K0eBIqBVdrxB7gjixebfR9q8Ps68k0pW8PydxVneqew9z/
4kbBZvc5Lpetu/1i4Z67uU1qxy4am70thkqCOi3nsMiv20gdszTEkHtYoknxSX2m
2hYcdAxHQFXdAgMBAAGgADANBgkqhkiG9w0BAQsFAAOCAQEAezIk+c+2QCaGKbO5
wtuk2znS/1MySIn933ru6hfNF3EzyaLwMaSDlsLP+xfV5wodmhMFJBgtGHsG/r2m
0mxd2zyY3JtCjDyKGru2o4Yt0QjGvpGdsvz90O2c0qcuP+D/k5nJ7YxQ/pvCV53t
MmVhKWO8cnef963HRH86yMf6yC/mnJiAs/3XHaoF4O1Jd2s8KkVTYMbdOIsiTYbx
IciwTcaR7dqcerutOEgqtlD/M9BY2zF63kH11fz5ZjjRJqlQkZ+e81qnkY0b+mPV
m+gpEhny8JCH8MoGLpdxCA+4Wx/EBrMp6OqH04t14iv2Jb0BIOk3kfbLgHUqj+7u
idmvxA==
-----END CERTIFICATE REQUEST-----
root@myubuntu:~/1026#