feat(RSACryptographer): Virtuelle FileNotFoundEvent-Methode für nicht gefundene Pem-Datei hinzugefügt
This commit is contained in:
parent
dbfee49dee
commit
5c09d7775b
@ -30,15 +30,20 @@ namespace DigitalData.Core.Security.Cryptographer
|
|||||||
|
|
||||||
internal RSACryptographer() { }
|
internal RSACryptographer() { }
|
||||||
|
|
||||||
|
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}.");
|
||||||
|
|
||||||
// TODO: make file read asynchronous, consider multiple routing
|
// TODO: make file read asynchronous, consider multiple routing
|
||||||
public virtual void Init()
|
public virtual void Init()
|
||||||
{
|
{
|
||||||
if(_pem is null)
|
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}.");
|
||||||
if (File.Exists(PemPath))
|
if (File.Exists(PemPath))
|
||||||
_pem = File.ReadAllText(PemPath);
|
_pem = File.ReadAllText(PemPath);
|
||||||
else
|
else
|
||||||
throw new FileNotFoundException($"Pem is not assigned. Furthermore Pem file is not found in {PemPath}. Issuer is {Issuer} and audience {Audience}.");
|
FileNotFoundEvent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user