SqlServerDataProtectionProvider 1.0.0

A .Net Core Data Protection provider to persist keys to Sql Server
The primary public use of this library will be via the PersistKeysToSqlServer() IDataProtectionBuilder extension method.

Install-Package SqlServerDataProtectionProvider -Version 1.0.0
dotnet add package SqlServerDataProtectionProvider --version 1.0.0
<PackageReference Include="SqlServerDataProtectionProvider" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SqlServerDataProtectionProvider --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SqlServerDataProtectionProvider, 1.0.0"
For F# scripts that support #r syntax, copy this into the source code to reference the package.

SqlServerDataProtectionProvider

A .Net Core Data Protection provider to persist keys to Sql Server

The primary public use of this library will be via the PersistKeysToSqlServer() IDataProtectionBuilder extension method.

Usage:
In your database context, implement IDataProtectionContext and add a DbSet<DataProtectionKey> property.

    public class ApplicationDbContext : IDataProtectionContext
    {
        public DbSet<DataProtectionKey> DataProtectionKeys { get; set; }
    ...
    }

In Startup.cs's ConfigureServices method, add a service to provide the IDataProtectionContext:
services.AddTransient<IDataProtectionContext, ApplicationDbContext>();

Also in your startup's ConfigureServices method, when configuring DataProtection, you can now use PersistToSqlServer to persist your keys to a Sql Server database. You will need to provide the

Example:

  services.AddDataProtection()
      .PersistKeysToSqlServer(() => services.BuildServiceProvider().GetRequiredService<IDataProtectionContext>())
      .ProtectKeysWithCertificate(dataProtectionCert)
      .SetApplicationName("<AppName>")
      .SetDefaultKeyLifetime(TimeSpan.FromDays(10))
      .UseCryptographicAlgorithms(encryptionSettings);

SqlServerDataProtectionProvider

A .Net Core Data Protection provider to persist keys to Sql Server

The primary public use of this library will be via the PersistKeysToSqlServer() IDataProtectionBuilder extension method.

Usage:
In your database context, implement IDataProtectionContext and add a DbSet<DataProtectionKey> property.

    public class ApplicationDbContext : IDataProtectionContext
    {
        public DbSet<DataProtectionKey> DataProtectionKeys { get; set; }
    ...
    }

In Startup.cs's ConfigureServices method, add a service to provide the IDataProtectionContext:
services.AddTransient<IDataProtectionContext, ApplicationDbContext>();

Also in your startup's ConfigureServices method, when configuring DataProtection, you can now use PersistToSqlServer to persist your keys to a Sql Server database. You will need to provide the

Example:

  services.AddDataProtection()
      .PersistKeysToSqlServer(() => services.BuildServiceProvider().GetRequiredService<IDataProtectionContext>())
      .ProtectKeysWithCertificate(dataProtectionCert)
      .SetApplicationName("<AppName>")
      .SetDefaultKeyLifetime(TimeSpan.FromDays(10))
      .UseCryptographicAlgorithms(encryptionSettings);

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.0 874 8/12/2018