feat(RSADecryptor): FileNotFoundEvent-Methode aktualisiert, um Datei zu erstellen, wenn nicht gefunden
This commit is contained in:
parent
4e0e907313
commit
988d1e2b16
@ -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;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
|
|
||||||
@ -33,5 +34,22 @@ namespace DigitalData.Core.Security.Cryptographer
|
|||||||
else
|
else
|
||||||
RSA.ImportFromPem(Pem);
|
RSA.ImportFromPem(Pem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void FileNotFoundEvent()
|
||||||
|
{
|
||||||
|
var new_decryptor = new RSADecryptor()
|
||||||
|
{
|
||||||
|
Pem = RSAFactory<RSAFactoryParams>.Static.CreateRSAPrivateKeyPem(),
|
||||||
|
Encrypt = Encrypt
|
||||||
|
};
|
||||||
|
|
||||||
|
_pem = new_decryptor.Pem;
|
||||||
|
|
||||||
|
if (PemPath is not null)
|
||||||
|
Task.Run(async () =>
|
||||||
|
{
|
||||||
|
await File.WriteAllTextAsync(_pem, PemPath);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user