Found myself in need of a certificate with a private key for a https localhost connection on multiple devices 😬
Let me show you how I got it working!
Download openSSL: https://sourceforge.net/projects/openssl/files/openssl-1.0.2j-fips-x86_64/
Step 1 Create config file for openSSL:
Make a new folder in your C:\ named: OpenSSL and copy the openssl.cnf (this file can be found in the bin folder of the downloaded openssl folder) into the folder
Step 2 Change Configuration:
Open your openssl.cnf and change the following:
#subjectAltName=email:copy
to:
subjectAltName=DNS:localhost
for all 3 occurrences in the file.
Step 3 Generate the certificate:
Open your cmd and cd into the bin folder of your openSSL
openssl req -newkey rsa:2048 -keyout key.pem -x509 -days 365 -out certificate.pem
You should now see a certificate.pem in your bin folder.
Step 4 Create the private key:
openssl pkcs12 -inkey key.pem -in certificate.pem -export -out certificate.p12
You should now see a certificate.p12 file. This is the certificate with the private key included.
To install the certificate simply right click and select Install PFX:
That’s all!🧐
Happy Coding!