refactor(IRSACryptographer): Init-Methode, Verzeichnis- und Dateinamen-Getter-Setter hinzugefügt

This commit is contained in:
Developer 02 2024-12-07 02:09:32 +01:00
parent 38bd23d012
commit fa5d0f1b26
3 changed files with 22 additions and 2 deletions

View File

@ -8,8 +8,14 @@ namespace DigitalData.Core.Abstractions.Security
public RSAEncryptionPadding Padding { get; init; }
public string? Directory { get; set; }
public string? FileName { get; set; }
public string Issuer { get; init; }
public string Audience { get; init; }
public void Init();
}
}

View File

@ -8,5 +8,19 @@ namespace DigitalData.Core.Security.Config
public IEnumerable<IRSADecryptor> Decryptors { get; init; } = new List<IRSADecryptor>();
public IEnumerable<IRSAEncryptor> Encryptors { get; init; } = new List<IRSAEncryptor>();
public override void OnDeserialized()
{
base.OnDeserialized();
foreach (var decryptor in Decryptors)
{
// set default path
if(decryptor.Pem is null && decryptor.FileName is null)
dec
decryptor.Init();
}
}
}
}

View File

@ -14,9 +14,9 @@ namespace DigitalData.Core.Security.Cryptographer
init => _pem = value;
}
public string? PemPath => FileName is null ? null : Path.Combine(Directory, FileName);
public string? PemPath => FileName is null ? null : Path.Combine(Directory ?? string.Empty, FileName);
public string Directory { get; set; } = string.Empty;
public string? Directory { get; set; }
public string? FileName { get; set; }