Egov.Extensions.CertificateValidation 10.0.17

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

Egov.Extensions.CertificateValidation

An extensible X.509 certificate validator for .NET, wrapping X509Chain with a declarative, configuration-driven policy.

Installation

dotnet add package Egov.Extensions.CertificateValidation

Usage

1. Register the validator

builder.Services.AddCertificateValidator(builder.Configuration.GetSection("CertificateValidation"));

2. Configure

{
  "CertificateValidation": {
    "ExtraPaths": [ "Files/Certificates/Intermediates" ],
    "RevocationMode": "Online",
    "RevocationFlag": "ExcludeRoot",
    "AllowedCommonNames": [ "*.egov.md" ],
    "Cryptography": { "AllowedSignatureAlgorithms": [ "1.2.840.113549.1.1.11", "1.2.840.113549.1.1.12" ] },
    "MaxValidity": "825.00:00:00",
    "KeyUsages": "DigitalSignature"
  }
}

3. Validate

public sealed class MyService(ICertificateValidator validator)
{
    public bool Check(X509Certificate2 certificate)
    {
        var result = validator.Validate(certificate);
        if (!result.IsValid)
        {
            // result.ErrorDescription is non-null whenever IsValid is false
            logger.LogWarning("Certificate rejected: {Reason}", result.ErrorDescription);
        }
        return result.IsValid;
    }
}

Keyed validators

Register several independently configured validators and resolve them by key:

builder.Services.AddCertificateValidator("mpass", builder.Configuration.GetSection("MPassCertificateValidation"));
builder.Services.AddCertificateValidator("msign", builder.Configuration.GetSection("MSignCertificateValidation"));
public sealed class MPassService([FromKeyedServices("mpass")] ICertificateValidator validator);

Each registered policy is validated when the host starts. Invalid values are reported together in one OptionsValidationException.

What can be validated

Beyond standard chain building, revocation and time validity, including custom trust anchors that are not self-signed roots (e.g. issuing CAs from an ETSI trusted list), the options cover allowed names and SHA-1/SHA-256 thumbprints, signature algorithms, maximum validity period, key usages, end-entity enforcement, application and certificate policies, mandatory and forbidden extensions, issuer-level constraints, eIDAS qualified certificate statements (qcStatements) and Certificate Transparency SCTs (RFC 6962), plus a custom validation callback.

See the full documentation for the complete option reference.

License

This project is licensed under the MIT License.

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

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Egov.Extensions.CertificateValidation:

Package Downloads
Egov.Extensions.WalletValidation

OpenID4VP mdoc request creation and wallet response validation for .NET, including issuer and device authentication, X.509 certificate validation and JWT/CWT credential status lists.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.0.17 0 11/27/2026
10.0.16 262 11/19/2026
10.0.5 330 10/7/2026
10.0.4 132 10/6/2026
10.0.3 122 10/6/2026
10.0.2 333 8/20/2026