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