DKNet.EfCore.Encryption
10.1.14
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package DKNet.EfCore.Encryption --version 10.1.14
NuGet\Install-Package DKNet.EfCore.Encryption -Version 10.1.14
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="DKNet.EfCore.Encryption" Version="10.1.14" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DKNet.EfCore.Encryption" Version="10.1.14" />
<PackageReference Include="DKNet.EfCore.Encryption" />
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 DKNet.EfCore.Encryption --version 10.1.14
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DKNet.EfCore.Encryption, 10.1.14"
#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 DKNet.EfCore.Encryption@10.1.14
#: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=DKNet.EfCore.Encryption&version=10.1.14
#tool nuget:?package=DKNet.EfCore.Encryption&version=10.1.14
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
DKNet.EfCore.Encryption
Transparent, column-level encryption for EF Core string properties. Mark a property [Encrypted], register a key provider, and EF Core encrypts values with AES-GCM before they hit the database and decrypts them on read — application code always sees plaintext.
dotnet add package DKNet.EfCore.Encryption
Features
[Encrypted]attribute — opt-in marker for anystringproperty.AesGcmColumnEncryptionProvider— default AES-128/192/256-GCM implementation (random IV per value, authenticated encryption).IColumnEncryptionProvider— swappable encryption algorithm abstraction.IEncryptionKeyProvider/EncryptionKeyProvider— bring your own key source (config, env var, Key Vault, etc.), one key per entity type.ModelBuilder.UseColumnEncryption(...)— one call inOnModelCreatingwires up every[Encrypted]property automatically; rejects primary/foreign key columns.services.AddEfCoreEncryption<TKeyProvider>()— registers your key provider in DI.
Quick start
public sealed class AppEncryptionKeyProvider : EncryptionKeyProvider
{
private readonly byte[] _key = Convert.FromBase64String(
Environment.GetEnvironmentVariable("APP_ENCRYPTION_KEY")!); // 16, 24, or 32 bytes
public override byte[] GetKey(Type entityType) => _key;
}
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddEfCoreEncryption<AppEncryptionKeyProvider>();
public class Customer
{
public int Id { get; set; }
[Encrypted]
public string? Ssn { get; set; }
}
public class AppDbContext(DbContextOptions<AppDbContext> options, IEncryptionKeyProvider keyProvider)
: DbContext(options)
{
public DbSet<Customer> Customers => Set<Customer>();
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.UseColumnEncryption(keyProvider);
}
}
Full documentation, configuration notes, and gotchas (query limitations on encrypted columns, key rotation, ciphertext sizing): https://github.com/baoduy/DKNet/blob/dev/docs/EfCore/DKNet.EfCore.Encryption.md
| 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Microsoft.EntityFrameworkCore (>= 10.0.11)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.1.27 | 0 | 9/16/2026 |
| 10.1.26 | 0 | 9/16/2026 |
| 10.1.25 | 0 | 9/16/2026 |
| 10.1.24 | 69 | 9/11/2026 |
| 10.1.23 | 75 | 9/11/2026 |
| 10.1.22 | 76 | 9/11/2026 |
| 10.1.21 | 82 | 9/11/2026 |
| 10.1.20 | 86 | 9/9/2026 |
| 10.1.19 | 102 | 9/3/2026 |
| 10.1.18 | 94 | 9/3/2026 |
| 10.1.17 | 98 | 9/3/2026 |
| 10.1.16 | 99 | 9/3/2026 |
| 10.1.15 | 96 | 9/1/2026 |
| 10.1.14 | 91 | 9/1/2026 |
| 10.1.13 | 92 | 8/31/2026 |
| 10.1.12 | 91 | 8/25/2026 |
| 10.1.11 | 103 | 8/24/2026 |
| 10.1.10 | 94 | 8/22/2026 |
| 10.1.9 | 97 | 8/22/2026 |
| 10.1.8 | 90 | 8/21/2026 |
Loading failed