liveBook · Manning

Kestrel:certificates:default

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

Kestrel:Certificates:Default is an ASP.NET Core configuration section that specifies the default certificate and access credentials for Kestrel HTTPS connections.

Kestrel:Certificates:Default configures the certificate Kestrel uses for HTTPS connections. Placing a .pfx path and its password in configuration replaces Kestrel’s default without application code changes; Kestrel loads it when the app starts. section 28.3 section 28.5

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 small appsettings.json section nests the setting under Kestrel, Certificates, and Default, then supplies the .pfx path and access password. section 28.3

Choose the certificate source and protect its credentials:

  • Use a .pfx file with Path and Password for a straightforward configuration-based setup. section 28.3
  • Load a certificate from the operating-system certificate store when local-store management is more appropriate. section 28.3
  • Keep production passwords out of appsettings.json; use a configuration store such as user secrets or load the certificate from the local store. section 28.3

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

How deep it goes
Explains nested configuration, certificate sources, startup loading, and credential safety, but defers complete endpoint and SNI configuration.
Examples
Uses an appsettings.json example containing a localhost.pfx path and testpassword value.
What it assumes
Assumes familiarity with ASP.NET Core configuration and certificates while demonstrating the required JSON nesting from the beginning.
What you can do after
Configure Kestrel to serve HTTPS with a selected certificate and externalize production credentials.
How it connects
Connects Kestrel with HTTPS, TLS certificates, appsettings.json, configuration stores, user secrets, and certificate stores.

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.