ICryptFactory: - `IRSADecryptor this[string key]`-Indexer für den Zugriff auf Entschlüssler per Schlüssel hinzugefügt. - Methode `TryGetRSADecryptor` für das sichere Abrufen von Entschlüsslern eingeführt. CryptFactory: - `IRSADecryptor`-Indexer für die Verwaltung von Entschlüsslern implementiert. - Ein `Decryptors`-Dictionary hinzugefügt, um RSA-Entschlüssler nach Schlüssel zu speichern. - Konstruktor aktualisiert, um `Decryptors` mit einem bereitgestellten oder leeren Dictionary zu initialisieren. - `TryGetRSADecryptor` zur Entschlüssler-Abfrage implementiert.
34 lines
989 B
C#
34 lines
989 B
C#
using System.Security.Cryptography;
|
|
|
|
namespace DigitalData.Core.Abstractions.Security
|
|
{
|
|
public interface ICryptFactory
|
|
{
|
|
int KeySizeInBits { get; init; }
|
|
|
|
string PbePassword { init; }
|
|
|
|
PbeEncryptionAlgorithm PbeEncryptionAlgorithm { get; init; }
|
|
|
|
HashAlgorithmName PbeHashAlgorithmName { get; init; }
|
|
|
|
int PbeIterationCount { get; init; }
|
|
|
|
PbeParameters PbeParameters { get; }
|
|
|
|
string EncryptedPrivateKeyPemLabel { get; init; }
|
|
|
|
string CreateRSAPrivateKeyPem(int? keySizeInBits = null);
|
|
|
|
string CreateEncryptedPrivateKeyPem(
|
|
int? keySizeInBits = null,
|
|
string? password = null,
|
|
PbeEncryptionAlgorithm? pbeEncryptionAlgorithm = null,
|
|
HashAlgorithmName? hashAlgorithmName = null,
|
|
int? iterationCount = null);
|
|
|
|
IRSADecryptor this[string key] { get; }
|
|
|
|
bool TryGetRSADecryptor(string key, out IRSADecryptor? decryptor);
|
|
}
|
|
} |