From 50e25817275254443d5fcd4f6ec9a4fb0913699b Mon Sep 17 00:00:00 2001 From: Developer 02 Date: Sat, 7 Dec 2024 01:33:56 +0100 Subject: [PATCH] =?UTF-8?q?feat(RSACryptographer):=20Virtuelle=20UnableToI?= =?UTF-8?q?nitPemEvent-Methode=20f=C3=BCr=20den=20Fall=20hinzugef=C3=BCgt,?= =?UTF-8?q?=20dass=20sowohl=20pem=20als=20auch=20pem-Pfad=20null=20sein=20?= =?UTF-8?q?k=C3=B6nnen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DigitalData.Core.Security/Cryptographer/RSACryptographer.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/DigitalData.Core.Security/Cryptographer/RSACryptographer.cs b/DigitalData.Core.Security/Cryptographer/RSACryptographer.cs index 163d4bf..f6d3152 100644 --- a/DigitalData.Core.Security/Cryptographer/RSACryptographer.cs +++ b/DigitalData.Core.Security/Cryptographer/RSACryptographer.cs @@ -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