TlsCertificateLoader 2.3.2

dotnet add package TlsCertificateLoader --version 2.3.2
                    
NuGet\Install-Package TlsCertificateLoader -Version 2.3.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TlsCertificateLoader" Version="2.3.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TlsCertificateLoader" Version="2.3.2" />
                    
Directory.Packages.props
<PackageReference Include="TlsCertificateLoader" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TlsCertificateLoader --version 2.3.2
                    
#r "nuget: TlsCertificateLoader, 2.3.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package TlsCertificateLoader@2.3.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TlsCertificateLoader&version=2.3.2
                    
Install as a Cake Addin
#tool nuget:?package=TlsCertificateLoader&version=2.3.2
                    
Install as a Cake Tool

TlsCertificateLoader TlsCertificateLoader

GitHub Workflow Status Nuget Nuget

Allows loading of TLS (HTTPS) certificates for .NET 6.0+ Kestrel web applications, allowing for refreshing of certificates as well as compatibility with HTTP/3. Fully compatible with certificates obtained by Certbot (see sample project without middleware or see sample project using middleware).

Installation

The recommended means is to use NuGet, but you could also download the source code from here.

Usage without middleware

TlsCertificateLoader.TlsCertificateLoader tlsCertificateLoader = new(fullChainPemFilePath, privateKeyPemFilePath);
options.ListenAnyIp(433, o =>
{
     o.SetTlsHandshakeCallbackOptions(tlsCertificateLoader);
     o.SetHttpsConnectionAdapterOptions(tlsCertificateLoader);
     o.Protocols = HttpProtocols.Http1AndHttp2AndHttp3;
});

And to refresh (eg either on a Timer or watching a directory via PhysicalFileProvider):

tlsCertificateLoader.RefreshDefaultCertificates();

You may also add additional certificate collection for other hostnames (for example if you want to set up mydomain.tld as your default certificate and www.mydomain.tld as your alternate one):

tlsCertificateLoader.AddAdditionalCertificates("www.mydomain.tld", fullChainWwwPemFilePath, privateKeyWwwPemFilePath);

And to refresh additional certificate collections (eg either on a Timer or watching a directory via PhysicalFileProvider):

tlsCertificateLoader.RefreshAdditionalCertificates("www.mydomain.tld");

A sample project using Certbot is available.

Usage with Certbot middleware

Refer to the sample project using Certbot using middleware.

Credits

David Fowler for this idea.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.3.2 158 6/28/2025
2.3.1 600 9/21/2024
2.2.10 742 12/5/2023
2.2.9 1,230 2/13/2023
2.2.8 484 1/29/2023
2.2.5 614 12/16/2022
2.2.4 418 12/13/2022
2.2.0 401 12/13/2022
2.1.2 419 12/12/2022
2.1.1 547 11/19/2022
2.0.8 554 9/17/2022
2.0.7 568 6/29/2022
2.0.6 597 3/13/2022
2.0.5 535 3/13/2022
2.0.3 533 3/12/2022
2.0.2 533 3/11/2022
2.0.1 449 11/27/2021
1.1.7 427 11/27/2021
1.1.4 842 11/21/2021
1.1.3 490 11/14/2021
1.1.2 525 11/14/2021
1.1.1 420 11/13/2021
1.1.0 422 11/12/2021
1.0.5 409 11/10/2021
1.0.4 421 11/9/2021
1.0.3 540 11/9/2021 1.0.3 is deprecated because it has critical bugs.
1.0.2 624 11/7/2021 1.0.2 is deprecated because it has critical bugs.
1.0.0 678 11/6/2021 1.0.0 is deprecated because it has critical bugs.

Minor optimizations.