refactor: Umbenennung von CryptoFactory in RSAPool und ICryptoFactory in IAsymmetricKeyPool
This commit is contained in:
parent
0523308083
commit
b8de148c52
@ -1,9 +1,9 @@
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace DigitalData.Core.Abstractions.Security
|
||||
namespace DigitalData.Core.Abstractions.Security;
|
||||
|
||||
public interface IAsymmetricKeyFactory
|
||||
{
|
||||
public interface IAsymmetricKeyFactory
|
||||
{
|
||||
string CreatePrivateKeyPem(int? keySizeInBits = null, bool encrypt = false);
|
||||
|
||||
string CreateEncryptedPrivateKeyPem(
|
||||
@ -19,5 +19,4 @@ namespace DigitalData.Core.Abstractions.Security
|
||||
string? password = null);
|
||||
|
||||
IAsymmetricDecryptor CreateDecryptor(string pem, string? issuer = null, string? audience = null, bool encrypt = false, RSAEncryptionPadding? padding = null);
|
||||
}
|
||||
}
|
||||
10
DigitalData.Core.Abstractions/Security/IAsymmetricKeyPool.cs
Normal file
10
DigitalData.Core.Abstractions/Security/IAsymmetricKeyPool.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace DigitalData.Core.Abstractions.Security;
|
||||
|
||||
public interface IAsymmetricKeyPool : IAsymmetricKeyFactory
|
||||
{
|
||||
IEnumerable<IAsymmetricDecryptor> Decryptors { get; }
|
||||
|
||||
IAsymmetricDecryptor VaultDecryptor { get; }
|
||||
|
||||
IEnumerable<IAsymmetricTokenDescriptor> TokenDescriptors { get; }
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
namespace DigitalData.Core.Abstractions.Security
|
||||
{
|
||||
public interface ICryptoFactory : IAsymmetricKeyFactory
|
||||
{
|
||||
IEnumerable<IAsymmetricDecryptor> Decryptors { get; }
|
||||
|
||||
IAsymmetricDecryptor VaultDecryptor { get; }
|
||||
|
||||
IEnumerable<IAsymmetricTokenDescriptor> TokenDescriptors { get; }
|
||||
}
|
||||
}
|
||||
@ -19,7 +19,7 @@ namespace DigitalData.Core.Security
|
||||
public static IServiceCollection AddCryptoFactory(this IServiceCollection services, IConfiguration configuration) => services
|
||||
.Configure<CryptoFactoryParams>(configuration)
|
||||
.AddAutoMapper(typeof(MappingProfile).Assembly)
|
||||
.AddSingleton<ICryptoFactory, CryptoFactory>()
|
||||
.AddSingleton<IAsymmetricKeyPool, RSAPool>()
|
||||
.AddSingleton<IAsymmetricKeyFactory, RSAFactory>()
|
||||
.AddHostedService<PemFileInitalizer>();
|
||||
|
||||
|
||||
@ -13,9 +13,9 @@ public class JwtSignatureHandler<TPrincipal> : JwtSecurityTokenHandler, IJwtSign
|
||||
|
||||
private readonly IMapper _mapper;
|
||||
|
||||
private readonly ICryptoFactory _cryptoFactory;
|
||||
private readonly IAsymmetricKeyPool _cryptoFactory;
|
||||
|
||||
public JwtSignatureHandler(IOptions<ClaimDescriptor<TPrincipal>> claimDescriptorOptions, IMapper mapper, ICryptoFactory cryptoFactory)
|
||||
public JwtSignatureHandler(IOptions<ClaimDescriptor<TPrincipal>> claimDescriptorOptions, IMapper mapper, IAsymmetricKeyPool cryptoFactory)
|
||||
{
|
||||
_claimDescriptor = claimDescriptorOptions.Value;
|
||||
_mapper = mapper;
|
||||
|
||||
@ -5,7 +5,7 @@ using Microsoft.Extensions.Options;
|
||||
|
||||
namespace DigitalData.Core.Security.Services;
|
||||
|
||||
public class CryptoFactory : RSAFactory, ICryptoFactory, IAsymmetricKeyFactory
|
||||
public class RSAPool : RSAFactory, IAsymmetricKeyPool, IAsymmetricKeyFactory
|
||||
{
|
||||
private readonly CryptoFactoryParams _params;
|
||||
|
||||
@ -18,7 +18,7 @@ public class CryptoFactory : RSAFactory, ICryptoFactory, IAsymmetricKeyFactory
|
||||
|
||||
public IEnumerable<IAsymmetricTokenDescriptor> TokenDescriptors { get; init; } = new List<IAsymmetricTokenDescriptor>();
|
||||
|
||||
public CryptoFactory(IOptions<CryptoFactoryParams> cryptoFactoryParamsOptions, ILogger<CryptoFactory>? logger = null)
|
||||
public RSAPool(IOptions<CryptoFactoryParams> cryptoFactoryParamsOptions, ILogger<RSAPool>? logger = null)
|
||||
{
|
||||
_params = cryptoFactoryParamsOptions.Value;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user