12 Commits

Author SHA1 Message Date
Developer 02
f38bad8531 refactor(gitignore): ignored Tests.API 2024-12-16 18:07:47 +01:00
Developer 02
154478c318 feat(ParamsConfigureOptions): Erstellt, um nach der Konfiguration über appsettings initialisiert zu werden.
- DI Extension Methoden wurden entsprechend bearbeitet.
2024-12-16 17:20:40 +01:00
Developer 02
155eb563d1 feat: Lazy-Initialisierung für threadsichere RSAFactoryParams-Initialisierung hinzugefügt
- Lazy-Initialisierungsmechanismus für threadsichere Handhabung der _pbeParameters eingeführt.
- IsInitialized-Eigenschaft hinzugefügt, um den Initialisierungsstatus zu verfolgen.
- Konstruktor geändert, um das Lazy-Objekt zu initialisieren und das AfterCreate-Ereignis auszulösen.
- Sichergestellt, dass die OnDeserialized-Methode Init aufruft, um das Objekt korrekt zu initialisieren.
2024-12-16 16:37:48 +01:00
Developer 02
4aacc3f650 feat(AsymCryptService): Vault.get RSADecryptor hinzugefügt
- Optionen aktualisiert, um Vault-Parameter hinzufügen zu können. Wenn es null ist, ist Vault der erste Entschlüsseler.
 - Standard-Entschlüssler entfernt.
2024-12-16 12:56:30 +01:00
Developer 02
f40c86ed63 feat: Erweiterung des IAsymCryptService-Interfaces um zusätzliche Verschlüsselungs- und Entschlüsselungsfunktionen
- Hinzugefügt: `IEnumerable<IRSADecryptor>` und `IEnumerable<IRSAEncryptor>` zum `IAsymCryptService`-Interface.
- Einführung einer `Default`-Eigenschaft für den einfachen Zugriff auf einen Standard-Entschlüsseler.
- Aktualisierung des `IAsymCryptService`-Interfaces zur Unterstützung sowohl von Entschlüsselungs- als auch Verschlüsselungsfunktionen.
2024-12-16 11:41:52 +01:00
Developer 02
b32f0df125 refactor(AsymCryptService): Methode Default.get hinzugefügt, um den ersten Decryptor zu erhalten.
- Wirft InvalidOperationException, wenn kein Decryptor verfügbar ist.
2024-12-16 10:54:48 +01:00
Developer 02
324a5bdb1e refactor(RSAFactory): isEncrypted-Eingang von CreateDecryptor umbenennen in encrypt. 2024-12-16 10:51:46 +01:00
Developer 02
e0a6787a87 feat(RSAFactory): Unterstützung für die Erstellung von RSA-Decryptors hinzugefügt
- Methode `CreateDecryptor` hinzugefügt, um die Erstellung von `IRSADecryptor`-Instanzen zu vereinfachen.
- Stellt sicher, dass Decryptors mit PEM, Aussteller, Empfänger, Verschlüsselungsstatus und Padding-Einstellungen initialisiert werden.
- Bestehende Funktionalität zur Erstellung privater und verschlüsselter privater Schlüssel beibehalten.
- Die RSA-Factory verbessert, um Workflows zur Entschlüsselung besser zu unterstützen.
2024-12-16 10:37:56 +01:00
Developer 02
c6a4038eab refactor: Umbenennung von Core.Security.Extensions in Core.Extension 2024-12-16 10:24:19 +01:00
Developer 02
58c8520c08 refactor(RSADecryptor): Verbesserung der PEM-Initialisierung und Konsistenz
- Die `Pem`-Eigenschaft aktualisiert, sodass während der Initialisierung automatisch `Init()` aufgerufen wird, um eine konsistente Einrichtung sicherzustellen.
- Die Methode `SetPem` überarbeitet, um nach dem Setzen des PEM-Werts `Init()` aufzurufen.
- Die Methode `Init()` verbessert, um null- oder leere PEM-Werte robuster zu behandeln.
- Fehlermeldungen für mehr Klarheit und bessere Debugging-Unterstützung verbessert.
- Interne RSA-Initialisierungslogik an die Verarbeitung von Verschlüsselungen angepasst.
2024-12-16 10:05:51 +01:00
Developer 02
eced1a5afc feat(RSAFactory): Optionale Verschlüsselungseingabe in CreatePrivateKeyPem Methode hinzugefügt.
- Falsch als Standard eingestellt.
2024-12-16 10:01:09 +01:00
Developer 02
7da93c6719 refactor(DIExtensions): Verbesserung der Registrierung von AsymCrypt-Diensten und Vereinfachung von Overloads
- `AddAsymCryptService` aktualisiert, um eine Standardimplementierung mit `AsymCryptParams` ohne generische Typen bereitzustellen.
- Neue Überladung von `AddAsymCryptService` hinzugefügt, die eine `IConfigurationSection` für Standardparameter akzeptiert.
- Lebensdauer der Service-Registrierungen für `IAsymCryptService` von `Scoped` auf `Singleton` geändert, um Konsistenz und geringeren Overhead zu gewährleisten.
2024-12-16 09:44:51 +01:00
18 changed files with 177 additions and 146 deletions

