Remove encryption service and related configurations

The `IEncryptionService` interface and its implementation,
`DataProtectionEncryptionService`, have been removed from the
codebase. These components previously provided encryption and
decryption functionality using the ASP.NET Core Data Protection API.

Additionally, the dependency injection setup for the encryption
service and the Data Protection API configuration (e.g., key
persistence and application name) have been removed from
`DependencyInjection.cs`.
This commit is contained in:
2026-08-18 15:49:44 +02:00
parent 57ba948fe6
commit 26c78d32ae
3 changed files with 0 additions and 41 deletions

View File

@@ -1,10 +0,0 @@
namespace DigitalData.MessagingService.Application.Common.Interfaces;
/// <summary>
/// Encryption service interface for password encryption.
/// </summary>
public interface IEncryptionService
{
string Encrypt(string plainText);
string Decrypt(string cipherText);
}

View File

@@ -53,9 +53,6 @@ public static class DependencyInjection
// PDF Processing Service (using DevExpress.Pdf)
services.AddScoped<IPdfProcessingService, DevExpressPdfProcessingService>();
// Encryption Service (using Data Protection API - Singleton, thread-safe)
services.AddSingleton<IEncryptionService, DataProtectionEncryptionService>();
// --- Email Queue (RabbitMQ) ---
services.AddSingleton<SendingEmailConsumerPool>();
services.AddMessagingServicePublisher();
@@ -63,11 +60,6 @@ public static class DependencyInjection
// --- RabbitMQ Configuration ---
services.AddRabbitMqConnectionFactory(configuration);
// --- Data Protection (for encryption) ---
services.AddDataProtection()
.PersistKeysToFileSystem(new DirectoryInfo(@"C:\ProgramData\EmailService\Keys"))
.SetApplicationName("MessagingService");
// Register Background Workers
services.AddHostedService<AsyncInitWorker>();
services.AddHostedService<EmailSyncWorker>();

View File

@@ -1,23 +0,0 @@
using DigitalData.MessagingService.Application.Common.Interfaces;
using Microsoft.AspNetCore.DataProtection;
namespace DigitalData.MessagingService.Infrastructure.Services;
/// <summary>
/// Encryption service using ASP.NET Core Data Protection API.
/// Passwords are encrypted at rest in the database.
/// </summary>
public class DataProtectionEncryptionService(IDataProtectionProvider Provider) : IEncryptionService
{
private readonly IDataProtector Protector = Provider.CreateProtector("MessagingService.Passwords");
public string Encrypt(string plainText)
{
return Protector.Protect(plainText);
}
public string Decrypt(string cipherText)
{
return Protector.Unprotect(cipherText);
}
}