fix(AsymCryptParams): Dateinamenerweiterung hinzugefügt.

This commit is contained in:
Developer 02 2024-12-17 14:06:09 +01:00
parent f38bad8531
commit b3629661a1
2 changed files with 12 additions and 2 deletions

View File

@ -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));

View File

@ -27,6 +27,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DigitalData.Core.Terminal",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DigitalData.Core.Extensions", "DigitalData.Core.Extensions\DigitalData.Core.Extensions.csproj", "{FC6AD1C4-5D7C-4B50-9330-B7A0E52B24B8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DigitalData.Core.Tests.API", "DigitalData.Core.Tests.API\DigitalData.Core.Tests.API.csproj", "{9BC2DEC5-E89D-48CC-9A51-4D94496EE4A6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -80,6 +82,10 @@ Global
{FC6AD1C4-5D7C-4B50-9330-B7A0E52B24B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FC6AD1C4-5D7C-4B50-9330-B7A0E52B24B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FC6AD1C4-5D7C-4B50-9330-B7A0E52B24B8}.Release|Any CPU.Build.0 = Release|Any CPU
{9BC2DEC5-E89D-48CC-9A51-4D94496EE4A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9BC2DEC5-E89D-48CC-9A51-4D94496EE4A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9BC2DEC5-E89D-48CC-9A51-4D94496EE4A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9BC2DEC5-E89D-48CC-9A51-4D94496EE4A6}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE