fix(Core.Security): pem-Importprozess in den Initilizer mehetods verschoben
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using DigitalData.Core.Abstractions.Security;
|
||||
using DigitalData.Core.Security.Extensions;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace DigitalData.Core.Security
|
||||
{
|
||||
@@ -21,8 +22,26 @@ namespace DigitalData.Core.Security
|
||||
}
|
||||
}
|
||||
|
||||
public RSADecryptor()
|
||||
public RSADecryptor() { }
|
||||
|
||||
public RSADecryptor(string pem, string? password = null)
|
||||
{
|
||||
Pem = pem;
|
||||
Password = password;
|
||||
Initialize();
|
||||
}
|
||||
|
||||
[OnDeserialized]
|
||||
private void OnDeserialized(StreamingContext context)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
private void Initialize()
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(Pem))
|
||||
throw new InvalidOperationException("Pem cannot be null or empty.");
|
||||
|
||||
if (Password is null)
|
||||
_rsa.ImportFromPem(Pem);
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user