refactor(RSAFactory): Entfernen der Methode ReadRSADecryptorAsync.

This commit is contained in:
Developer 02 2024-12-07 02:01:06 +01:00
parent 50e2581727
commit 38bd23d012
4 changed files with 2 additions and 24 deletions

View File

@ -12,7 +12,5 @@ namespace DigitalData.Core.Abstractions.Security
PbeEncryptionAlgorithm? pbeEncryptionAlgorithm = null,
HashAlgorithmName? hashAlgorithmName = null,
int? iterationCount = null);
Task<IRSADecryptor> ReadRSADecryptorAsync(string path, Version? version = null, CancellationToken cancellationToken = default);
}
}

View File

@ -1,4 +1,5 @@
using DigitalData.Core.Abstractions.Security;
using System.Text.Json.Serialization;
namespace DigitalData.Core.Security.Config
{

View File

@ -22,6 +22,6 @@ namespace DigitalData.Core.Security.Config
[JsonIgnore]
public PbeParameters PbeParameters => _pbeParameters!;
public void OnDeserialized() => _pbeParameters = new PbeParameters(PbeEncryptionAlgorithm, PbeHashAlgorithmName, PbeIterationCount);
public virtual void OnDeserialized() => _pbeParameters = new PbeParameters(PbeEncryptionAlgorithm, PbeHashAlgorithmName, PbeIterationCount);
}
}

View File

@ -40,26 +40,5 @@ namespace DigitalData.Core.Security.Cryptographer
return new string(pemChars);
}
public async Task<IRSADecryptor> ReadRSADecryptorAsync(string path, Version? version = null, CancellationToken cancellationToken = default)
{
var pem = await File.ReadAllTextAsync(path, cancellationToken);
(string Value, Version Version)? versionedPassword = null;
if (version is not null)
{
if (version != Secrets.Version)
throw new InvalidOperationException($"The provided version {version} does not match the expected version {Secrets.Version}.");
versionedPassword = (Secrets.PBE_PASSWORD, Secrets.Version);
}
return new RSADecryptor()
{
Pem = pem,
VersionedPassword = versionedPassword
};
}
}
}