diff --git a/src/core/DigitalData.MessagingService.Application/Common/Interfaces/IEncryptionService.cs b/src/core/DigitalData.MessagingService.Application/Common/Interfaces/IEncryptionService.cs deleted file mode 100644 index a92fa0f..0000000 --- a/src/core/DigitalData.MessagingService.Application/Common/Interfaces/IEncryptionService.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace DigitalData.MessagingService.Application.Common.Interfaces; - -/// -/// Encryption service interface for password encryption. -/// -public interface IEncryptionService -{ - string Encrypt(string plainText); - string Decrypt(string cipherText); -} diff --git a/src/infrastructure/DigitalData.MessagingService.Infrastructure/DependencyInjection.cs b/src/infrastructure/DigitalData.MessagingService.Infrastructure/DependencyInjection.cs index 0b6faf3..9fe3f9b 100644 --- a/src/infrastructure/DigitalData.MessagingService.Infrastructure/DependencyInjection.cs +++ b/src/infrastructure/DigitalData.MessagingService.Infrastructure/DependencyInjection.cs @@ -53,9 +53,6 @@ public static class DependencyInjection // PDF Processing Service (using DevExpress.Pdf) services.AddScoped(); - // Encryption Service (using Data Protection API - Singleton, thread-safe) - services.AddSingleton(); - // --- Email Queue (RabbitMQ) --- services.AddSingleton(); 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(); services.AddHostedService(); diff --git a/src/infrastructure/DigitalData.MessagingService.Infrastructure/Services/DataProtectionEncryptionService.cs b/src/infrastructure/DigitalData.MessagingService.Infrastructure/Services/DataProtectionEncryptionService.cs deleted file mode 100644 index d0ca9fe..0000000 --- a/src/infrastructure/DigitalData.MessagingService.Infrastructure/Services/DataProtectionEncryptionService.cs +++ /dev/null @@ -1,23 +0,0 @@ -using DigitalData.MessagingService.Application.Common.Interfaces; -using Microsoft.AspNetCore.DataProtection; - -namespace DigitalData.MessagingService.Infrastructure.Services; - -/// -/// Encryption service using ASP.NET Core Data Protection API. -/// Passwords are encrypted at rest in the database. -/// -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); - } -}