Cats.CertificateTransparency 5.0.0

dotnet add package Cats.CertificateTransparency --version 5.0.0
                    
NuGet\Install-Package Cats.CertificateTransparency -Version 5.0.0
                    
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="Cats.CertificateTransparency" Version="5.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Cats.CertificateTransparency" Version="5.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Cats.CertificateTransparency" />
                    
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 Cats.CertificateTransparency --version 5.0.0
                    
#r "nuget: Cats.CertificateTransparency, 5.0.0"
                    
#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 Cats.CertificateTransparency@5.0.0
                    
#: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=Cats.CertificateTransparency&version=5.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Cats.CertificateTransparency&version=5.0.0
                    
Install as a Cake Tool

Certificate Transparency for .NET

C# .NET port of,

Cats.CertificateTransparency Logo

alternate text is missing from this package README image

    Install-Package Cats.CertificateTransparency

Blog Post

The library is designed to be dependency injection friendly, every service class has a matching interface. However, to get things up and running quickly there is also a static Instance class which will construct lazy singletons for both ILogListService and CertificateTransparencyVerifier.

If you want to provide a custom list of included and excluded domains to these static instances you must first call Instance.InitDomains. By default validation will be enabled for all TLS secured domains.

Instance.InitDomains(new [] { "*.google.com", "microsoft.com" }, new [] { "nuget.org" });

Examples

.NET

var client = new HttpClient(new HttpClientHandler()
{
    ServerCertificateCustomValidationCallback = (request, certificate, chain, sslPolicyErrors) =>
    {
        var certificateChain = chain.ChainElements.OfType<X509ChainElement>().Select(i => i.Certificate).ToList();
        var certificateVerifier = Cats.CertificateTransparency.Instance.CertificateTransparencyVerifier;
        var ctValueTask = certificateVerifier.IsValidAsync(request.RequestUri.Host, certificateChain, CancellationToken.None);

        var ctResult = ctValueTask.IsCompleted
            ? ctValueTask.Result
            : ctValueTask.AsTask().Result;

        return ctResult.IsValid;
    }
});

Android

bool VerifyCtResult(string hostname, IList<DotNetX509Certificate> certificateChain, CtVerificationResult result)
{
    // any extra checks or logging you might want to add
    return result.IsValid;
}

// optionally pass in a function to manually handle the transparency result
var httpHandler = new Cats.CertificateTransparency.CatsAndroidClientHandler(VerifyCtResult);
var client = new HttpClient(httpHandler);

iOS

There is currently no platform specific implementation for iOS. Certificate transparency is already enabled since iOS 12.1.1, however, it can be disabled per domain via a property list setting NSRequiresCertificateTransparency.

If you are keen you could use the CertificateVerifier to build your own HttpClientHandler, similar to the included Android implementation.

Contributions

Any contributions are welcome! Especially extra test cases!

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-android36.0 is compatible.  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.
  • net10.0

    • No dependencies.
  • net10.0-android36.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Cats.CertificateTransparency:

Package Downloads
LemonMarkets

Community C# Library #2 for Lemon Markets

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
5.0.0 2,135 6/2/2026
4.0.0 5,529 12/29/2025
3.0.1 8,031 10/9/2024
3.0.0 262 9/29/2024
2.1.1 3,339 2/18/2023
2.1.0 412 2/15/2023
2.0.0 1,538 6/16/2022
1.3.0 1,206 11/11/2021
1.2.0 619 10/18/2021
1.1.0 1,817 3/2/2021
1.0.0 593 1/16/2021
0.0.1-pre 1,000 12/2/2020

- Updated to net10.0
- Removed BouncyCastle dependency