DKNet.Svc.Encryption 13.3.1

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

DKNet.Svc.Encryption

Explicitly-invoked cryptography toolkit for .NET developers — AES-GCM and RSA encryption, RSA signing, HMAC and SHA hashing, and Base64/Base64URL helpers, all string-in/string-out.

✨ Why use it?

  • Authenticated AES-256-GCM encryption with a fresh nonce per call, packaged into one opaque Base64 string.
  • RSA encrypt/decrypt (OAEP-SHA256) and sign/verify (SHA-256 with PKCS#1 v1.5), including public-key-only instances.
  • HMAC-SHA256/512 and SHA-256/512 compute plus constant-time verify.
  • Base64 and Base64URL encode/decode helpers.
  • No EF Core, hosting, or storage dependency — usable from any domain service, console app, or worker.

AES-CBC (IAesEncryption, AesEncryption, EncryptionSetup.AddAesEncryption) was removed, not deprecated, with no compatibility shim, and ciphertext it produced has no conversion path. See the AES-GCM feature page for details.

🚀 Quick Start

Use a .NET 10 console project. Install the package, then replace Program.cs with the example.

dotnet new console -f net10.0 -n EncDemo
cd EncDemo
dotnet add package DKNet.Svc.Encryption
dotnet add package Microsoft.Extensions.DependencyInjection
using DKNet.Svc.Encryption;
using DKNet.Svc.Encryption.Ciphers;
using Microsoft.Extensions.DependencyInjection;

var services = new ServiceCollection();
services.AddEncryptionServices();                                   // IShaHashing, IHmacHashing
services.AddAesGcmEncryption(new AesGcmEncryption().Key);            // a throwaway demo key
using var provider = services.BuildServiceProvider();

var aesGcm = provider.GetRequiredService<IAesGcmEncryption>();
var package = aesGcm.EncryptString("4111-1111-1111-1111");
var plain = aesGcm.DecryptString(package);
Console.WriteLine(plain); // 4111-1111-1111-1111

Run with dotnet run. In a real application, source the key passed to AddAesGcmEncryption from configuration or a key vault — never a freshly generated one.

Documentation

Guide Read when
Package overview Start with architecture and the end-to-end flow.
AES-GCM authenticated encryption Encrypt and decrypt a string with a fresh nonce every call.
RSA encryption and signing Asymmetric encrypt/decrypt and sign/verify, including public-only instances.
SHA content hashing Compute and verify SHA-256/512 hex digests.
HMAC message signing Compute and verify keyed HMAC-SHA256/512 signatures.
Base64 and Base64URL encoding Encode/decode helpers for both alphabets.
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.

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
13.3.1 88 10/26/2026
13.3.0 92 10/22/2026
13.2.8 98 10/22/2026
13.2.7 101 10/11/2026
13.2.6 93 10/10/2026
13.2.5 98 10/2/2026
13.2.4 101 10/1/2026
13.2.3 101 10/1/2026
13.2.2 105 10/1/2026
13.2.1 96 10/1/2026
13.2.0 95 10/1/2026
13.1.3 119 9/21/2026
13.1.2 107 9/18/2026
13.1.1 114 9/18/2026
13.1.0 99 9/18/2026
13.0.2 101 9/18/2026
13.0.1 101 9/18/2026
13.0.0 107 9/18/2026
12.0.0 99 9/17/2026
11.0.0 103 9/17/2026
Loading failed