Home » Wiki » How to Create a Self-Signed Certificate in IIS?

How to Create a Self-Signed Certificate in IIS?

by | Self-Signed

Create Self-Signed Certificate in IIS

Step By Step Guide to Setup a Self-Signed Certificate in IIS

Secure Sockets Layer (SSL) and its successor Transport Layer Security (TLS) are cryptographic protocols that provide communication security over the internet. They use X.509 certificates to authenticate the identity of websites and encrypt the data exchanged between servers and clients.

SSL/TLS allows sensitive information like credit card numbers, account credentials, and personal data to be transmitted securely through encryption and prevents tampering and eavesdropping by third parties. This builds user trust and confidence in websites.

Key Takeaways

  • SSL/TLS provides encrypted communication between a web server and clients.
  • SSL uses certificates to authenticate and identify websites.
  • Self-signed certificates can be used for testing locally or on intranets.
  • Trusted SSL certificates should be used for public-facing production websites.

When to Use a Self-Signed Certificate

A self-signed certificate is signed by its creator rather than a trusted certificate authority. It can be used for:

  • Testing SSL functionality locally or on intranet sites
  • Applications that require SSL but only communicate internally
  • Situations where cost is a major constraint
  • Non-public sites and development/staging environments

The drawback is that visitors will see certificate warnings as the certificate is not trusted. Public sites should use CA-signed certificates.

Prerequisites Before Installing Self-Signed Certificate in IIS

To create and install a self-signed certificate for a website in IIS, you need:

  • IIS (Internet Information Services) installed on the Windows Server
  • Administrative access rights to the server
  • Access to IIS Manager console

IIS is enabled by default on Windows Server operating systems. It would help if you specifically had the IIS 6 Metabase and IIS 6 configuration compatibility role service for IIS Manager.

Easy Steps to Create Self-Signed Certificate in IIS

  • Open IIS Manager
  • Navigate to Server Certificates
  • Create a New Self-Signed Certificate
  • Verify the Newly Created Certificate

Open IIS Manager

The IIS Manager console lets you configure IIS settings. To open it:

  • Click Start and search for “IIS Manager.
  • Click on the IIS Manager app to launch it.

Alternatively, access it through the Administrative Tools folder.

Navigate to Server Certificates

  • In IIS Manager, expand the server name node in the Connections pane.
  • Double-click on the “Server Certificates” icon.

This opens the Server Certificates feature.

Create a New Self-Signed Certificate

To generate a new self-signed cert:

Provide a Friendly Name

  • In the Actions pane on the right, click “Create Self-Signed Certificate“.
  • Enter a descriptive name for the cert in the friendly name field.

For example, www.example.com Self-Signed Test Certificate

This helps identify the certificate’s purpose later.

Choose Certificate Store

Select the store where you want the certificate to be created:

  • Personal: Used for certificates assigned to user accounts.
  • Web Hosting: For certificates associated with hosted websites.
  • Other options, such as trusted root certification authorities, can also be chosen.

For website use, a Web Hosting store is recommended.

Select Encryption Level

  • The default SHA1 encryption needs to be stronger and updated.
  • For stronger security, choose SHA256 instead from the dropdown.

Click OK after providing the details. The new self-signed certificate will be generated and listed under Server Certificates.

Verify the Newly Created Certificate

  • Double-click on the new certificate to open it.
  • Go to the Details tab and verify the information.
  • Check the Friendly name, issued to, Issued by, and Thumbprint values.
  • By default, the certificate should be valid for 1 year.

This completes the creation process. Next, we will bind it to a website for testing.

How to Bind the Self-Signed Certificate to a Website

To configure a site to use the new self-signed certificate for SSL:

Select the Website in the IIS Manager

  • Expand Sites node in the Connections pane.
  • Right-click on the website and select Edit Bindings.

Alternatively, please select it and click Edit Site Bindings in the Actions pane.

Edit Site Bindings

This opens the Edit Site Bindings window.

Add a New Binding for HTTPS

  • Click Add in the Site Bindings section.
  • In the Add Site Binding popup:
  • Set Type as https.
  • Leave Port as 443 for default SSL port.
  • Set the SSL certificate to the newly created self-signed cert in the dropdown.
  • Optionally set Host name if you want SSL for a specific hostname.
  • Click OK.
  • Click Add in the Site Bindings section.
  • In the Add Site Binding popup:

