refactor(Core.Security): Implementierung der entsprechenden Schnittstellen zu RSACryptographer, RSADecryptor und RSAEncryptor.

This commit is contained in:
Developer 02 2024-11-18 11:04:24 +01:00
parent 51ebf3fa67
commit 0bb779b7b6
4 changed files with 12 additions and 8 deletions

View File

@ -7,6 +7,7 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\DigitalData.Core.Abstractions\DigitalData.Core.Abstractions.csproj" />
<ProjectReference Include="..\DigitalData.Core.Security.Extensions\DigitalData.Core.Security.Extensions.csproj" />
</ItemGroup>

View File

@ -1,8 +1,9 @@
using System.Security.Cryptography;
using DigitalData.Core.Abstractions.Security;
using System.Security.Cryptography;
namespace DigitalData.Core.Security
{
public class RSACryptographer
public class RSACryptographer : IRSACryptographer
{
public required RSAEncryptionPadding Padding { get; init; }

View File

@ -1,19 +1,20 @@
using DigitalData.Core.Security.Extensions;
using DigitalData.Core.Abstractions.Security;
using DigitalData.Core.Security.Extensions;
namespace DigitalData.Core.Security
{
public class RSADecryptor : RSACryptographer
public class RSADecryptor : RSACryptographer, IRSADecryptor, IRSACryptographer
{
public required string PrivateKeyPem
{
init => _rsa.ImportFromPem(value);
}
public RSAEncryptor Encryptor
public IRSAEncryptor Encryptor
{
get
{
return new ()
return new RSAEncryptor()
{
PublicKeyPem = _rsa.ExportRSAPublicKeyPem(),
Padding = Padding

View File

@ -1,8 +1,9 @@
using DigitalData.Core.Security.Extensions;
using DigitalData.Core.Abstractions.Security;
using DigitalData.Core.Security.Extensions;
namespace DigitalData.Core.Security
{
public class RSAEncryptor : RSACryptographer
public class RSAEncryptor : RSACryptographer, IRSAEncryptor, IRSACryptographer
{
public required string PublicKeyPem
{