OpenSSL "req -new" - Generate New CSR

Q

How to generate a new CSR (Certificate Signing Request) using OpenSSL "req -new" command? I have an RSA private key (including public key) ready.

✍: FYIcenter.com

A

If you have a pair of RSA private key and public key, and you want to generate CSR (Certificate Signing Request) to represent your personal identity or server identity, you can use the OpenSSL "req -new" command as shown below:

C:\Users\fyicenter>\local\openssl\openssl.exe

OpenSSL> genpkey -algorithm rsa -out my_rsa.key
..........................++++++
......................++++++

OpenSSL> req -new -key my_rsa.key -out my_rsa.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]:us
State or Province Name (full name) [Some-State]:NY
Locality Name (eg, city) []:New York
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Donald Inc.
Organizational Unit Name (eg, section) []:IT
Common Name (e.g. server FQDN or YOUR name) []:www.donald.inc
Email Address []:john@donald.inc

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:fyicenter
An optional company name []:

OpenSSL> exit
C:\Users\fyicenter>type my_rsa.csr
-----BEGIN CERTIFICATE REQUEST-----
MIIB5DCCAU0CAQAwgYkxCzAJBgNVBAYTAnVzMQswCQYDVQQIDAJOWTERMA8GA1UE
BwwITmV3IFlvcmsxFDASBgNVBAoMC0RvbmFsZCBJbmMuMQswCQYDVQQLDAJJVDEX
MBUGA1UEAwwOd3d3LmRvbmFsZC5pbmMxHjAcBgkqhkiG9w0BCQEWD2pvaG5AZG9u
YWxkLmluYzCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0YsYH42Nv83SdfDp
8Eolc5gSgoeRmM3719o2JSwtwx3xrLZ2y9H8Zx8Ys4OvGRuKED35iiUBhdoW0Pr0
Ps2mHwt95imRhfpZ/jZcUJPg++NqY+RmHpyD4yh7IVdz9Rh7mwMPZ1u9VgHdMsoy
+wR1d51m3sEfgAHHvFemC7eeJlcCAwEAAaAaMBgGCSqGSIb3DQEJBzELDAlmeWlj
ZW50ZXIwDQYJKoZIhvcNAQELBQADgYEAMx2S1f1N8psYGKckffNA86dh8ChGwOqI
vfcExgF5GUdOyMjqoV2zUwPu0mjX9mqNLZVYzUTTnVuRSwJ2MESxNwWeaPoEZH5G
jfhXzyxnhHHXNgh1QltTzj9pvFc0XkF3I6+1SCiL1yATj60fLuo0qjY9gZa2TWR+
sqZbNmutv6I=
-----END CERTIFICATE REQUEST-----

Options used in this "req" command are:

  • "-new" - Generate a CSR (Certificate Signing Request).
  • "-key my_rsa.key" - Use RSA public key from the given file.
  • "-out my_rsa.csr" - Save output, CSR, to the given file.
  • "fyicenter" - Password to protect the CSR.

 

OpenSSL "req -text" - Print CSR in Text

OpenSSL "req" Command Options

OpenSSL "req" Command

⇑⇑ OpenSSL Tutorials

2016-12-14, 4084🔥, 0💬