feat(Sicherheit): Umbenennung von CryptFactory und seiner Schnittstelle in (I)AsymCryptService

This commit is contained in:
Developer 02 2024-12-02 13:46:15 +01:00
parent 816d5835f1
commit a4b96c2f3e
4 changed files with 6 additions and 6 deletions

View File

@ -2,7 +2,7 @@
namespace DigitalData.Core.Abstractions.Security namespace DigitalData.Core.Abstractions.Security
{ {
public interface ICryptFactory public interface IAsymCryptService
{ {
int KeySizeInBits { get; init; } int KeySizeInBits { get; init; }

View File

@ -13,10 +13,10 @@ namespace DigitalData.Core.Security.Extensions
return rsa; return rsa;
} }
public static IRSADecryptor GetRSADecryptor(this ICryptFactory factory, string issuer, string audience, Version? version = null, string? seperator = null) public static IRSADecryptor GetRSADecryptor(this IAsymCryptService factory, string issuer, string audience, Version? version = null, string? seperator = null)
=> factory[factory.RSAKeyNameFormatter(issuer, audience, true, version, seperator)]; => factory[factory.RSAKeyNameFormatter(issuer, audience, true, version, seperator)];
public static bool TryGetRSADecryptor(this ICryptFactory factory, string issuer, string audience, out IRSADecryptor? decryptor, Version? version = null, string? seperator = null) public static bool TryGetRSADecryptor(this IAsymCryptService factory, string issuer, string audience, out IRSADecryptor? decryptor, Version? version = null, string? seperator = null)
=> factory.TryGetRSADecryptor(factory.RSAKeyNameFormatter(issuer, audience, true, version, seperator), out decryptor); => factory.TryGetRSADecryptor(factory.RSAKeyNameFormatter(issuer, audience, true, version, seperator), out decryptor);
private static string CreatePath(string filename, string? directory = null) private static string CreatePath(string filename, string? directory = null)

View File

@ -3,7 +3,7 @@ using Microsoft.Extensions.Logging;
namespace DigitalData.Core.Security namespace DigitalData.Core.Security
{ {
public class CryptFactory : RSAFactory, ICryptFactory public class AsymCryptService : RSAFactory, IAsymCryptService
{ {
private readonly IDictionary<string, IRSADecryptor> _decryptors; private readonly IDictionary<string, IRSADecryptor> _decryptors;
@ -11,7 +11,7 @@ namespace DigitalData.Core.Security
public Func<string, string, bool, Version?, string?, string> RSAKeyNameFormatter { get; } public Func<string, string, bool, Version?, string?, string> RSAKeyNameFormatter { get; }
public CryptFactory(ILogger<CryptFactory> logger, IDictionary<string, IRSADecryptor> decryptors, Func<string, string, bool, Version?, string?, string> rsaKeyNameFormatter) : base() public AsymCryptService(ILogger<AsymCryptService> logger, IDictionary<string, IRSADecryptor> decryptors, Func<string, string, bool, Version?, string?, string> rsaKeyNameFormatter) : base()
{ {
_decryptors = decryptors ?? new Dictionary<string, IRSADecryptor>(); _decryptors = decryptors ?? new Dictionary<string, IRSADecryptor>();

View File

@ -8,7 +8,7 @@ namespace DigitalData.Core.Security
{ {
public static IServiceCollection AddSecurity(this IServiceCollection services) public static IServiceCollection AddSecurity(this IServiceCollection services)
{ {
services.TryAddScoped<ICryptFactory, CryptFactory>(); services.TryAddScoped<IAsymCryptService, AsymCryptService>();
return services; return services;
} }