Compare commits

...

2 Commits

Author SHA1 Message Date
khwezi a763e5e40e Merge pull request 'Added certificate protected data protection keys' (#124) from dataprotection into master
Reviewed-on: #124
2026-06-14 11:27:32 +02:00
Khwezi Mngoma 9b15e296df Added certificate protected data protection keys
continuous-integration/drone/pr Build is passing
2026-06-14 11:26:20 +02:00
2 changed files with 5 additions and 1 deletions
+4
View File
@@ -5,6 +5,7 @@ using LiteCharms.Features.Api.Sdk;
using LiteCharms.Features.Postgres;
using Microsoft.AspNetCore.Hosting;
using System.Runtime.InteropServices;
using System.Security.Cryptography.X509Certificates;
namespace LiteCharms.Features.Extensions;
@@ -56,7 +57,10 @@ public static class Api
public static IServiceCollection AddLiteCharmsWebSecurity(this IServiceCollection services, IConfiguration configuration)
{
var certificate = X509CertificateLoader.LoadPkcs12(Convert.FromBase64String(configuration["DataProtection:Certificate"]!), configuration["DataProtection:Password"]);
services.AddDataProtection().PersistKeysToDbContext<DataProtectionDbContext>()
.ProtectKeysWithCertificate(certificate)
.SetApplicationName("LiteCharmsApp");
var configSection = configuration.GetSection(nameof(LiteCharmsSettings));