How to generate a CSR code? Print

  • 48

Creating SSL Private Key

Before you generate a CSR you need to create a private key first. All modern SSLs require 2048 bit key. 

$ openssl genrsa -out private.pem 2048

Command above creates a private key without password protection and writes it to private.pem file. To create a password protected key use next command.


$ openssl genrsa -des3 -out private.pem 2048

Generating a CSR

Now we are ready to create a CSR. It is as simple as typing command below into console:

$ openssl req -out example.com.csr -key private.pem -new

To view CSR you just need to open file example.com.csr with text editor (use vim or nano) or use "cat" command to print example.com.csr to your console.

$ cat example.com.csr

External Links

* For more info about using openssl command visit https://www.openssl.org/docs/
* OpenSSL man pages

Was this answer helpful?

« Back