feat(RSACryptographer): Virtuelle UnableToInitPemEvent-Methode für den Fall hinzugefügt, dass sowohl pem als auch pem-Pfad null sein können

This commit is contained in:
Developer 02 2024-12-07 01:33:56 +01:00
parent 5c09d7775b
commit 50e2581727

View File

@ -30,6 +30,9 @@ namespace DigitalData.Core.Security.Cryptographer
internal RSACryptographer() { }
public virtual void UnableToInitPemEvent() => throw new InvalidOperationException(
$"Pem is not initialized and pem file is null. Issuer is {Issuer} and audience {Audience}.");
public virtual void FileNotFoundEvent() => throw new FileNotFoundException(
$"Pem is not initialized and pem file is not found in {PemPath}. Issuer is {Issuer} and audience {Audience}.");
@ -39,7 +42,7 @@ namespace DigitalData.Core.Security.Cryptographer
if(_pem is null)
{
if(PemPath is null)
throw new InvalidOperationException($"Pem is not initialized and pem file is null. Issuer is {Issuer} and audience {Audience}.");
UnableToInitPemEvent();
if (File.Exists(PemPath))
_pem = File.ReadAllText(PemPath);
else