About HTTPS, SChannel, TLS, CAPI, SSL Certificates and their keys (2024)

So you want your site to be available over secure HTTP and you already know that you need an SSL certificate. Still, many things can go wrong. I’m not going to document a specific error; rather I’d say how SChannel, TLS, keys and CAPI fit in, and where to look for problems.

Because we set the HTTPS binding and certificate for a site in IIS Manager, we might be tempted to think that IIS is managing the Secure Channel, or SChannel, through which HTTP traffic takes place. But that’s wrong. IIS Manager is going to configure the HTTP.SYS driver, specifying the certificates to be used for HTTPS traffic. And then, HTTP.SYS is going to take care of the TLS channel for HTTPS communication. Look:

About HTTPS, SChannel, TLS, CAPI, SSL Certificates and their keys (1)IIS sits on top of HTTP.SYS, which in turn relies on SChannel provider for HTTPS communication

Before any HTTPS traffic can happen, a TLS SChannel has to be established. Then, through that channel, normal HTTP requests and responses would travel. The secure channel is initiated by HTTP.SYS, which sits below IIS. If the SChannel fails, then requests don’t reach to IIS, they will not show up in IIS logs. With SChannel failures, HTTPS requests don’t even make it to HTTP.SYS. Why?­

The HTTP.SYS driver is going to call the SChannel provider to create the secure tunnel. SChannel will use the CAPI, the Cryptographic API of Windows. The certificate’s public and private keys are going to be used by CAPI2. Notice my highlight: the private key of the certificate is needed for the SChannel. If that private key is missing or inaccessible due to ACL (Access Control List), then “game over” – no tunnel can be created, HTTPS traffic would fail. And there are other reasons too for which the certificate may be rejected by the SChannel provider; see later in this article.

About HTTPS, SChannel, TLS, CAPI, SSL Certificates and their keys (2)A certificate that is paired with its private key

The SChannel provider is logging into the Windows Events – look inside the System log with the Event Viewer, looking for source SChannel. Here are some common SChannel events and SSL/TLS protocol alerts.

The logging of the Crypto API is not turned on by default. If you want to troubleshoot, you’ll need to turn on the CAPI2 logging in the Windows Events Viewer.

The TLS handshake

Let’s see the steps of the TLS negotiation, how the secure channel is being established between the client and the server before any HTTPS traffic can happen.

  1. TCP handshake is performed between client and server, then...
  2. Client Hello: The client sends to server the versions of TLS protocol supported, as well as the suite of ciphers (encryption/decryption algorithms it supports for key exchange, data encryption and handshake security);
  3. Server Hello: After the server compares what the client sends with its own supported TLS versions and ciphers, the server decides which ones will be used and sends the selection to the client.
  4. Server certificate: The server has to authenticate itself to the client, so it sends its certificate. The keys will be used for encryption.
  5. Client switches to encrypted; all following messages from client will be encrypted from this point.
  6. Server switches to encrypted, too. From this point, normal HTTP requests and response can travel via the encrypted channel.

In fact, the TLS handshake is a bit more complicated, so I recommend the Pluralsight training Analyzing and Decrypting TLS Traffic for details. But the above steps are enough to illustrate what could go wrong and where to look for problems.

TCP handshake

Condition: The client (browser) has to be able to resolve the name of a site (the hostname) to an IP address. For that, needed DNS records must be in place. Do you have a DNS A or CNAME record in place? Can the IP address of the hosting environment be determined for the site/host name specified in the browser’s address bar? You can check with nslookup command-line tool:

C:> nslookup duckduckgo.com

About HTTPS, SChannel, TLS, CAPI, SSL Certificates and their keys (3)Checking name resolution to IP addresses with nslookup

Client Hello and Server Hello

The client is sending to the server its supported TLS versions and cipher suites. The server compares the list with its own “records”. If the server does not support any of the TLS versions specified by client: fail. If or none of server's cipher suites matches one from the client’s list, boom! Look into Windows Events, in the System log, for entries sourced SChannel.

About HTTPS, SChannel, TLS, CAPI, SSL Certificates and their keys (4)A network trace capturing TLS negotiation, Client Hello

If you suspect problems with the encryption, then that’s the domain of CAPI2 - Cryptographic API logging must be enabled, then events must be studied.

