Microsoft.Extensions.Compliance.Redaction
10.1.0
Prefix Reserved
dotnet add package Microsoft.Extensions.Compliance.Redaction --version 10.1.0
NuGet\Install-Package Microsoft.Extensions.Compliance.Redaction -Version 10.1.0
<PackageReference Include="Microsoft.Extensions.Compliance.Redaction" Version="10.1.0" />
<PackageVersion Include="Microsoft.Extensions.Compliance.Redaction" Version="10.1.0" />
<PackageReference Include="Microsoft.Extensions.Compliance.Redaction" />
paket add Microsoft.Extensions.Compliance.Redaction --version 10.1.0
#r "nuget: Microsoft.Extensions.Compliance.Redaction, 10.1.0"
#:package Microsoft.Extensions.Compliance.Redaction@10.1.0
#addin nuget:?package=Microsoft.Extensions.Compliance.Redaction&version=10.1.0
#tool nuget:?package=Microsoft.Extensions.Compliance.Redaction&version=10.1.0
Microsoft.Extensions.Compliance.Redaction
A redaction engine and canonical redactors.
Install the package
From the command-line:
dotnet add package Microsoft.Extensions.Compliance.Redaction
Or directly in the C# project file:
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Compliance.Redaction" Version="[CURRENTVERSION]" />
</ItemGroup>
Usage Example
Registering the services
The services can be registered using one of the AddRedaction overloads:
public static IServiceCollection AddRedaction(this IServiceCollection services)
public static IServiceCollection AddRedaction(this IServiceCollection services, Action<IRedactionBuilder> configure)
Configuring a redactor
Redactors are fetched at runtime using an IRedactorProvider. You can choose to implement your own provider and register it inside the AddRedaction call, or alternatively you can just use the default provider. Redactors can be configured using one of these IRedactionBuilder extension methods:
// Using the default redactor provider:
builder.Services.AddRedaction(redactionBuilder =>
{
// Assigns a redactor to use for a set of data classifications.
redactionBuilder.SetRedactor<MyRedactor>(MySensitiveDataClassification);
// Assigns a fallback redactor to use when processing classified data for which no specific redactor has been registered.
// The `ErasingRedactor` is the default fallback redactor. If no redactor is configured for a data classification then the data will be erased.
redactionBuilder.SetFallbackRedactor<MyFallbackRedactor>();
});
// Using a custom redactor provider:
builder.Services.AddSingleton<IRedactorProvider, MyRedactorProvider>();
builder.Services.AddRedaction(redactionBuilder => { });
Configuring the HMAC redactor
The HMAC redactor can be configured using one these IRedactionBuilder extension methods:
public static IRedactionBuilder SetHmacRedactor(this IRedactionBuilder builder, Action<HmacRedactorOptions> configure, params DataClassificationSet[] classifications)
public static IRedactionBuilder SetHmacRedactor(this IRedactionBuilder builder, IConfigurationSection section, params DataClassificationSet[] classifications)
The HmacRedactorOptions requires its KeyId and Key properties to be set. The HmacRedactor is still in the experimental phase, which means that the above two methods will show warning EXTEXP0002 notifying you that the HmacRedactor is not yet stable. In order to use it, you will need to either add <NoWarn>$(NoWarn);EXTEXP0002</NoWarn> to your project file or add #pragma warning disable EXTEXP0002 around the calls to SetHmacRedactor.
Feedback & Contributing
We welcome feedback and contributions in our GitHub repo.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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 is compatible. 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 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. |
| .NET Framework | net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
.NETFramework 4.6.2
- Microsoft.Extensions.Compliance.Abstractions (>= 10.1.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- System.Collections.Immutable (>= 8.0.0)
-
net10.0
- Microsoft.Extensions.Compliance.Abstractions (>= 10.1.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.1)
-
net8.0
- Microsoft.Extensions.Compliance.Abstractions (>= 10.1.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
-
net9.0
- Microsoft.Extensions.Compliance.Abstractions (>= 10.1.0)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 9.0.11)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on Microsoft.Extensions.Compliance.Redaction:
| Package | Downloads |
|---|---|
|
Cnblogs.Architecture.Ddd.Cqrs.ServiceAgent
Provides abstrations for implementing service agent. |
|
|
Reliance.Titan.Core
Package designed by Reliance Consultoria that provides support for handling cross-cutting concerns in our Microservices. |
|
|
Core.Runtime.DataProtection
Package Description |
|
|
EncineCarlos.Obfuscator
A powerful and easy-to-use library for obfuscating sensitive data in .NET applications. Automatically redacts properties marked with [SensitiveData] attribute using Microsoft Extensions Compliance framework. Perfect for logging, debugging, and data protection scenarios. |
GitHub repositories (6)
Showing the top 6 popular GitHub repositories that depend on Microsoft.Extensions.Compliance.Redaction:
| Repository | Stars |
|---|---|
|
dotnet/AspNetCore.Docs
Documentation for ASP.NET Core
|
|
|
mehdihadeli/food-delivery-microservices
🍔 A practical and cloud-native food delivery microservices, built with .Net Aspire, .Net 9, MassTransit, Domain-Driven Design, CQRS, Vertical Slice Architecture, Event-Driven Architecture, and the latest technologies.
|
|
|
getcellm/cellm
Use LLMs in Excel formulas
|
|
|
dotnet/ai-samples
|
|
|
erwinkramer/bank-api
The Bank API is a design reference project suitable to bootstrap development for a compliant and modern API.
|
|
|
foxminchan/BookWorm
The practical implementation of Aspire using Microservices, AI-Agents
|
| Version | Downloads | Last Updated |
|---|---|---|
| 10.1.0 | 126 | 12/9/2025 |
| 10.0.0 | 30,696 | 11/11/2025 |
| 9.10.0 | 29,095 | 10/14/2025 |
| 9.9.0 | 53,461 | 9/9/2025 |
| 9.8.0 | 71,448 | 8/12/2025 |
| 9.7.0 | 34,202 | 7/8/2025 |
| 9.6.0 | 48,208 | 6/10/2025 |
| 9.5.0 | 121,800 | 5/13/2025 |
| 9.4.0 | 82,537 | 4/8/2025 |
| 9.3.0 | 24,601 | 3/11/2025 |
| 9.2.0 | 98,539 | 2/11/2025 |
| 9.1.0 | 64,461 | 1/14/2025 |
| 9.0.0 | 121,296 | 11/12/2024 |
| 9.0.0-preview.9.24507.7 | 486 | 10/8/2024 |
| 9.0.0-preview.8.24460.1 | 142 | 9/10/2024 |
| 9.0.0-preview.7.24412.10 | 256 | 8/14/2024 |
| 9.0.0-preview.6.24353.1 | 193 | 7/10/2024 |
| 9.0.0-preview.5.24311.7 | 140 | 6/11/2024 |
| 9.0.0-preview.4.24271.2 | 788 | 5/21/2024 |
| 9.0.0-preview.3.24209.3 | 384 | 4/11/2024 |
| 9.0.0-preview.2.24157.4 | 310 | 3/12/2024 |
| 9.0.0-preview.1.24108.1 | 179 | 2/13/2024 |
| 8.10.0 | 196,442 | 10/8/2024 |
| 8.9.1 | 56,981 | 9/6/2024 |
| 8.9.0 | 741 | 9/5/2024 |
| 8.8.0 | 28,302 | 8/13/2024 |
| 8.7.0 | 26,008 | 7/10/2024 |
| 8.6.0 | 52,482 | 6/11/2024 |
| 8.5.0 | 66,894 | 5/14/2024 |
| 8.4.0 | 28,131 | 4/9/2024 |
| 8.3.0 | 10,535 | 3/12/2024 |
| 8.2.0 | 10,099 | 2/13/2024 |
| 8.1.0 | 15,673 | 1/9/2024 |
| 8.0.0 | 58,557 | 11/14/2023 |
| 8.0.0-rc.2.23510.2 | 157 | 10/10/2023 |
| 8.0.0-rc.1.23453.1 | 180 | 9/12/2023 |
| 8.0.0-preview.7.23407.5 | 177 | 8/8/2023 |
| 8.0.0-preview.6.23360.2 | 168 | 7/12/2023 |
| 8.0.0-preview.5.23308.3 | 175 | 6/14/2023 |
| 8.0.0-preview.4.23273.7 | 186 | 5/23/2023 |