Refactor EmailAccountDto and improve encryption logic

Refactored `EmailAccountDto` to focus on SMTP-related properties, removing unused fields. Updated `DependencyInjection` to configure data protection with a new key storage path. Simplified `DataProtectionEncryptionService` by removing redundant checks and error handling for encryption and decryption methods.
This commit is contained in:
2026-07-23 13:06:42 +02:00
parent 0ee6e4f96e
commit 6a5e0a6086
3 changed files with 14 additions and 31 deletions

View File

@@ -13,25 +13,11 @@ public class DataProtectionEncryptionService(IDataProtectionProvider Provider) :
public string Encrypt(string plainText)
{
if (string.IsNullOrEmpty(plainText))
return string.Empty;
return Protector.Protect(plainText);
}
public string Decrypt(string cipherText)
{
if (string.IsNullOrEmpty(cipherText))
return string.Empty;
try
{
return Protector.Unprotect(cipherText);
}
catch (Exception)
{
// If decryption fails, return empty (corrupt data or wrong key)
return string.Empty;
}
return Protector.Unprotect(cipherText);
}
}