Self Signed Certificate intro
Hi friends, When I started working with IIS for about 8 years ago, I used to create Self signed certificate for my web applications So I can test SSL security in my development environments.
But when we create a Self signed certificate, By default you will get a warning every time you connect to your website after you build the website or restart the pool. You will get a warning as shown in the figure below:
You may tell me that you can simply click continue and everything will work normally.
Yeah, this may be true, But when it comes to testing some advanced web applications and especially Web API, then this will cause you a real problem. since every time you build your API, you have to run it in the browser and click continue to override the warning.
But when you call the API from Ajax Jquery calls as an example, then you will not find a way to override the SSL Warning.
For that, I tried to search for a way to make the Self signed certificates trusted So I can work with my applications as they are really secured and trusted.
Creating the trusted certificate manually
After hours of searching, I concluded that the idea is very simple and can be implemented in minutes, you can check the following video to see how to trust the Self signed certificate.
Trusted Self signed certificate generator Tool
But To make things more simple and save time, I created a small tool that allows you to create a Self signed certificate and trust it by adding it to the trusted certificates store on your server.
Using the tool
1. Download Trusted Self signed certificate generator Tool
2. Extract the Zip File and run the tool
Now Simply enter your domain name “Website Domain”, Your certificate pfx file path, and the certificate password that you choose. And click create.
Now to check if everything went as expected. Open IIS manager “Inetmgr” from the command line.
Now the IIS manager will open, click on your server then certificates.
You must see your certificate listed, now just bind it to your website.
Examining the Tool
This tool simply runs a PowerShell script that creates a self signed certificate with a custom DNS name
New-SelfSignedCertificate -certstorelocation cert:\\localmachine\\my -dnsname YourDomain
Then in the next step just add this certificate to the Trusted certificate store on your pc.
If you are interested in getting the source code, just comment below and I will send it to you.
Note: If you want to trust the certificate on other client machines, you have to do it manually as shown in the video.