Server Certificate

The server authenticates first; then, optionally, the client. But before the server sends its certificate, that must be usable. The SChannel provider performs some validation on the certificate, before using it.

The private key of the certificate must be present on the server and accessible to SChannel provider. There is common misconception that the private key of a certificate stays within the certificate. That’s wrong; the private key belongs to a certificate, but it is stored separately. Certificates are held in Registry, while their private keys have various repositories, depending on where the certificate is found in the Certificate Manager: read key storage and retrieval and certificate locations in Windows.

The issuing authority of the certificate must be trusted by the server. The certificate of the issuing authority must be present in the Computer’s Trusted Root Certification Authorities. If there are intermediate certification authorities, their certificates must be present in the Computer’s Intermediate Certification Authorities. The certificate chain must be trusted.

About HTTPS, SChannel, TLS, CAPI, SSL Certificates and their keys (5)Both client and server should trust the certification chain. Issuing root and intermediate certification autorities

The certificate must not be revoked. And its Key Usage flags must allow for Digital Signature and Key Encipherment. Working with SSL certificates using IIS Manager helps avoid many of the pitfalls commonly seen when setting up HTTPS.

About HTTPS, SChannel, TLS, CAPI, SSL Certificates and their keys (6)Key usage flags needed for HTTPS

Encrypted communication

Finally, before the communication is being switched to encrypted – Change Cipher Spec – the client has to accept the server’s certificate. Some browsers, like Internet Explorer, would display warnings for sites presenting improper certificates - but would still allow you to navigate; after all, technically the encryption of the tunnel can still happen. But other browsers or other client applications might be more… stubborn, should I say? They would not allow continuing navigation or sending requests if the certificate is “smelly”.

If the certificate is expired, not valid anymore: reject. If it was revoked by its issuing authority: reject. If the site/server/host name of the URL does not accommodate the certificate’s subject (issued to field): reject. If the client does not trust the issuing authority of a certificate: reject (on Windows, the certificate of the issuing authority must be present in the Computer’s Trusted Root Certification Authorities / Intermediate Certification Authorities).

In all these cases, the encryption of the secure channel would work, technically; but the clients/browsers simply don’t like the certificate presented by the server - the server is not authenticated.

About HTTPS, SChannel, TLS, CAPI, SSL Certificates and their keys (7)When a client checks a certificate. It also checks for revocation.

On a side note, only the key exchange relies on the computationally expensive asymmetric encryption, during the TLS handshake (let’s say with the certificate’s public and private key). Once the client and the server have established the secure channel, the data exchange will rely on symmetric encryption. This is why the certificate’s Key Usage flag must include Key Encipherment – it’s for the key exchange.

Handling certificates and their private keys

I keep saying about certificate private keys because their absence is one of the most common issues. Failing to have the private key of a certificate leads to frustration: IIS Manager would not even bother to display a server certificate if its private key is not present. So, in the HTTPS binding, one cannot pick a certificate if its private key is missing. Further on, if the private key is accidentally deleted, corrupted or becomes inaccessible due to rights, SChannel issues immediately appear. Same happens if the certificate chain is not trusted (somehow the certificate of the issuing authority is missing from trusted, or that certificate is expired).

So how do we handle this private key?

The “birth” of a certificate starts with a Certificate Request, a CSR. One creates a CSR, then a certification authority (CA) approves it and generates a certificate file.

When creating CSR, a key pair is generated: public and private key. The public key is, well, public, anyone could see it. But the private key remains securely stored on the machine where the CSR was generated.

Once the CA issues the certificate, we could install that certificate on a different machine. But wait, where is the private key? Oh, the certificate must be paired with its private key on the machine where the CSR was created. Once this pairing is done, both certificate and its private key can be exported in a PFX container. The PFX file may contain the certificate, its private key, and all the trust chain – certificate of the root authority and any intermediate authorities. Then the PFX can be imported on other machines if needed.

About HTTPS, SChannel, TLS, CAPI, SSL Certificates and their keys (8)A certificate needs its private key to be usable for HTTPS

