JGUZDV.AspNetCore.DataProtection 2.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package JGUZDV.AspNetCore.DataProtection --version 2.0.0
                    
NuGet\Install-Package JGUZDV.AspNetCore.DataProtection -Version 2.0.0
                    
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="JGUZDV.AspNetCore.DataProtection" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="JGUZDV.AspNetCore.DataProtection" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="JGUZDV.AspNetCore.DataProtection" />
                    
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 JGUZDV.AspNetCore.DataProtection --version 2.0.0
                    
#r "nuget: JGUZDV.AspNetCore.DataProtection, 2.0.0"
                    
#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 JGUZDV.AspNetCore.DataProtection@2.0.0
                    
#: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=JGUZDV.AspNetCore.DataProtection&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=JGUZDV.AspNetCore.DataProtection&version=2.0.0
                    
Install as a Cake Tool

JGUZDV.AspNetCore.DataProtection

This package allows to configure data protection via the appsettings.json file (or the AspNetCore configuration system to be more precise). If you want to configure multiple applications running on a shared host, you might want to set those keys via the environment variables. E.g. JGUZDV__DataProtection__Persistence__FileSystem__Path.

It can be addded via the extension method AddJGUZDVDataProtection on either IServiceCollection or WebApplicationBuilder.

Program.cs

// Registeres the DataProtection settings in production
if (builder.Environment.IsProduction())
{
    builder.AddJGUZDVDataProtection();
}

appsettings.json

{
  "JGUZDV": {
    "DataProtection" : {    // default section JGUZDV:DataProtection - a custom section can be passed
      "ApplicationDiscriminator" : "MyApp",    // Name to be used by SetApplicationName
      "DisableAutomaticKeyGeneration" : false    // if true automatic key generation is disabled, default: false

      "Persistence" : {    // must be defined
        "FileSystem" : {    // must be defined
          "Path" : "/my-dataprot-path/",    // path for file system persistence
          "IsolatedPathDiscriminator" : true    // if not set, IHostingEnvironment.ApplicationName will be used as default
        }
      },

      "UseProtection" : true    // if true, protect keys, default: true
      "Protection" : {    // must be defined if UseProtection is true
        "UseCertificate" : false,    // if true, use certificate for protection
        "Certificate" : {    // optional, must be defined if UseCertificate is true
          "Thumbprint" : "",    // certificate thumbprint - must be set if file name is empty
          "FileName" : "name",    // certificate filename - must be set if thumbprint empty
          "Password" : "password"    // optional password for certificate
        },
        "UseDpapi" : false,    // if true, use Windows DPAPI
        "UseDpapiNG" : false    // if true, use Windows Server DpapiNG
      }
    }
  }
}
Product 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on JGUZDV.AspNetCore.DataProtection:

Package Downloads
JGUZDV.AspNetCore.Hosting

HostBuilders for our default setup.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.1.0 143 11/3/2026
2.0.1 734 3/31/2025
2.0.0 367 2/25/2025
1.1.1 625 6/12/2023
1.1.0 320 5/16/2023
1.0.2 495 1/23/2023
1.0.1 490 1/3/2023
1.0.0 476 1/2/2023