feat(RSACryptographer): Eigenschaft PaddingName hinzugefügt, um Padding mit dem Namen RSAEncryptionPadding zu initialisieren.
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using DigitalData.Core.Abstractions.Security;
|
using DigitalData.Core.Abstractions.Security;
|
||||||
|
using System.Reflection;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
|
|
||||||
namespace DigitalData.Core.Security.Cryptographer
|
namespace DigitalData.Core.Security.Cryptographer
|
||||||
@@ -8,7 +9,14 @@ namespace DigitalData.Core.Security.Cryptographer
|
|||||||
{
|
{
|
||||||
public virtual string Pem { get; init; }
|
public virtual string Pem { get; init; }
|
||||||
|
|
||||||
public RSAEncryptionPadding Padding { get; init; } = RSAEncryptionPadding.OaepSHA256;
|
public RSAEncryptionPadding Padding { get; init; }// = RSAEncryptionPadding.OaepSHA256;
|
||||||
|
|
||||||
|
// TODO: add as json converter to IConfigurIConfiguration.Config
|
||||||
|
public string PaddingName
|
||||||
|
{
|
||||||
|
get => Padding.ToString();
|
||||||
|
init => Padding = typeof(RSAEncryptionPadding).GetProperty(value, BindingFlags.Public | BindingFlags.Static)?.GetValue(null) as RSAEncryptionPadding ?? throw new ArgumentException($"Padding '{value}' not found.");
|
||||||
|
}
|
||||||
|
|
||||||
protected virtual RSA RSA { get; } = RSA.Create();
|
protected virtual RSA RSA { get; } = RSA.Create();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user