data-protection

Configures ASP.NET Core Data Protection API for encrypting sensitive data at rest.

4|1|Updated Mar 15, 2026
One-click install
npx skills add https://github.com/FaysilAlshareef/dotnet-ai-kit --skill data-protection-faysilalshareef
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: data-protection
Source: https://github.com/FaysilAlshareef/dotnet-ai-kit/tree/main/skills/security/data-protection
Command: npx skills add https://github.com/FaysilAlshareef/dotnet-ai-kit --skill data-protection-faysilalshareef

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Protects sensitive application data, tokens, and cookies stored at rest by providing guidance to use the ASP.NET Core Data Protection API for encryption, key management, and isolation across services.

Core Features & Use Cases

  • Automatic key management and rotation: configure key lifetimes and storage so keys are rotated and persisted reliably.
  • Purpose-isolated protectors and time-limited tokens: create separate protectors for tokens, API keys, and sensitive fields and issue expiring tokens for password resets or confirmations.
  • Distributed key storage options: persist keys to the file system, Redis, or Azure Blob Storage with optional Key Vault protection for web farms and microservices.
  • Encrypting database fields and cookie protection: apply protectors in Entity Framework value converters and ensure authentication and antiforgery tokens are protected.
  • Use Case: implement time-limited password reset tokens and store API keys encrypted in the database while sharing key material across a load-balanced web farm.

Quick Start

Configure AddDataProtection in Program.cs with a consistent application name and persist keys to a shared store such as Redis or Azure Blob Storage to enable safe encryption of tokens and sensitive fields.

Frequently Asked Questions about data-protection

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I encrypt sensitive database fields in ASP.NET Core?

You can encrypt sensitive database fields in ASP.NET Core by applying Data Protection API protectors within Entity Framework value converters, ensuring sensitive data is encrypted at rest before persistence.

What's the best way to share data protection keys across a load-balanced web farm?

The best way to share data protection keys across a load-balanced web farm is to persist key material to a distributed storage option like Redis, Azure Blob Storage, or a shared file system to maintain consistent encryption across instances.

How do I generate time-limited tokens for password resets in ASP.NET Core?

To generate time-limited tokens for password resets in ASP.NET Core, use the Data Protection API to issue expiring tokens with purpose-isolated protectors that automatically invalidate after a specified lifetime.

Can I use Azure Key Vault to protect data protection keys in a distributed deployment?

Yes, you can protect data protection keys in a distributed deployment using Azure Key Vault, combining Azure Blob Storage for key persistence with Key Vault for enhanced encryption of key material at rest.

Why do I need purpose-isolated protectors when encrypting API keys and authentication cookies?

Purpose-isolated protectors are needed when encrypting API keys and authentication cookies to cryptographically separate different payload types, preventing cross-substitution attacks between tokens and sensitive fields.