I have created a self-signed SSL certificate for the localhost CN. Firefox accepts this certificate after initially complaining about it, as expected. Chrome and IE, however, refuse to accept it, even after adding the certificate to the system certificate store under Trusted Roots. Even though the certificate is listed as correctly installed when I click "View certificate information" in Chrome's HTTPS popup, it still insists the certificate cannot be trusted.
What am I supposed to do to get Chrome to accept the certificate and stop complaining about it?
On the site you want to add, right-click the red lock icon in the address bar:
Click the tab labeled Connection, then click Certificate Information
Click the Details tab, the click the button Copy to File.... This will open the Certificate Export Wizard, click Next to get to the Export File Format screen.
Choose DER encoded binary X.509 (.CER), click Next
Click Browse... and save the file to your computer. Name it something descriptive. Click Next, then click Finish.
Open Chrome settings, scroll to the bottom, and click Show advanced settings...
Under HTTPS/SSL, click Manage certificates...
Click the Trusted Root Certification Authorities tab, then click the Import... button. This opens the Certificate Import Wizard. Click Next to get to the File to Import screen.
Click Browse... and select the certificate file you saved earlier, then click Next.
Select Place all certificates in the following store. The selected store should be Trusted Root Certification Authorities. If it isn't, click Browse... and select it. Click Next and Finish
Click Yes on the security warning.
Restart Chrome.
I fixed this problem for myself without changing the settings on any browsers with proper SSL certifications. I use a mac so it required a keychain update to my ssl certifications. I had to add subject alt names to the ssl certification for chrome to accept it. As of today, this is for Chrome version number: 62.0.3202.94
My example are easy to use commands and config files:
add these files and this example is all in one root directory
ssl.conf
Run command to create certification:
For macs only to add trusted certification (required):
For windows you will have to find how to verify our ssl certs locally independently. I don't use Windows. Sorry windows guys and gals.
I am using a node.js server with express.js with only requires my key and certification with something like this:
app.js
I may be doing this for other backend frames in the future, so I can update example this for others in the future. But this was my fix in Node.js for that issue. Clear browser cache and run your app on https://
Here's an example of running https://localhost on a Node.js server for Mac users:
https://github.com/laynefaler/Stack-Overflow-running-HTTPS-localhost
Happy Coding!
Are you sure the address the site is being served up as is the same as the certificate? I had the same problems with Chrome and a self-signed cert, but in the end I found it was just incredibly picky about the validation of the domain name on the cert (as it should be).
Chrome doesn't have it's own cert store and uses Window's own. However Chrome provides no way to import certs into the store so you should add them via IE instead.
Installing Certificates in Google Chrome
Installing Certificates in Internet Explorer
Also take a look at this for a couple of different approaches to creating self-signed certs (I'm assuming you're using IIS as you haven't mentioned).
How to Create a Self Signed Certificate in IIS 7
I went down the process of using what bjnord suggested which was: Google Chrome, Mac OS X and Self-Signed SSL Certificates
What is shown in the blog did not work.
However, one of the comments to the blog was gold:
sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain site.crt
You'll need to follow the blog on how to get the cert file, after that you can use the command above and should be good to go.
I tried everything and what made it work: When importing, select the right category, namely Trusted Root Certificate Authorities:
(sorry it's German, but just follow the image)
As of Chrome 58+ I started getting certificate error on macOS due missing SAN. Here is how to get the green lock on address bar again.
Generate a new certificate with the following command:
Import the
server.crt
into your KeyChain, then double click in the certificate, expand the Trust, and select Always TrustRefresh the page https://domain.dev in Google Chrome, so the green lock is back.