Monday, January 21, 2019

Unable to generate Private key and CSR using OpenSSL

One of the Prerequisites for Setting Up a Custom Secure Domain is to generate Private Key and Certificate Signing Request (CSR).

In order to generate the Private Key and CSR you will need to download and install OpenSSL.
Below are the command we used in OpenSSL to generate Private Key and CSR.

genrsa –des3 –out <secure.domainnamekey>.key 2048

req –new –key <secure.domainnamekey>.key –out <secure.domainnamecsr>.csr

The error message shows when the command is executed as a result Private Key and CSR is not created in the Bin folder.

This error occurs mainly on windows when you are using openssl package,
The reason is that openssl failed to locate the openssl.cnf file

Resolution:

Open your command prompt as Administrator (few OpenSSL commands opens in random state), thus when OpenSSL tries to write stuff on your disk it fails. Now before you run any OpenSSL command type the following.

set OPENSSL_CONF=c:\[PATH TO YOUR OPENSSL DIRECTORY]\bin\openssl.cfg

Note: Remember that everytime you open a command prompt you have to run the above command unless you set this as your environment variable.

Source: http://jaspreetchahal.org

 

No comments:

Post a Comment