1
.gitignore vendored
View File

@@ -410,3 +410,4 @@ FodyWeavers.xsd
/DigitalData.Core.ConsoleApp/FooHttpOptions.cs
/DigitalData.Core.Tests/obj/
/DigitalData.Core.Terminal
/DigitalData.Core.Tests.API

View File

@@ -1,10 +1,14 @@
namespace DigitalData.Core.Abstractions.Security
{
public interface IAsymCryptService : IRSAFactory
public interface IAsymCryptService : IRSAFactory, IEnumerable<IRSADecryptor>
{
public IEnumerable<IRSADecryptor> Decryptors { get; }
IEnumerable<IRSADecryptor> Decryptors { get; }
public IRSADecryptor this[string key] { get; }
IRSADecryptor Vault { get; }
IRSADecryptor this[string key] { get; }
IEnumerable<IRSAEncryptor> Encryptors { get; }
}
public interface IAsymCryptService<TParams> : IAsymCryptService, IRSAFactory<TParams> { }

View File

@@ -4,19 +4,21 @@ namespace DigitalData.Core.Abstractions.Security
{
public interface IRSAFactory
{
string CreatePrivateKeyPem(int? keySizeInBits = null);
string CreatePrivateKeyPem(int? keySizeInBits = null, bool encrypt = false);
public string CreateEncryptedPrivateKeyPem(
string CreateEncryptedPrivateKeyPem(
PbeEncryptionAlgorithm? pbeEncryptionAlgorithm = null,
HashAlgorithmName? hashAlgorithmName = null,
int? iterationCount = null,
int? keySizeInBits = null,
string? password = null);
public string CreateEncryptedPrivateKeyPem(
string CreateEncryptedPrivateKeyPem(
PbeParameters pbeParameters,
int? keySizeInBits = null,
string? password = null);
IRSADecryptor CreateDecryptor(string pem, string? issuer = null, string? audience = null, bool encrypt = false, RSAEncryptionPadding? padding = null);
}
public interface IRSAFactory<TParams> : IRSAFactory { }

View File

@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@@ -1,6 +1,6 @@
namespace DigitalData.Core.Security.Extensions
namespace DigitalData.Core.Extensions
{
public static class Extensions
public static class StringExtensions
{
public static string ToBase64String(this byte[] bytes) => Convert.ToBase64String(bytes);

View File

@@ -1,13 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\DigitalData.Core.Abstractions\DigitalData.Core.Abstractions.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,60 +0,0 @@
using DigitalData.Core.Abstractions.Security;
using System.Collections.Concurrent;
using System.Security.Cryptography;
namespace DigitalData.Core.Security.Extensions
{
public static class RSAExtensions
{
public static RSA ToRSA(this string pem)
{
var rsa = RSA.Create();
rsa.ImportFromPem(pem);
return rsa;
}
private static string CreatePath(string filename, string? directory = null)
{
directory ??= Environment.CurrentDirectory;
if (!Directory.Exists(directory))
{
Directory.CreateDirectory(directory);
}
return Path.Combine(directory, $"{filename}.pem");
}
private static readonly ConcurrentDictionary<string, SemaphoreSlim> FileLocks = new();
public static void SavePem(this IRSACryptographer decryptor, string key, string? directory = null)
{
var filePath = CreatePath(filename: key, directory : directory);
var fileLock = FileLocks.GetOrAdd(filePath, _ => new (1, 1));
fileLock.Wait();
try
{
File.WriteAllText(filePath, decryptor.Pem);
}
finally
{
fileLock.Release();
}
}
public static async Task SavePemAsync(this IRSACryptographer decryptor, string key, string? directory = null)
{
var filePath = CreatePath(filename: key, directory: directory);
var fileLock = FileLocks.GetOrAdd(filePath, _ => new (1, 1));
await fileLock.WaitAsync();
try
{
await File.WriteAllTextAsync(filePath, decryptor.Pem);
}
finally
{
fileLock.Release();
}
}
}
}

View File

@@ -10,7 +10,12 @@ namespace DigitalData.Core.Security
public class AsymCryptService<TAsymCryptParams> : RSAFactory<TAsymCryptParams>, IAsymCryptService<TAsymCryptParams>, IRSAFactory<TAsymCryptParams>, IEnumerable<IRSADecryptor>
where TAsymCryptParams : AsymCryptParams
{
public IEnumerable<IRSADecryptor> Decryptors => _params.Decryptors;
public IEnumerable<IRSADecryptor> Decryptors { get; }
/// <summary>
/// It is a separate decryptor for permanently stored encrypted data. It is assigned to the first Default decryptor by default.
/// </summary>
public IRSADecryptor Vault { get; }
public IRSADecryptor this[string key]
{
@@ -29,6 +34,17 @@ namespace DigitalData.Core.Security
public AsymCryptService(IOptions<TAsymCryptParams> options, ILogger<AsymCryptService<TAsymCryptParams>>? logger = null) : base(options)
{
logger?.LogInformation("Core.Secrets version: {Version}, Created on: {CreationDate}.", Secrets.Version, Secrets.CreationDate.ToString("dd.MM.yyyy"));
if (!_params.Decryptors.Any())
throw new InvalidOperationException(
"Any decryptor is not found. Ensure that at least one decryptor is configured in the provided parameters. " +
"This issue typically arises if the configuration for decryptors is incomplete or missing. " +
"Check the 'Decryptors' collection in the configuration and verify that it contains valid entries."
);
Decryptors = _params.Decryptors;
Vault = _params.Vault ?? Decryptors.First();
}
public IEnumerator<IRSADecryptor> GetEnumerator() => Decryptors.GetEnumerator();
@@ -40,9 +56,7 @@ namespace DigitalData.Core.Security
get
{
foreach (var decryptor in Decryptors)
{
yield return decryptor.Encryptor;
}
}
}
}

View File

@@ -36,42 +36,43 @@ namespace DigitalData.Core.Security.Config
public IEnumerable<RSADecryptor> Decryptors { get; init; } = new List<RSADecryptor>();
public override void OnDeserialized()
public RSADecryptor? Vault { get; init; }
public AsymCryptParams()
{
base.OnDeserialized();
// Create root folder if it does not exist
if (!Directory.Exists(PemDirectory))
Directory.CreateDirectory(PemDirectory);
foreach (var decryptor in Decryptors)
AfterCreate += () =>
{
// set default path
if (decryptor.IsPemNull)
// Create root folder if it does not exist
if (!Directory.Exists(PemDirectory))
Directory.CreateDirectory(PemDirectory);
foreach (var decryptor in Decryptors)
{
var file_name_params = new List<object> { decryptor.Issuer, decryptor.Audience };
if (decryptor.IsEncrypted)
file_name_params.Add(Secrets.Version);
var path = Path.Combine(PemDirectory, string.Join(FileNameSeparator, file_name_params));
if (File.Exists(path))
decryptor.SetPem(File.ReadAllText(path));
else
// set default path
if (decryptor.IsPemNull)
{
var pem = decryptor.IsEncrypted
? Instance.RSAFactory.CreateEncryptedPrivateKeyPem(pbeParameters: PbeParameters, keySizeInBits: KeySizeInBits, password: Secrets.PBE_PASSWORD)
: Instance.RSAFactory.CreatePrivateKeyPem(keySizeInBits: KeySizeInBits);
var file_name_params = new List<object> { decryptor.Issuer, decryptor.Audience };
if (decryptor.IsEncrypted)
file_name_params.Add(Secrets.Version);
decryptor.SetPem(File.ReadAllText(pem));
var path = Path.Combine(PemDirectory, string.Join(FileNameSeparator, file_name_params));
// Save file in background
Task.Run(async () => await File.WriteAllTextAsync(path: path, pem));
if (File.Exists(path))
decryptor.SetPem(File.ReadAllText(path));
else
{
var pem = decryptor.IsEncrypted
? Instance.RSAFactory.CreateEncryptedPrivateKeyPem(pbeParameters: PbeParameters, keySizeInBits: KeySizeInBits, password: Secrets.PBE_PASSWORD)
: Instance.RSAFactory.CreatePrivateKeyPem(keySizeInBits: KeySizeInBits);
decryptor.SetPem(File.ReadAllText(pem));
// Save file in background
Task.Run(async () => await File.WriteAllTextAsync(path: path, pem));
}
}
}
decryptor.Init();
}
};
}
}
}

View File

@@ -0,0 +1,9 @@
using Microsoft.Extensions.Options;
namespace DigitalData.Core.Security.Config
{
public class ParamsConfigureOptions<TParams> : IConfigureOptions<TParams> where TParams : RSAFactoryParams
{
public void Configure(TParams options) => options.Init();
}
}

View File

@@ -22,6 +22,28 @@ namespace DigitalData.Core.Security.Config
[JsonIgnore]
public PbeParameters PbeParameters => _pbeParameters!;
public virtual void OnDeserialized() => _pbeParameters = new PbeParameters(PbeEncryptionAlgorithm, PbeHashAlgorithmName, PbeIterationCount);
/// <summary>
/// Provides a thread-safe initialization mechanism using Lazy initialization.
/// </summary>
private readonly Lazy<bool> _lazyInitializer;
public bool IsInitialized => _lazyInitializer.IsValueCreated;
public RSAFactoryParams()
{
_lazyInitializer = new(() =>
{
AfterCreate?.Invoke();
return true;
});
AfterCreate += () => _pbeParameters = new PbeParameters(PbeEncryptionAlgorithm, PbeHashAlgorithmName, PbeIterationCount);
}
protected event Action AfterCreate;
public void Init() => _ = _lazyInitializer.Value;
public void OnDeserialized() => Init();
}
}

View File

@@ -3,6 +3,7 @@ using System.Security.Cryptography;
namespace DigitalData.Core.Security.Cryptographer
{
//TODO: Abstract RSA for future updates (using ECC, El Gamal or Lattice-based Cryptography)
public class RSACryptographer : IRSACryptographer
{
public virtual string Pem { get; init; }

View File

@@ -1,5 +1,5 @@
using DigitalData.Core.Abstractions.Security;
using DigitalData.Core.Security.Extensions;
using DigitalData.Core.Extensions;
using System.Security.Cryptography;
namespace DigitalData.Core.Security.Cryptographer
@@ -8,7 +8,15 @@ namespace DigitalData.Core.Security.Cryptographer
{
private string? _pem;
public override string Pem { get => _pem ?? throw PemIsNullException; init => _pem = value; }
public override string Pem
{
get => _pem ?? throw PemIsNullException;
init
{
_pem = value;
Init();
}
}
public bool IsPemNull => _pem is null;
@@ -31,11 +39,15 @@ namespace DigitalData.Core.Security.Cryptographer
public string Decrypt(string data) => RSA.Decrypt(data.Base64ToByte(), Padding).BytesToString();
internal void SetPem(string pem) => _pem = pem;
public void Init()
internal void SetPem(string pem)
{
if (_pem is null)
_pem = pem;
Init();
}
private void Init()
{
if (string.IsNullOrEmpty(_pem))
throw PemIsNullException;
if (IsEncrypted)
@@ -44,6 +56,6 @@ namespace DigitalData.Core.Security.Cryptographer
RSA.ImportFromPem(Pem);
}
private InvalidOperationException PemIsNullException => new($"Pem is not initialized. Please ensure that the PEM is set or properly loaded from the file. Issuer: {Issuer}, Audience: {Audience}.");
private InvalidOperationException PemIsNullException => new($"Pem is null or empty. Issuer: {Issuer}, Audience: {Audience}.");
}
}

View File

@@ -1,5 +1,5 @@
using DigitalData.Core.Abstractions.Security;
using DigitalData.Core.Security.Extensions;
using DigitalData.Core.Extensions;
namespace DigitalData.Core.Security.Cryptographer
{

View File

@@ -9,10 +9,15 @@ namespace DigitalData.Core.Security.Cryptographer
{
protected readonly TRSAFactoryParams _params;
public RSAFactory(IOptions<TRSAFactoryParams> options) => _params = options.Value;
public RSAFactory(IOptions<TRSAFactoryParams> options)
{
options.Value.Init();
_params = options.Value;
}
public string CreatePrivateKeyPem(int? keySizeInBits = null)
=> RSA.Create(keySizeInBits ?? _params.KeySizeInBits).ExportRSAPrivateKeyPem();
public string CreatePrivateKeyPem(int? keySizeInBits = null, bool encrypt = false) => encrypt
? CreateEncryptedPrivateKeyPem(keySizeInBits: keySizeInBits)
: RSA.Create(keySizeInBits ?? _params.KeySizeInBits).ExportRSAPrivateKeyPem();
public string CreateEncryptedPrivateKeyPem(
PbeEncryptionAlgorithm? pbeEncryptionAlgorithm = null,
@@ -50,5 +55,14 @@ namespace DigitalData.Core.Security.Cryptographer
return new string(pemChars);
}
public IRSADecryptor CreateDecryptor(string pem, string? issuer = null, string? audience = null, bool encrypt = false, RSAEncryptionPadding? padding = null) => new RSADecryptor()
{
Pem = pem,
Issuer = issuer ?? string.Empty,
Audience = audience ?? string.Empty,
IsEncrypted = encrypt,
Padding = padding ?? RSAEncryptionPadding.OaepSHA256
};
}
}

View File

@@ -20,11 +20,14 @@ namespace DigitalData.Core.Security
options.Converters.Add(new JsonStringEnumConverter());
return options;
}
private static IServiceCollection AddParamsConfigureOptions<TParams>(this IServiceCollection services) where TParams : RSAFactoryParams
=> services.AddSingleton<IConfigureOptions<TParams>, ParamsConfigureOptions<TParams>>();
private static IServiceCollection AddAsymCryptService<TAsymCryptParams>(this IServiceCollection services, bool setAsDefault = false) where TAsymCryptParams : AsymCryptParams
=> setAsDefault
? services.AddScoped<IAsymCryptService, AsymCryptService<TAsymCryptParams>>()
: services.AddScoped<IAsymCryptService<TAsymCryptParams>, AsymCryptService<TAsymCryptParams>>();
? services.AddParamsConfigureOptions<TAsymCryptParams>().AddSingleton<IAsymCryptService, AsymCryptService<TAsymCryptParams>>()
: services.AddParamsConfigureOptions<TAsymCryptParams>().AddSingleton<IAsymCryptService<TAsymCryptParams>, AsymCryptService<TAsymCryptParams>>();
/// <summary>
/// Registers a custom asym crypt service with specified parameters from the given configuration section.
@@ -34,10 +37,20 @@ namespace DigitalData.Core.Security
/// <param name="section"></param>
/// <param name="setAsDefault">If true, the factory is registered as the default <see cref="IRSAFactory"/>. Otherwise, it is registered as <see cref="IRSAFactory{TRSAFactoryParams}"/>.</param>
/// <returns></returns>
public static IServiceCollection AddAsymCryptService<TAsymCryptParams>(this IServiceCollection services, IConfigurationSection section, bool setAsDefault = false)
where TAsymCryptParams : AsymCryptParams
=> services.Configure<TAsymCryptParams>(section).AddAsymCryptService<TAsymCryptParams>(setAsDefault: setAsDefault);
public static IServiceCollection AddAsymCryptService<TAsymCryptParams>(this IServiceCollection services, IConfigurationSection section, bool setAsDefault = false) where TAsymCryptParams : AsymCryptParams => services
.Configure<TAsymCryptParams>(section)
.AddAsymCryptService<TAsymCryptParams>(setAsDefault: setAsDefault);
/// <summary>
/// Registers a custom asym crypt service with default parameters from the given configuration section.
/// </summary>
/// <param name="services"></param>
/// <param name="section"></param>
/// <param name="setAsDefault"></param>
/// <returns></returns>
public static IServiceCollection AddAsymCryptService(this IServiceCollection services, IConfigurationSection section, bool setAsDefault = false)
=> services.Configure<AsymCryptParams>(section).AddAsymCryptService<AsymCryptParams>(setAsDefault: setAsDefault);
/// <summary>
/// Registers an asym crypt service with the specified parameters from the given instance. Optionally, sets it as the default factory.
/// </summary>
@@ -46,9 +59,9 @@ namespace DigitalData.Core.Security
/// <param name="param"></param>
/// <param name="setAsDefault">If true, the factory is registered as the default <see cref="IRSAFactory"/>. Otherwise, it is registered as <see cref="IRSAFactory{TRSAFactoryParams}"/>.</param>
/// <returns></returns>
public static IServiceCollection AddAsymCryptService<TAsymCryptParams>(this IServiceCollection services, TAsymCryptParams param, bool setAsDefault = false)
where TAsymCryptParams : AsymCryptParams
=> services.AddSingleton(Options.Create(param)).AddAsymCryptService<TAsymCryptParams>(setAsDefault: setAsDefault);
public static IServiceCollection AddAsymCryptService<TAsymCryptParams>(this IServiceCollection services, TAsymCryptParams param, bool setAsDefault = false) where TAsymCryptParams : AsymCryptParams => services
.AddSingleton(Options.Create(param))
.AddAsymCryptService<TAsymCryptParams>(setAsDefault: setAsDefault);
/// <summary>
/// Registers default asym crypt service with the specified parameters from the given instance.
@@ -56,7 +69,8 @@ namespace DigitalData.Core.Security
/// <param name="services"></param>
/// <param name="param"></param>
/// <returns></returns>
public static IServiceCollection AddAsymCryptService(this IServiceCollection services, AsymCryptParams param) => services.AddAsymCryptService(param: param, setAsDefault: true);
public static IServiceCollection AddAsymCryptService(this IServiceCollection services, AsymCryptParams param) => services
.AddAsymCryptService(param: param, setAsDefault: true);
/// <summary>
/// Registers default RSA Factory instance with default params
@@ -64,8 +78,9 @@ namespace DigitalData.Core.Security
/// <param name="services"></param>
/// <param name="factoryParams"></param>
/// <returns>The updated <see cref="IServiceCollection"/> with the RSA Factory registered.</returns>
public static IServiceCollection AddRSAFactory(this IServiceCollection services, RSAFactoryParams? factoryParams = null)
=> services.AddScoped<IRSAFactory>(_ => new RSAFactory<RSAFactoryParams>(Options.Create(factoryParams ?? new())));
public static IServiceCollection AddRSAFactory(this IServiceCollection services, RSAFactoryParams? factoryParams = null) => services
.AddParamsConfigureOptions<RSAFactoryParams>()
.AddScoped<IRSAFactory>(_ => new RSAFactory<RSAFactoryParams>(Options.Create(factoryParams ?? new())));
/// <summary>
/// Registers a custom RSA Factory with specified parameters from the given configuration section.
@@ -78,7 +93,7 @@ namespace DigitalData.Core.Security
public static IServiceCollection AddRSAFactory<TRSAFactoryParams>(this IServiceCollection services, IConfigurationSection section, bool setAsDefault = false)
where TRSAFactoryParams : RSAFactoryParams
{
services.Configure<TRSAFactoryParams>(section);
services.AddParamsConfigureOptions<TRSAFactoryParams>().Configure<TRSAFactoryParams>(section);
return setAsDefault
? services.AddSingleton<IRSAFactory, RSAFactory<TRSAFactoryParams>>()
: services.AddSingleton<IRSAFactory<TRSAFactoryParams>, RSAFactory<TRSAFactoryParams>>();
@@ -97,8 +112,8 @@ namespace DigitalData.Core.Security
{
services.AddSingleton(Options.Create(rsaParams));
return setAsDefault
? services.AddSingleton<IRSAFactory, RSAFactory<TRSAFactoryParams>>()
: services.AddSingleton<IRSAFactory<TRSAFactoryParams>, RSAFactory<TRSAFactoryParams>>();
? services.AddParamsConfigureOptions<TRSAFactoryParams>().AddSingleton<IRSAFactory, RSAFactory<TRSAFactoryParams>>()
: services.AddParamsConfigureOptions<TRSAFactoryParams>().AddSingleton<IRSAFactory<TRSAFactoryParams>, RSAFactory<TRSAFactoryParams>>();
}
}
}

