Jason Parms

install ssl on node js
CSR (Certificate Signing Request) is an encoded text that contains the domain name and contact details of domain ownership. When you think of creating CSR on Node.js– an open source cross-platform runtime environment, which is used to create server-side web app, you need OpenSSL.

Generate CSR on Node.JS

If you have not installed OpenSSL, you can install it via this command: npm install openssl

You can check also OpenSSL availability in modpack with command: $ openssl

Then, use below command for OpenSSL to create CSR and private key.

openssl req -nodes -newkey rsa:2048 -keyout example_com.key -out example_com.csr

After that, you will have terminal where you need to fill all required details.

Information Description
Common Name: A URL means FQDN that you want to secure. (e.g. – www.example.com)
City: The city in which organization is located. (e.g. – New York City)
State: The state in which organization is located. (e.g. – New York)
Country: Country location of your organization. (e.g. – US)
Organization: The legal name of your organization includes any suffixes. (e.g. – Company Inc.)
Organization Unit: The name of department of your organization. (e.g. – HR, IT, etc.)
Email Address: This field is optional.
Challenge Password: This field is optional.

Now, your CSR is generated in .csr file and the private key will be generated in .key file.

The CSR will look as follows:

-----BEGIN CERTIFICATE-----
[encoded data]
-----END CERTIFICATE-----

You should copy the CSR including dashes in a notepad/text editor and send to certificate provider for SSL process.

Related Article –

How to install an SSL Certificate on Node.js?