I recommend using IIS Manager only for creating certificates to be used for sites and web applications. IIS Manager ensures that the private key is exportable once the certificate was paired with it and it sets the proper key usage flags. It also ensures that the certificate is placed in the proper repository – Computer’s certificates. When exporting a certificate from IIS Manager, the entire trust chain of certificates is included in the PFX too.

About HTTPS, SChannel, TLS, CAPI, SSL Certificates and their keys (2024)

FAQs

What is TLS cert and TLS key? ›

TLS uses public-key cryptography to verify the authenticity of a website. Every website that uses HTTPS (TLS) generates a mathematically related key pair: A private key, which is kept secret and used to sign data. A public key, which anyone can use to verify that data.

How do I fix my TLS certificate? ›

How to Solve the Invalid SSL /TLS Certificate Error
  1. Check the date on your computer. First of all you should check if the date and time on your computer is correct. ...
  2. Check for configuration errors. ...
  3. Check for domain mismatch. ...
  4. Get your certificate from a reliable CA. ...
  5. Check the certificate structure. ...
  6. Check for revocation.
Apr 21, 2024

How do I check my TLS SSL certificate? ›

Here's how to do it.
  1. Open Chrome Developer Tools. The quickest way there is with a keyboard shortcut: OS. Keyboard. Shortcuts. Windows and Linux. Ctrl + Shift + i. F12. Mac. ⌘ + Option + i. ...
  2. Select the Security tab. If it is not shown, select the >> as shown below.
  3. Select View Certificate.

How to validate SSL certificate and key? ›

It's a three-part process to confirm the integrity of a key pair:
  1. Verify the integrity of a private key - that has not been tampered with.
  2. Verify the modulus of both private and public key match.
  3. Successfully perform encryption with the public key from the certificate and decryption with the private key.
Jul 13, 2024

What is the main difference between SSL and TLS? ›

SSL supports older algorithms with known security vulnerabilities. TLS uses advanced encryption algorithms. An SSL handshake is complex and slow. A TLS handshake has fewer steps and a faster connection.

What key is used in TLS? ›

All TLS handshakes make use of asymmetric cryptography (the public and private key), but not all will use the private key in the process of generating session keys.

What are the three most common security errors with TLS certificates? ›

The most common SSL and TLS issues we see are: Implementing self-signed certificates. Certificate validity expiration. Outdated OpenSSL versions.

How to solve SSL certificate error? ›

How to Fix SSL Errors
  1. Make sure you have SSL installed. ...
  2. Reinstall the SSL. ...
  3. Diagnose the problem with a web SSL checker. ...
  4. Renew your SSL certificate. ...
  5. Change all URLs to HTTPS. ...
  6. Update your browser or OS version. ...
  7. Install an intermediate certificate. ...
  8. Generate a new Certificate Signing Request.

How to solve TLS error? ›

Client-side causes of a TLS handshake error

Since an SSL/TLS certificate specifies a validity time frame, a mismatch in date/time can lead to a handshake failure. The user can fix this error by correcting the system time and date. Browser error: A browser misconfiguration or plugin may cause an SSL/TLS handshake error.

How do I know if my website is SSL or TLS? ›

The easiest way to know if a site is SSL encrypted or not is to check its URL. The URL of the site should start with HTTPS. For more details about the site's security credentials, you can click on the padlock icon near the address bar and get more information on the site's SSL certificate details.

What TLS am I using? ›

For Chrome
  • Open the Developer Tools (Ctrl+Shift+I)
  • Select the Security tab.
  • Navigate to the WebAdmin or Cloud Client portal.
  • Under Security, check the results for the section Connection to check which TLS protocol is used.
Jul 5, 2024

How do I access my SSL certificate? ›

The certificate is hosted on a website's origin server, and is sent to any devices that request to load the website. Most browsers enable users to view the SSL certificate: in Chrome, this can be done by clicking on the padlock icon on the left side of the URL bar.

How do I find my SSL certificate key? ›

Locating a private key in Windows
  1. Open Microsoft Management Console.
  2. In the Console Root, expand Certificates (Local Computer)
  3. Locate the certificate in the Personal or Web Server folder.
  4. Right click the certificate.
  5. Select Export.
  6. Follow the guided wizard.
Aug 19, 2022

Which key is embedded into an SSL certificate? ›

