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.

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&lt;IDataProtectionContext, ApplicationDbContext&gt;();

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&lt;IDataProtectionContext, ApplicationDbContext&gt;();

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);

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.0 249 8/12/2018