View File

@@ -12,7 +12,7 @@
<ItemGroup>
<ProjectReference Include="..\DigitalData.Core.Abstractions\DigitalData.Core.Abstractions.csproj" />
<ProjectReference Include="..\DigitalData.Core.Security.Extensions\DigitalData.Core.Security.Extensions.csproj" />
<ProjectReference Include="..\DigitalData.Core.Extensions\DigitalData.Core.Extensions.csproj" />
</ItemGroup>
</Project>

View File

@@ -23,9 +23,9 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DigitalData.Core.Legacy.Cli
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DigitalData.Core.Security", "DigitalData.Core.Security\DigitalData.Core.Security.csproj", "{47D80C65-74A2-4EB8-96A5-D571A9108FB3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DigitalData.Core.Security.Extensions", "DigitalData.Core.Security.Extensions\DigitalData.Core.Security.Extensions.csproj", "{D740182D-82DA-480A-9F87-BFB4A8620A00}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DigitalData.Core.Terminal", "DigitalData.Core.Terminal\DigitalData.Core.Terminal.csproj", "{0FA93730-8084-4907-B172-87D610323796}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DigitalData.Core.Terminal", "DigitalData.Core.Terminal\DigitalData.Core.Terminal.csproj", "{0FA93730-8084-4907-B172-87D610323796}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DigitalData.Core.Extensions", "DigitalData.Core.Extensions\DigitalData.Core.Extensions.csproj", "{FC6AD1C4-5D7C-4B50-9330-B7A0E52B24B8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -72,14 +72,14 @@ Global
{47D80C65-74A2-4EB8-96A5-D571A9108FB3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{47D80C65-74A2-4EB8-96A5-D571A9108FB3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{47D80C65-74A2-4EB8-96A5-D571A9108FB3}.Release|Any CPU.Build.0 = Release|Any CPU
{D740182D-82DA-480A-9F87-BFB4A8620A00}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D740182D-82DA-480A-9F87-BFB4A8620A00}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D740182D-82DA-480A-9F87-BFB4A8620A00}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D740182D-82DA-480A-9F87-BFB4A8620A00}.Release|Any CPU.Build.0 = Release|Any CPU
{0FA93730-8084-4907-B172-87D610323796}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0FA93730-8084-4907-B172-87D610323796}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0FA93730-8084-4907-B172-87D610323796}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0FA93730-8084-4907-B172-87D610323796}.Release|Any CPU.Build.0 = Release|Any CPU
{FC6AD1C4-5D7C-4B50-9330-B7A0E52B24B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FC6AD1C4-5D7C-4B50-9330-B7A0E52B24B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FC6AD1C4-5D7C-4B50-9330-B7A0E52B24B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FC6AD1C4-5D7C-4B50-9330-B7A0E52B24B8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE