Answer To : How To Create Keys For Making A Local Https Server ?
Asked on October 13, 2023
We need the private key and self-signed ssl certificate to ensure our local web page is requested in https server. This can be done in simple steps stated below :
- Firstly we need to install openssl to generate the certificate and keys. You can install openssl from this given Link and add the path in environment variables of your system.
- when you are done with above step run terminal or powershell ( or cmd ) as administrator or else run openssl as administrator (right click on the .exe file and click on open as administrator). Now write the following code in your command shell:
openssl genrsa -out key.pem 2048 openssl req -new -key key.pem -out csr.pem openssl x509 -req -days 9999 -in crs.pem -signkey key.pem -out cert.pem rm csr.pem
If you have open openssl then you should omit openssl in the above command.
If there is no ssl folder in the openssl download directory then while running the second line of the above may show you an error that says:
could not locate C:\openssl\ssl\ openssl.cnf file
You can simply get rid of this error by creating ssl folder in the C:\openssl\ directory and copy openssl.cnf on the created ssl folder. The self-signed ssl certificate and private key will be generated in the directory from where you have run the above code.
Please sign in to post a comment