refactor(RSAFactory): params-Abhängigkeit durch Ersetzen von params.Defaults entfernt
This commit is contained in:
@@ -6,13 +6,13 @@ namespace DigitalData.Core.Security.Config
|
||||
{
|
||||
public class RSAFactoryParams
|
||||
{
|
||||
public int KeySizeInBits { get; init; } = 2048;
|
||||
public int KeySizeInBits { get; init; } = Default.KeySizeInBits;
|
||||
|
||||
public string PbePassword { internal get; init; } = Secrets.PBE_PASSWORD;
|
||||
public string PbePassword { internal get; init; } = Default.PbePassword;
|
||||
|
||||
public PbeEncryptionAlgorithm PbeEncryptionAlgorithm { get; init; } = PbeEncryptionAlgorithm.Aes256Cbc;
|
||||
public PbeEncryptionAlgorithm PbeEncryptionAlgorithm { get; init; } = Default.PbeEncryptionAlgorithm;
|
||||
|
||||
public HashAlgorithmName PbeHashAlgorithm { get; init; } = HashAlgorithmName.SHA256;
|
||||
public HashAlgorithmName PbeHashAlgorithm { get; init; } = Default.PbeHashAlgorithm;
|
||||
|
||||
// TODO: add as json converter to IConfigurIConfiguration.Config
|
||||
public string PbeHashAlgorithmName
|
||||
@@ -23,9 +23,9 @@ namespace DigitalData.Core.Security.Config
|
||||
: new(value);
|
||||
}
|
||||
|
||||
public int PbeIterationCount { get; init; } = 100_000;
|
||||
public int PbeIterationCount { get; init; } = Default.PbeIterationCount;
|
||||
|
||||
public string EncryptedPrivateKeyPemLabel { get; init; } = "ENCRYPTED PRIVATE KEY";
|
||||
public string EncryptedPrivateKeyPemLabel { get; init; } = Default.EncryptedPrivateKeyPemLabel;
|
||||
|
||||
private readonly Lazy<PbeParameters> _lazyPbeParameters;
|
||||
|
||||
@@ -36,5 +36,22 @@ namespace DigitalData.Core.Security.Config
|
||||
{
|
||||
_lazyPbeParameters = new(() => new PbeParameters(PbeEncryptionAlgorithm, PbeHashAlgorithm, PbeIterationCount));
|
||||
}
|
||||
|
||||
public static class Default
|
||||
{
|
||||
public static readonly int KeySizeInBits = 2048;
|
||||
|
||||
public static readonly string PbePassword = Secrets.PBE_PASSWORD;
|
||||
|
||||
public static readonly PbeEncryptionAlgorithm PbeEncryptionAlgorithm = PbeEncryptionAlgorithm.Aes256Cbc;
|
||||
|
||||
public static readonly HashAlgorithmName PbeHashAlgorithm = HashAlgorithmName.SHA256;
|
||||
|
||||
public static readonly int PbeIterationCount = 100_000;
|
||||
|
||||
public static readonly string EncryptedPrivateKeyPemLabel = "ENCRYPTED PRIVATE KEY";
|
||||
|
||||
public static readonly PbeParameters PbeParameters = new(PbeEncryptionAlgorithm, PbeHashAlgorithm, PbeIterationCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user