liveBook · Manning

Certificate

As explained in ASP.NET Core in Action, 3e

An HTTPS certificate is a digital certificate used to authenticate a server and enable encrypted HTTPS communication.

An HTTPS certificate helps protect traffic between a browser and an application. Without HTTPS, someone on the network may read or change requests and responses, including sensitive details or authentication cookies. “SSL certificate” is a common name, but TLS is the newer standard. section 28.1

A TLS certificate has public and private parts. The server sends the public part to the browser and keeps the private key to itself. For the browser to trust that it has reached the intended server, the certificate must be signed through a chain leading to a trusted root certificate. A development or self-signed certificate lacks that browser trust by default, so the browser warns before connecting. section 28.2

Trust a local development certificate

ASP.NET Core can use its development certificate for local HTTPS when no other certificate is configured. On the development machine, run `dotnet dev-certs https --trust` to trust it and remove the browser warning. Do not use that certificate for production visitors: their browsers will not trust it. section 28.2

For production, obtain a signed certificate from a provider such as Let’s Encrypt or a cloud provider. Proving ownership of the domain is part of that process; the exact steps depend on the provider and operating system. If Kestrel serves HTTPS directly, configure it to use the certificate rather than its development default. Kestrel can load certificates from a .pfx file, paired .pem/.crt and .key files, or an operating-system certificate store. section 28.2 section 28.3

Listing 28.1 Configuring the default HTTPS certificate for Kestrel using a .pfx file
{
  "Kestrel": {                        #1
    "Certificates": {                 #1
      "Default": {                    #1
        "Path": "localhost.pfx",      #2
        "Password": "testpassword"    #3
      }
    }
  }
}

A JSON example sets Kestrel’s default HTTPS certificate with a .pfx file path and password. Kestrel loads the configured certificate when the application starts; this option needs no application code change. section 28.3 section 28.5

Direct Kestrel configuration is not the only deployment choice. With TLS passthrough, traffic stays encrypted through a reverse proxy to the application. With TLS offloading, the proxy decrypts it and handles the certificate instead. Whichever component handles the certificate, HTTP-to-HTTPS redirection and HSTS address a separate concern: steering browser requests toward HTTPS. section 28.1 section 28.5

How ASP.NET Core in Action, 3e covers it

How deep it goes
Explains key pairs and certificate chains, then configures development and production certificates; leaves provider-specific issuance steps to provider documentation.
Examples
Uses a local certificate trust command, a browser warning, and JSON configuration for a Kestrel .pfx certificate.
What it assumes
Introduces key pairs and certificate trust from basics while assuming an ASP.NET Core application to configure.
What you can do after
Operate/configure HTTPS certificates for local development and direct Kestrel deployment, while recognizing when a reverse proxy can handle them.
How it connects
Connects certificates to public key cryptography, certificate authorities, reverse proxies, Kestrel, and HTTPS enforcement.

Also explained in

Compare how 15 books explain certificate →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ASP.NET Core in Action, 3e. The section links point to the parts of the book it draws on.