Egov.Extensions.CertificateValidation
10.0.3
Prefix Reserved
See the version list below for details.
dotnet add package Egov.Extensions.CertificateValidation --version 10.0.3
NuGet\Install-Package Egov.Extensions.CertificateValidation -Version 10.0.3
<PackageReference Include="Egov.Extensions.CertificateValidation" Version="10.0.3" />
<PackageVersion Include="Egov.Extensions.CertificateValidation" Version="10.0.3" />
<PackageReference Include="Egov.Extensions.CertificateValidation" />
paket add Egov.Extensions.CertificateValidation --version 10.0.3
#r "nuget: Egov.Extensions.CertificateValidation, 10.0.3"
#:package Egov.Extensions.CertificateValidation@10.0.3
#addin nuget:?package=Egov.Extensions.CertificateValidation&version=10.0.3
#tool nuget:?package=Egov.Extensions.CertificateValidation&version=10.0.3
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": {
"RevocationMode": "Online",
"RevocationFlag": "ExcludeRoot",
"AllowedNames": [ "*.egov.md" ],
"AllowedSignatureAlgorithms": [ "1.2.840.113549.1.1.11", "1.2.840.113549.1.1.12" ],
"KeyUsages": "DigitalSignature",
"MaxValidity": "825.00:00:00",
"ExtraPaths": [ "Files/Certificates/Intermediates" ]
}
}
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);
What can be validated
Beyond standard chain building, revocation and time validity, the options cover
allowed names and thumbprints, signature algorithms, maximum validity period,
end-entity enforcement, key usages, 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 | Versions 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. |
-
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.