SslCertBinding.Net 2.0.2

dotnet add package SslCertBinding.Net --version 2.0.2
NuGet\Install-Package SslCertBinding.Net -Version 2.0.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="SslCertBinding.Net" Version="2.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SslCertBinding.Net --version 2.0.2
#r "nuget: SslCertBinding.Net, 2.0.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.
// Install SslCertBinding.Net as a Cake Addin
#addin nuget:?package=SslCertBinding.Net&version=2.0.2

// Install SslCertBinding.Net as a Cake Tool
#tool nuget:?package=SslCertBinding.Net&version=2.0.2

SslCertBinding.Net

SslCertBinding.Net is a library for .NET and Windows and provides a simple API to add, remove or retrieve bindings between a https port and a SSL certificate.

This library can be considered as a programmatic alternative to Windows command line tools netsh http show|add|delete sslcert or httpcfg query|set|delete ssl.

Important: The library uses the Win32 API and works on the Windows platform only.

Branch Package Status
main NuGet Build status - master CodeQL codecov
dev NuGet Build status - dev CodeQL codecov

Installation

To get started, add the SslCertBinding.Net NuGet package to your project by running the following command:

dotnet add package SslCertBinding.Net

Usage

You can add, update or delete a SSL certificate binding by using the CertificateBindingConfiguration class as shown below:

var config = new CertificateBindingConfiguration();
var ipPort = new IPEndPoint(IPAddress.Parse("0.0.0.0"), 443); 
var certificateThumbprint = "372680E4AEC4A57CAE698307347C65D3CE38AF60";
var appId = Guid.Parse("214124cd-d05b-4309-9af9-9caa44b2b74a");

// add a new binding record
config.Bind( new CertificateBinding(certificateThumbprint, StoreName.My, ipPort, appId) );

// get the binding record
var certificateBinding = config.Query(ipPort)[0];

// set an option and update the binding record
certificateBinding.Options.DoNotVerifyCertificateRevocation = true;
config.Bind(certificateBinding);

// remove the binding record
config.Delete(ipPort);

FAQ

Why unit tests are failing on my PC?

Cerificates configuration needs elevated permissions. Run Visual Studio as an Administrator before running unit tests.

I am getting the error "A specified logon session does not exist. It may have already been terminated". How to fix it?

Make sure that you have installed your certificate properly, certificate has a private key, your private key store is not broken, etc. Try binding your certificate with netsh CLI tool. If you get the same error it should not be a bug in SslCertBinding.Net.

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.  net6.0-windows7.0 is compatible.  net7.0 was computed.  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. 
.NET Framework net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.6.2

    • No dependencies.
  • net6.0

    • No dependencies.
  • net6.0-windows7.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on SslCertBinding.Net:

Package Downloads
Cireson.Platform.Core.Host

Platform host.

CompuMaster.Web.TinyWebServerAdvanced

Package Description

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on SslCertBinding.Net:

Repository Stars
lithnet/access-manager
Access Manager provides web-based access to local admin (LAPS) passwords, BitLocker recovery keys, and just-in-time administrative access to Windows computers in a modern, secure, and user-friendly way.
Version Downloads Last updated
2.0.2 603 2/13/2024
2.0.1 172 2/9/2024
2.0.0 1,265 11/20/2023
1.0.2 284,310 9/15/2015
1.0.1 20,943 6/3/2015