Monday, August 10, 2015

Using SelfSSL7 as an alternative to using IIS Self-Signed Certificates

If you are setting up SSL on your IIS website, you may encounter numerous problems when developing and debugging with the installed SSL Certificate such as this error message:

Fortunately, there is a better way to use SSL certificates than the Self-Signed Certificate option in IIS which is to use SelfSSL7!

You can download and learn how to use SelfSSL7 here:

The beauty of using SelfSSL7 is that it automatically adds the SSL Certificate into the Trusted Certificate Store thus removing an extra step required to get an SSL certificate working properly in IIS.

However, drilling down into the Command Line and executing commands is a bit error prone and tedious, therefore, I have created a convenient PowerShell script to accomplish this instead!!

The PowerShell script simply requires the same path information as the command line, but allows the usage of variables to control how the SSL certificate is set up in IIS.

$SelfSSL7 = "C:\SelfSSL7\SelfSSL7.exe"
$WebsiteName = "Default Web Site"
$CommonName = $env:COMPUTERNAME
$LocalHost = "localhost";
$ValidityPeriod = "3650"
$KeySize = "2048"
$SelfSSLCmd = @"
"$SelfSSL7" /Q /T /I "$WebsiteName" /N "cn=$CommonName;cn=$LocalHost"
Write-Host $SelfSSLCmd
& $SelfSSL7 /Q /T /I "$WebsiteName" /N "cn=$CommonName;cn=$LocalHost" /V $ValidityPeriod /K $KeySize | Out-Host

No comments:

Post a Comment