NCache.OSS.AspNetCore.DataProtection
5.3.603
dotnet add package NCache.OSS.AspNetCore.DataProtection --version 5.3.603
NuGet\Install-Package NCache.OSS.AspNetCore.DataProtection -Version 5.3.603
<PackageReference Include="NCache.OSS.AspNetCore.DataProtection" Version="5.3.603" />
<PackageVersion Include="NCache.OSS.AspNetCore.DataProtection" Version="5.3.603" />
<PackageReference Include="NCache.OSS.AspNetCore.DataProtection" />
paket add NCache.OSS.AspNetCore.DataProtection --version 5.3.603
#r "nuget: NCache.OSS.AspNetCore.DataProtection, 5.3.603"
#:package NCache.OSS.AspNetCore.DataProtection@5.3.603
#addin nuget:?package=NCache.OSS.AspNetCore.DataProtection&version=5.3.603
#tool nuget:?package=NCache.OSS.AspNetCore.DataProtection&version=5.3.603
NCache as Key Storage Provider for ASP.NET Core Data Protection
Introduction
ASP.NET Core Data Protection is a security system that protects sensitive information through encryption. It manages encryption keys whose storage location can vary, Like file system, Azure Storage, or a custom repository. The NCache.OSS.AspNetCore.DataProtection package lets you use NCache as that custom key storage provider, so encryption keys are stored in the cache and shared across multiple instances of a web application running in a web farm.
Prerequisites
- NCache OSS v5.3.603 server running, with your target cache in Started state.
- An ASP.NET Core application with Data Protection configured.
Usage
Step 1: Configure your NCache connection
Two configuration files are copied to your output directory on build: client.ncconf and config.ncconf
client.ncconf points the client at your NCache server. Set your server IP and make sure cache id matches the cache name you pass in code:
<cache id="myCache" enable-client-logs="False" log-level="error">
<server name="YOUR_SERVER_IP"/>
</cache>
config.ncconf holds cache side settings and ships with sensible defaults. Adjust only if your cache configuration requires it.
Step 2: Register NCache as the key storage provider
In your Program.cs, chain PersistKeysToNCache onto AddDataProtection:
builder.Services.AddDataProtection()
.PersistKeysToNCache("myCache", "DataProtectionKeys");
- First argument (
cacheName) the name of the cache where encryption keys will be stored. Must match thecache idinclient.ncconf. - Second argument (
cacheTag) an arbitrary string used internally to group and retrieve all keys together. Every server instance in your web farm must use the same value.
Keys are stored as Base64 encoded XML elements and expire automatically based on the expiration time embedded in each key by the Data Protection framework. Revocation entries are stored without expiration.
How It Works
PersistKeysToNCache registers an NCacheXmlRepository as the IXmlRepository for the Data Protection key management system. On startup, the repository connects to the specified cache. When the framework needs to store a new key, it calls StoreElement, which encodes the key XML to Base64 and inserts it into the cache under the provided tag. When the framework needs all current keys (e.g., to decrypt data), it calls GetAllElements, which retrieves every item grouped under that tag and deserializes them back to XML.
Additional Resources
Documentation
http://www.alachisoft.com/resources/docs/#ncache
Programmer's Guide
http://www.alachisoft.com/resources/docs/ncache/prog-guide/
ASP.NET Core Data Protection
https://learn.microsoft.com/en-us/aspnet/core/security/data-protection/introduction
Key Storage Providers
Technical Support
Alachisoft � provides various sources of technical support.
- Refer to http://www.alachisoft.com/support.html to select a support resource suited to your issue.
- To request additional features, or report a discrepancy in this document, email support@alachisoft.com.
License
Copyright � 2005-2026 Alachisoft. All rights reserved.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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 was computed. 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 was computed. 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 Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Alachisoft.NCache.Opensource.SDK (>= 5.3.603)
- Microsoft.AspNetCore.DataProtection (>= 10.0.12)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.