feat(RSAEncryptor): FileNotFoundEvent-Methode aktualisiert, um Datei zu erstellen, wenn nicht gefunden
This commit is contained in:
parent
0bfec426d4
commit
4e0e907313
@ -5,7 +5,7 @@ namespace DigitalData.Core.Security.Cryptographer
|
|||||||
{
|
{
|
||||||
public class RSACryptographer : IRSACryptographer
|
public class RSACryptographer : IRSACryptographer
|
||||||
{
|
{
|
||||||
private string? _pem;
|
protected string? _pem;
|
||||||
|
|
||||||
public string Pem
|
public string Pem
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
using DigitalData.Core.Abstractions.Security;
|
using DigitalData.Core.Abstractions.Security;
|
||||||
|
using DigitalData.Core.Security.Config;
|
||||||
using DigitalData.Core.Security.Extensions;
|
using DigitalData.Core.Security.Extensions;
|
||||||
|
|
||||||
namespace DigitalData.Core.Security.Cryptographer
|
namespace DigitalData.Core.Security.Cryptographer
|
||||||
@ -16,5 +17,21 @@ namespace DigitalData.Core.Security.Cryptographer
|
|||||||
base.Init();
|
base.Init();
|
||||||
RSA.ImportFromPem(base.Pem);
|
RSA.ImportFromPem(base.Pem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void FileNotFoundEvent()
|
||||||
|
{
|
||||||
|
var new_decryptor = new RSADecryptor()
|
||||||
|
{
|
||||||
|
Pem = RSAFactory<RSAFactoryParams>.Static.CreateRSAPrivateKeyPem()
|
||||||
|
};
|
||||||
|
|
||||||
|
_pem = new_decryptor.Encryptor.Pem;
|
||||||
|
|
||||||
|
if (PemPath is not null)
|
||||||
|
Task.Run(async () =>
|
||||||
|
{
|
||||||
|
await File.WriteAllTextAsync(_pem, PemPath);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user