fix(AsymCryptParams): Dateinamenerweiterung hinzugefügt.
This commit is contained in:
@@ -20,6 +20,8 @@ namespace DigitalData.Core.Security.Config
|
||||
/// </example>
|
||||
public string FileNameSeparator { get; init; } = "_-_";
|
||||
|
||||
public string FileExtension { get; init; } = "pem";
|
||||
|
||||
/// <summary>
|
||||
/// Represents the separator used to concatenate the components of a key-related token string.
|
||||
/// </summary>
|
||||
@@ -55,7 +57,9 @@ namespace DigitalData.Core.Security.Config
|
||||
if (decryptor.IsEncrypted)
|
||||
file_name_params.Add(Secrets.Version);
|
||||
|
||||
var path = Path.Combine(PemDirectory, string.Join(FileNameSeparator, file_name_params));
|
||||
var file_name = $"{string.Join(FileNameSeparator, file_name_params)}.{FileExtension}";
|
||||
|
||||
var path = Path.Combine(PemDirectory, file_name);
|
||||
|
||||
if (File.Exists(path))
|
||||
decryptor.SetPem(File.ReadAllText(path));
|
||||
@@ -65,7 +69,7 @@ namespace DigitalData.Core.Security.Config
|
||||
? Instance.RSAFactory.CreateEncryptedPrivateKeyPem(pbeParameters: PbeParameters, keySizeInBits: KeySizeInBits, password: Secrets.PBE_PASSWORD)
|
||||
: Instance.RSAFactory.CreatePrivateKeyPem(keySizeInBits: KeySizeInBits);
|
||||
|
||||
decryptor.SetPem(File.ReadAllText(pem));
|
||||
decryptor.SetPem(pem);
|
||||
|
||||
// Save file in background
|
||||
Task.Run(async () => await File.WriteAllTextAsync(path: path, pem));
|
||||
|
||||
Reference in New Issue
Block a user