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
