# Generating a CSR on Node.js

> Generate a certificate signing request and private key for a Node.js application using OpenSSL, ready for HTTPS.

Source: https://helpcenter.ruachost.com/ssl-security/csr-generation/generating-a-csr-on-node-js/

Node.JS is an open-source cross-platform RE (runtime environment) for developing server side web applications. As an asynchronous event-driven framework, Node.js is designed to build scalable network applications.

As for security, this server RE can have an SSL certificate installed to use mod *tls* and consequently use *https.createServer* for HTTP over TLS connection.

The generation of a certificate signing request can be done via OpenSSL. Check it in your modpack using this command:*\*

*$ openssl*

If there is no such addon, download it using this command:

*npm install openssl*

After that, use the following command for CSR/RSA private key generation:

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

Use only [alphanumeric](https://en.wikipedia.org/wiki/Alphanumeric) characters (English letters and numbers) filling the required fields with the needed information:

- Common Name (the domain name certificate should be issued for, for Wildcard certificates use *.example.com)
- Country (two digit ISO compliant [country code](https://countrycode.org/))
- State (or province)
- City
- Organization ( Legally registered company name - obligatory for Organization Validation and Extended validation certificates, NA can be used for Domain Validation certificates)
- Organizational Unit (Department - Additional company information, NA can be used for DV certificates as well)
- E-mail address

Your CSR will be generated in a .csr file, and the private key will be placed in the .key file.

Copy the generated CSR and proceed with the certificate activation procedure.

After the certificate issuance is completed, use this guide to install it.
