refactor(RSAFactoryParams): Implementierung von IJsonOnDeserialized anstelle von Lazy Initialization.
This commit is contained in:
parent
e9d408a717
commit
fa60147507
@ -1,8 +1,9 @@
|
|||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace DigitalData.Core.Security.Config
|
namespace DigitalData.Core.Security.Config
|
||||||
{
|
{
|
||||||
public class RSAFactoryParams
|
public class RSAFactoryParams : IJsonOnDeserialized
|
||||||
{
|
{
|
||||||
public int KeySizeInBits { get; init; } = 2048;
|
public int KeySizeInBits { get; init; } = 2048;
|
||||||
|
|
||||||
@ -16,11 +17,11 @@ namespace DigitalData.Core.Security.Config
|
|||||||
|
|
||||||
public string EncryptedPrivateKeyPemLabel { get; init; } = "ENCRYPTED PRIVATE KEY";
|
public string EncryptedPrivateKeyPemLabel { get; init; } = "ENCRYPTED PRIVATE KEY";
|
||||||
|
|
||||||
private readonly Lazy<PbeParameters> _lazyPbeParameters;
|
private PbeParameters? _pbeParameters;
|
||||||
|
|
||||||
public PbeParameters PbeParameters => _lazyPbeParameters.Value;
|
[JsonIgnore]
|
||||||
|
public PbeParameters PbeParameters => _pbeParameters!;
|
||||||
|
|
||||||
public RSAFactoryParams()
|
public void OnDeserialized() => _pbeParameters = new PbeParameters(PbeEncryptionAlgorithm, PbeHashAlgorithmName, PbeIterationCount);
|
||||||
=> _lazyPbeParameters = new(() => new PbeParameters(PbeEncryptionAlgorithm, PbeHashAlgorithmName, PbeIterationCount));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user