Public key is embedded in the SSL certificate and Private key is stored on the server and kept secret. When a site visitor fills out a form with personal information and submits it to the server, the information gets encrypted with the public key to protect if from eavesdropping.

How to check if a website has an SSL certificate? ›

Chrome has streamlined the process for users to access a website's certificate details in just a few steps:
  1. Select the padlock icon located in the address bar of the website.
  2. In the pop-up window, choose "Certificate (Valid)."
  3. Review the "Valid from" dates to ensure the SSL certificate is up-to-date.

What is the difference between a certificate and a key? ›

The owner of the key pair makes the public key available to anyone, but keeps the private key secret. A certificate verifies that an entity is the owner of a particular public key.

What is an SSL certificate and key? ›

An SSL certificate displays important information for verifying the owner of a website and encrypting web traffic with SSL/TLS, including the public key, the issuer of the certificate, and the associated subdomains.

What is the difference between API key and certificate? ›

Using both certificates and keys together provides a comprehensive approach to API security. Certificates ensure secure communication and authenticate your API, while keys provide fine-grained access control and rate-limiting.

How to get TLS key? ›

Locating a private key in Windows
  1. Open Microsoft Management Console.
  2. In the Console Root, expand Certificates (Local Computer)
  3. Locate the certificate in the Personal or Web Server folder.
  4. Right click the certificate.
  5. Select Export.
  6. Follow the guided wizard.
Aug 19, 2022

References

Top Articles
Arby’s Sauce (Copycat Recipe)
Delicious Garlic Miso Chicken Thighs Recipe (for Air Fryer or Oven)
St Thomas Usvi Craigslist
neither of the twins was arrested,传说中的800句记7000词
Inducement Small Bribe
Otis Department Of Corrections
Craigslist In Fredericksburg
Legacy First National Bank
Rochester Ny Missed Connections
World of White Sturgeon Caviar: Origins, Taste & Culinary Uses
Best Restaurants Ventnor
Best Suv In 2010
Love In The Air Ep 9 Eng Sub Dailymotion
iLuv Aud Click: Tragbarer Wi-Fi-Lautsprecher für Amazons Alexa - Portable Echo Alternative
Bitlife Tyrone's
Blackwolf Run Pro Shop
Sonic Fan Games Hq
10-Day Weather Forecast for Santa Cruz, CA - The Weather Channel | weather.com
The Exorcist: Believer (2023) Showtimes
Odfl4Us Driver Login
Stardew Expanded Wiki
H12 Weidian
Cbssports Rankings
Sussyclassroom
Low Tide In Twilight Ch 52
Hctc Speed Test
Spiritual Meaning Of Snake Tattoo: Healing And Rebirth!
Cognitive Science Cornell
4 Methods to Fix “Vortex Mods Cannot Be Deployed” Issue - MiniTool Partition Wizard
As families searched, a Texas medical school cut up their loved ones
Ullu Coupon Code
Mchoul Funeral Home Of Fishkill Inc. Services
Bursar.okstate.edu
Inmate Search Disclaimer – Sheriff
Broken Gphone X Tarkov
Best New England Boarding Schools
First Light Tomorrow Morning
AsROck Q1900B ITX und Ramverträglichkeit
Tmka-19829
Synchrony Manage Account
Puffco Peak 3 Red Flashes
Oxford House Peoria Il
Gfs Ordering Online
Lcwc 911 Live Incident List Live Status
Emily Browning Fansite
Grizzly Expiration Date Chart 2023
Gabrielle Abbate Obituary
Chubbs Canton Il
Hello – Cornerstone Chapel
Euro area international trade in goods surplus €21.2 bn
Phunextra
Latest Posts
Article information

Author: Cheryll Lueilwitz

Last Updated:

Views: 6323

Rating: 4.3 / 5 (74 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Cheryll Lueilwitz

Birthday: 1997-12-23

Address: 4653 O'Kon Hill, Lake Juanstad, AR 65469

Phone: +494124489301

Job: Marketing Representative

Hobby: Reading, Ice skating, Foraging, BASE jumping, Hiking, Skateboarding, Kayaking

Introduction: My name is Cheryll Lueilwitz, I am a sparkling, clean, super, lucky, joyous, outstanding, lucky person who loves writing and wants to share my knowledge and understanding with you.