A new binding with the SSL certificate will be added for HTTPS.

Select the Self-Signed Certificate

In the Site Bindings list, ensure the new HTTPS binding shows the correct self-signed certificate configured.

Apply Changes

Click OK to save and apply the binding changes. The self-signed certificate is now bound to the website for SSL use.

Testing the Self-Signed Certificate

To test SSL functionality with the new certificate:

Access the Website Using HTTPS

Open a web browser and visit the website using the HTTPS URL, i.e., with https:// prefix instead of plain http://.

For example: https://www.example.com

Expect a Certificate Warning in the Browser

As the certificate is self-signed rather than issued by a trusted CA, the Browser will display a security warning.

This is expected behavior.

Accept the Certificate Exception

Click to bypass the warning page and accept the exception. This adds an exception allowing you to access the site.

The site should now load securely using the new SSL certificate. You can verify that the SSL lock icon and https protocol are displayed correctly.

This validates that the self-signed certificate works properly to enable SSL on the website in IIS.

How to Resolve Certificate Warning (Optional)

The browser certificate warning occurs because a trusted authority does not issue the certificate. To resolve this for intranet sites:

Generate Certificate with Matching Common Name

Create a new self-signed certificate with a common name matching the site’s domain name.

Using IIS 6.0 Resource Kit Tools (SelfSSL)

On Windows Server 2003, the SelfSSL tool can generate a certificate with proper parameters.

To run:

  • Download and install IIS 6.0 Resource Kit Tools.
  • Open the command prompt and go to C:\Program Files\IIS Resources\SelfSSL.
  • Run selfssl /N:CN=example.com /K:2048 /V:365 (replacing example.com with your domain name).

This will generate a new certificate with a matching common name valid for 365 days.

Providing the Correct Common Name

When creating the cert in IIS Manager, provide the site’s FQDN, like www.example.com, as the common name rather than a friendly name.

Add Certificate to Trusted Root CA Store

To make Windows trust the certificate:

Using Microsoft Management Console (MMC)

  • Open the Microsoft Management Console (mmc.exe).
  • Add the Certificates snap-in for ‘Computer account.’
  • Expand the Trusted Root Certification Authorities > Certificates store.
  • Right-click on Certificates and select All Tasks > Import.
  • Import the newly generated self-signed certificate with a matching name.

Importing the Certificate

Follow the steps to import and trust the certificate when prompted. Now, browsers will trust the site’s self-signed certificate.

Considerations and Best Practices about Self-Signed Certificate

When using self-signed certificates, keep in mind:

Limitations of Self-Signed Certificates

  • Certificate warnings in visitors’ browsers
  • Lack of trust outside the internal network
  • Manual installation is required on each computer
  • No verified identity assurance for users

When to Use Trusted SSL Certificates

Purchase trusted SSL certificates from certificate authorities for public production websites to:

  • Avoid certificate warnings and build visitor trust
  • Enable recognition of secured identity
  • Get automatic trust from all browsers
  • Provide encryption without compromising reliability

Updating the Self-Signed Certificate

Remember to renew the self-signed certificate annually before expiration. Re-import the updated certificate to avoid reverting to insecure HTTP.

Final Thoughts

In conclusion, creating a self-signed certificate in IIS is a straightforward process that can be accomplished through the IIS Manager or PowerShell. While self-signed certificates are useful for testing and development purposes, it’s important to remember that they are not trusted by default and may trigger security warnings in browsers. For production environments, it’s always recommended to obtain a trusted SSL/TLS certificate from a reputable certificate authority. By following the step-by-step instructions and understanding the limitations of self-signed certificates, developers and system administrators can securely configure their IIS servers and ensure encrypted communication between clients and servers.

Priya Mervana

Priya Mervana

Verified Badge Verified Web Security Experts

Priya Mervana is working at SSLInsights.com as a web security expert with over 10 years of experience writing about encryption, SSL certificates, and online privacy. She aims to make complex security topics easily understandable for everyday internet users.